query_id
stringlengths 32
32
| query
stringlengths 7
6.75k
| positive_passages
listlengths 1
1
| negative_passages
listlengths 88
101
|
---|---|---|---|
2f06ec44f62bd2dda8b6287c5c32d4ec
|
has_many :character_notes has_many :character_goals
|
[
{
"docid": "094e0bbc2e95cfa18fa842b9382a27dd",
"score": "0.5836912",
"text": "def character_notes\n self.object.character_notes.map do |note|\n {\n c_note_id: note.id,\n c_note_title: note.title,\n c_note_content: note.content,\n visible_to_other_players: note.visible_to_other_players,\n amount_spent: note.amount_spent,\n amount_earned: note.amount_earned\n }\n end\n end",
"title": ""
}
] |
[
{
"docid": "18e7558bfd05d16876dbbcc5a0ab9ee7",
"score": "0.5592288",
"text": "def relatedChallenges\n Challenge.all(:select => \"challenges.*,skill_challenges.parent_id\",\n :joins => :skill_challenges,\n :conditions => { \n :skill_challenges => { :parent_id => self.skill_challenges.first.parent_id }\n },\n :order => \"skill_challenges.lft\")\n end",
"title": ""
},
{
"docid": "218f9e0b7f6b402ec60899b990dc7c1b",
"score": "0.55614567",
"text": "def show\n @other_groups = @character.project.groups - @character.groups\n @notable = @character\n @notes = @notable.notes\n @note = Note.new\n end",
"title": ""
},
{
"docid": "f778b79ee7c007c25e521f21ebd0bb09",
"score": "0.54616416",
"text": "def add_goals\n end",
"title": ""
},
{
"docid": "18e34ff47bfbbaeca6a8133d4f06d3ca",
"score": "0.54463995",
"text": "def has_many(goal, options = { })\n goal.belongs_to(self) unless options[:skip_belongs_to]\n self.associate(:has_many, goal, options)\n end",
"title": ""
},
{
"docid": "1165f0e25b63f40c0b8432a2f4c65c7f",
"score": "0.5406331",
"text": "def set_character_goal\n @character_goal = CharacterGoal.find(params[:id])\n end",
"title": ""
},
{
"docid": "4dd5fd72e6ad1e27dfe68a931d9e8970",
"score": "0.5319034",
"text": "def hmt(goal, options)\n thru = options[:through]\n self.has_many(thru)\n self.has_many(goal, :through => thru, :skip_belongs_to => true)\n unless options[:bidi] == false\n goal.has_many(thru)\n goal.has_many( self, { :through => thru, :skip_belongs_to => true })\n end\n end",
"title": ""
},
{
"docid": "5fa10552192ab8f4362f554270a7be9f",
"score": "0.5318175",
"text": "def total_goals\n Score.joins(:player).where(players: { user_id: self.id }).count\n end",
"title": ""
},
{
"docid": "72f589df8fd0aef4b5e26dd40e43cfee",
"score": "0.5300847",
"text": "def skills_tab\n skill_bonuses = @character.skill_bonuses.select_ability_total_bonus.select_skill_name.joins(:skill).joins(:ability_bonus)\n @insight = skill_bonuses.insight\n @perception = skill_bonuses.perception\n @skill_bonuses = skill_bonuses.sort_by(&:fr_name)\n @klass_choosable_skill_bonus = @character.klass.try(&:choosable_skills_to_a)\n end",
"title": ""
},
{
"docid": "eea46db3a551bc655f242e5d1504ecbc",
"score": "0.5245746",
"text": "def index\n @feat_assignments = @character.feat_assignments\n end",
"title": ""
},
{
"docid": "f5d52b58655d682d9336de4030ac42c6",
"score": "0.5225289",
"text": "def characters\n Character.all.select{ |character| character.actor == self }\n end",
"title": ""
},
{
"docid": "327078e593301ca5b37cb0b3cbf67fad",
"score": "0.52083236",
"text": "def characters\n Character.all.select {|character| character.actor == self }\n end",
"title": ""
},
{
"docid": "566d6a8edfb7001e70f285198df3d50b",
"score": "0.5203936",
"text": "def character_goal_params\n params.require(:character_goal).permit(:player_notebook_id, :title)\n end",
"title": ""
},
{
"docid": "21bf8673b5fbf19cf05b939e2d2abe55",
"score": "0.52024895",
"text": "def test_relationships_created\n characters = [Character.new(BLANK_RACE), Character.new(BLANK_RACE), Character.new(BLANK_RACE)]\n party = Party.new(characters)\n\n characters.each do |chara|\n assert_equal(party, chara.party, \"Characters should be related with their party\")\n end\n\n character = Character.new(BLANK_RACE)\n party << character\n assert_equal(party, character.party, \"Character must be related with it's party\")\n end",
"title": ""
},
{
"docid": "5bbc35ffac8ed614524dfd2e1a21e747",
"score": "0.51733345",
"text": "def generate_ship(story_characters, story)\n\n # If there are two characters, assume a ship, generate a ship relation\n if (story_characters && story_characters.length == 2)\n characterA = Character.find_by_ff_name(story_characters[0])\n characterB = Character.find_by_ff_name(story_characters[1])\n # find the ship with each character\n ships = Ship.joins(:characters).where(\"characters.id = #{characterA.id}\")\n\n ships.each do |ship|\n ship.characters.each do |character|\n if character.id == characterB.id\n generate_log(\"Attaching #{ship.name} To #{story.title} Based on Character Tags #{characterB.ff_name} & #{characterA.ff_name}\")\n # attach the ship to the story\n storyrelation = Storyrelation.new()\n storyrelation.story = story\n storyrelation.ship = ship\n storyrelation.save\n return\n end\n\n end\n end\n end\n\n # compare relationships_of_a to relationships_of_b to find if there is a matching ship_id\n # if there is a matching ship_id save that into ship_id\n # TODO there's got to be a faster way to do this\nend",
"title": ""
},
{
"docid": "679739f02b412f73e5fe4db8e5922328",
"score": "0.5128237",
"text": "def show\n @goal = @user.goals.find(params[:id])\n\n @tracked_activities = @goal.tracked_activities\n @untracked_activities = @goal.untracked_activities\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end",
"title": ""
},
{
"docid": "c5c8aad7097d93828dc0f3d9618e7f0a",
"score": "0.51220626",
"text": "def index\n\n @goals = @goalable.goals.order(\"deadline ASC\")\n @goal = Goal.new\n end",
"title": ""
},
{
"docid": "a3c0d7ea5e44d8879b05f8419d6c2be2",
"score": "0.51095057",
"text": "def show\n @active_goals = @supported_user.goals.where(:active => true)\n @recent_journal_entries = @supported_user.journal_entries.order(:dateTimeOfTraining).reverse.last(20)\n end",
"title": ""
},
{
"docid": "28cc00f2887440f56bd7666e734c4c02",
"score": "0.5107267",
"text": "def test_has_many_through_has_many_with_has_many_through_habtm_source_reflection\n greetings, more = comments(:greetings), comments(:more_greetings)\n\n assert_equal [greetings, more], authors(:bob).category_post_comments.order(\"comments.id\")\n end",
"title": ""
},
{
"docid": "6ff357f68fbc0049fc88f6808d559e1b",
"score": "0.5099249",
"text": "def takers\n self.questions.first.participants\n end",
"title": ""
},
{
"docid": "84079f7c4bfc08cf79fa7350a6f621a2",
"score": "0.504247",
"text": "def actors_list\n # characters.where(show_id: self.id)\n self.characters.map do |character|\n character.actor.full_name\n end\n end",
"title": ""
},
{
"docid": "2c1441b3b2f9716fa2ca65ccebcaa455",
"score": "0.50108933",
"text": "def actors \n self.characters.collect{ |character| character.actor}\n end",
"title": ""
},
{
"docid": "35999c63c603e380bfaac6fb31122c92",
"score": "0.5003872",
"text": "def create_enemies(character, new_char)\n character[\"enemies\"].each do |enemy_name| \n enemy_character = Character.find_by(name: enemy_name)\n if enemy_character\n if Relationship.find_by(character_one_id: new_char.id, character_two_id: enemy_character.id)\n Relationship.find_by(character_one_id: new_char.id, character_two_id: enemy_character.id).update(are_enemies: true, are_allies: false)\n else\n Relationship.create(character_one_id: new_char.id, character_two_id: enemy_character.id, are_enemies: true, are_allies: false)\n end\n end\n end\nend",
"title": ""
},
{
"docid": "e76b3cf2033932c12e86db4a4c811808",
"score": "0.49909243",
"text": "def actors_list\n self.characters.map do |c|\n \"#{c.actor.full_name}\"\n end\n end",
"title": ""
},
{
"docid": "d5c0f6af0214f5ac7c23f5054fe8d5ba",
"score": "0.49823278",
"text": "def associations; end",
"title": ""
},
{
"docid": "1f04439476e9e2eb40e692ea8fd5c7ba",
"score": "0.49802545",
"text": "def set_note_skills\n note_skills.each do |skill|\n self.skills.find_or_create_by(name: skill.name)\n end\n end",
"title": ""
},
{
"docid": "02e41ff0dea12775c1a0fab413aa95c9",
"score": "0.49550855",
"text": "def associated\n end",
"title": ""
},
{
"docid": "a2502fe07f9d809be6c7e478173efcd5",
"score": "0.4945097",
"text": "def exposed_attributes\n [ :id, :goal_id, :user_id, :accuracy, :time_to_complete, :note, :due_date ]\n end",
"title": ""
},
{
"docid": "3ea5480ccc4326df6f7136c67d5ee44b",
"score": "0.49114022",
"text": "def goals_to_goals\n @higher_goal = Goal.find_by(title: @row['Higher_goal_title'])\n @higher_goal.children << @current_goal_in_row\n end",
"title": ""
},
{
"docid": "24710f1b6a72c8d71fa3c5ccd218bc97",
"score": "0.49035507",
"text": "def test_has_many_through_has_and_belongs_to_many_with_has_many_source_reflection\n greetings, more = comments(:greetings), comments(:more_greetings)\n\n assert_equal [greetings, more], categories(:technology).post_comments.order(\"comments.id\")\n end",
"title": ""
},
{
"docid": "232e81653b3b98f18fb792578289a415",
"score": "0.48903185",
"text": "def references\n GameContent.where reference_id: self.id\n end",
"title": ""
},
{
"docid": "8bb6a83b49ab4286f5c0907e61331cb5",
"score": "0.4886406",
"text": "def carried_weapons\n CharacterWeapon.where(:character_id => self.id, :carried => :true).order('equipped desc')\n end",
"title": ""
},
{
"docid": "8a52ba4617862dddeb6a1f346e6014be",
"score": "0.48800227",
"text": "def belongs_to(goal, options = { })\n self.foreign_keys[goal.foreign_key] = \"references\"\n self.validates(:presence_of, goal.foreign_key)\n self.associate(:belongs_to, goal, options)\n end",
"title": ""
},
{
"docid": "18b84218f71ab1ec223c11472719a611",
"score": "0.48797113",
"text": "def give_goals_to_user\n self.goals.create(category: \"Use my own bags at the store\", point_value: 12, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Carpool instead of use my car\", point_value: 100, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Air dry a load of laundry\", point_value: 70, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Adjust the thermostat up 1 degree in summer\", point_value: 40, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Install a compact fluorescent light bulb\", point_value: 60, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Ride a bike instead of car 1 mile\", point_value: 20, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Take a shorter shower (5 min or less)\", point_value: 4, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Turn off my engine instead of idleing\", point_value: 15, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n self.goals.create(category: \"Buy or eat local\", point_value: 15, frequency: 0, weekly_points_goal: 0, weekly_results: 0)\n\n\n end",
"title": ""
},
{
"docid": "dfcf6be2c9aa65ddb63a31a39e311256",
"score": "0.48794645",
"text": "def child_relation; end",
"title": ""
},
{
"docid": "4805ab4b709dcd46eb135a6bc04d595d",
"score": "0.4866148",
"text": "def create\n @challenge = Challenge.new(challenge_params)\n @user = User.find(current_user.id)\n @interaction = UsChalInteraction.create(:interaction => \"created\")\n @user.us_chal_interactions << @interaction\n @challenge.us_chal_interactions << @interaction\n\n respond_to do |format|\n if @challenge.save\n format.html { redirect_to @challenge, notice: 'Challenge was successfully created.' }\n format.json { render :show, status: :created, location: @challenge }\n else\n format.html { render :new }\n format.json { render json: @challenge.errors, status: :unprocessable_entity }\n end\n end\n # @user = @challenge.us_chal_interactions.where(:interaction => \"created\").first.user # Matt - what is this for?\n end",
"title": ""
},
{
"docid": "11756cf8e11b89c7f2872e29090162ea",
"score": "0.48332846",
"text": "def index\n @goals = Goal.select{|goal| goal.resolution.user_id == current_user.id}\n end",
"title": ""
},
{
"docid": "dd438a5b1b861fe3f2cfa669b50fa019",
"score": "0.48222458",
"text": "def my\n \t@bmet_work_orders = BmetWorkOrder.includes(:requester, :owner, {:bmet_item => [{:department => :facility},:bmet_model]}).where(\"facilities.id=?\",current_user.facility).references(:facility)\n @texts = Text.includes(:bmet_work_order=> {:bmet_item => {:department => :facility}}).where(\"facilities.id=?\",current_user.facility).references(:facility)\n end",
"title": ""
},
{
"docid": "d52f92da8308864b79e4672c113c0a8f",
"score": "0.48162386",
"text": "def index\n @goals = current_user.goals.all\n end",
"title": ""
},
{
"docid": "fb1bd6a99b4e66d33488c0f99dd56649",
"score": "0.48056525",
"text": "def test_can_accept_multiple_notes\n p = players(:manny)\n assert_equal [], p.notes\n note1 = Note.create!(:body => \"note 1\")\n note2 = Note.create!(:body => \"note 2\")\n p.notes << note1\n p.notes << note2\n assert_equal [note1, note2], p.notes\n end",
"title": ""
},
{
"docid": "19d799fff31cd26a892a94cf00485c48",
"score": "0.48020485",
"text": "def index\n\n @goals = current_user.goals\n\n end",
"title": ""
},
{
"docid": "3babe276627245fa64156dd3f5320b78",
"score": "0.48005384",
"text": "def get_uncompleted_quests()\n Quest.all.select do |quest|\n quest.characters.include?(self) == false\n end\n\n end",
"title": ""
},
{
"docid": "c8961eb0c4538f9999f582a6475d1e24",
"score": "0.47912335",
"text": "def actors \n characters.map { | characters | characters.actor}.uniq\n end",
"title": ""
},
{
"docid": "9f690030ea260a23d8b320dc8b45c423",
"score": "0.47889164",
"text": "def related\n council.wards\n end",
"title": ""
},
{
"docid": "e519cb4b9780fc33c0dcc0817c2ee598",
"score": "0.4753395",
"text": "def index\n @goals = current_user.goals\n end",
"title": ""
},
{
"docid": "5887a413dd294043e3e29edc0e2e54f1",
"score": "0.47365862",
"text": "def save!\n quest = Quest.new\n quest.parent_id = @parent_id\n quest.main_quest_slides = @main_quest_slides.try(:join, \",\")\n quest.rewards = @achievement ? nil : @rewards\n quest.achievement = @achievement\n quest.id = @quest_id\n quest.save!\n\n @objectives.each do |klass, options|\n objective = klass.new(options)\n objective.quest = quest\n objective.save!\n end\n\n quest\n end",
"title": ""
},
{
"docid": "de2d396a17cc37b8d623aebe405c4bdb",
"score": "0.4723166",
"text": "def notes\n\t\tNote.find(:all)\n\tend",
"title": ""
},
{
"docid": "3b74ee2ea531d12446e03489bd44cf36",
"score": "0.47206125",
"text": "def followed\n @letters = @user.followed_letters.sort { |x, y| y.created_at <=> x.created_at }\n end",
"title": ""
},
{
"docid": "e5f0cffd69e0e543cc6bd72aa22b928b",
"score": "0.47116092",
"text": "def targeting\n @things.targeting\n end",
"title": ""
},
{
"docid": "6cb0f63ab607fcd5318d61dd4359fd67",
"score": "0.47066352",
"text": "def show\n @goals = current_user.goals\n end",
"title": ""
},
{
"docid": "16d3e2023a67402ec74b280608152783",
"score": "0.47018394",
"text": "def other_notes_key\n Observation.other_notes_key\n end",
"title": ""
},
{
"docid": "006ca3b1709471e852c54e7e9f7b0ada",
"score": "0.46989992",
"text": "def add_demonstrator\n @courses = current_staff.courses\n # find future practicals\n current_time = DateTime.now\n @practicals_of_course = {}\n @courses.each do |course|\n @practicals_of_course[course.course_title] = course.practicals.where('start_time >= ?', current_time)\n end\n end",
"title": ""
},
{
"docid": "3ea942b6cdf3c6676dadb1f4c9441c38",
"score": "0.46846563",
"text": "def responsable_of\n self.references\n end",
"title": ""
},
{
"docid": "a04aa69e91051e5f356f34063b6272fa",
"score": "0.4679374",
"text": "def item_target_actors\n [$game_party.members[0]]\n end",
"title": ""
},
{
"docid": "aa3364f77e21480b662a282946aa71ee",
"score": "0.46779582",
"text": "def goal_params\n params.require(:goal).permit(:user_id, :goals, :status, :notes)\n end",
"title": ""
},
{
"docid": "19969b5ef3d6b9ff267838b9896ac9fb",
"score": "0.46767697",
"text": "def games(complete = nil)\n games_scope = Game.where('challenger_id = ? OR challenged_id = ?', self.id, self.id)\n games_scope.includes(:challenged, :challenger)\n games_scope.where('complete = ?', complete) if complete\n games_scope = games_scope.order('created_at DESC')\n\n games_scope\n end",
"title": ""
},
{
"docid": "b8d0c54a8c0088372afe3334ff3c0476",
"score": "0.46678448",
"text": "def friends_activities\n Activity.includes(:user, :intensity, :exercise_unit, :exercise_type).includes(:comments => [:user]).includes(:cheers => [:user]).where(:user_id => [self.friends.ids]).order(date: :desc)\n end",
"title": ""
},
{
"docid": "3847e2652e56f6dd9f854414d0463c63",
"score": "0.46650615",
"text": "def record_attrs\n %i[\n championship\n serie\n round\n team\n opponent\n id_match\n team_score\n opponent_score\n updates\n date\n start_at\n place\n ]\n end",
"title": ""
},
{
"docid": "0f19e502be814ae6e6a27cd6210b2d5c",
"score": "0.46645367",
"text": "def linkable\n\t\tself.character\n\tend",
"title": ""
},
{
"docid": "f65cd1edd214b616c54d8f9ee255d465",
"score": "0.46607244",
"text": "def actors\n self.characters.collect{ |character| character.actor }\n end",
"title": ""
},
{
"docid": "35088ae458ef0eac77217e28565e9ecd",
"score": "0.4658387",
"text": "def index\n @goals = current_user.goals.order(created_at: :desc)\n end",
"title": ""
},
{
"docid": "1bfffdedd55a24a438b52736a9a8aa00",
"score": "0.4651669",
"text": "def num_characters\n Character.all.select {|character| character.actor == self}.size\n end",
"title": ""
},
{
"docid": "104d872c238b10b26ae2620c12ba1de7",
"score": "0.46503508",
"text": "def with_workers_works_a_bit\n association_join(:workers, select: [:id, :title])\n end",
"title": ""
},
{
"docid": "0933c62745f5ffefa1f1d573653c9d54",
"score": "0.46402135",
"text": "def gyms \n self.memberships.map do |membership|\n membership.gym\n end\nend",
"title": ""
},
{
"docid": "1aa345029c9670877d193d44c016c5b1",
"score": "0.4635546",
"text": "def work_associations(items)\n puts \" collecting work associations\"\n x = []\n items.each do |work|\n print \".\"; STDOUT.flush\n next unless (!work.unrevealed? && work.posted?) || !MULTI\n x << work.taggings\n TAGS << work.tags\n x << work.creatorships\n PSEUDS << work.pseuds\n x << work\n x << work.language\n x << work.hit_counter\n x << work.gifts\n PSEUDS << work.gifts.map(&:pseud)\n x << work.kudos\n PSEUDS << work.kudos.map(&:pseud)\n x << work.collection_items\n x << work.collections\n work.collections.each do |c|\n x << c.collection_profile\n x << c.collection_preference\n x << c.collection_participants\n PSEUDS << c.collection_participants.map(&:pseud)\n end\n x << work.serial_works\n x << work.series\n work.chapters.each do |c|\n x << c if c.posted? || !MULTI\n PSEUDS << c.pseuds\n x << c.comments\n PSEUDS << c.comments.map(&:pseud)\n x << c.kudos\n PSEUDS << c.kudos.map(&:pseud)\n end\n end\n x.flatten.compact.uniq\nend",
"title": ""
},
{
"docid": "eac1ba1fa33ce281cca09dc0b4fd0540",
"score": "0.46315876",
"text": "def create_characters\n @db.execute %Q{\n CREATE TABLE Characters (\n id INTEGER PRIMARY KEY NOT NULL,\n character_name TEXT NOT NULL,\n image TEXT NOT NULL,\n team TEXT NOT NULL\n );\n }\n end",
"title": ""
},
{
"docid": "34129376bbf11ce9ff047c65450db5c4",
"score": "0.46309066",
"text": "def generate_characters(story_characters, story)\n if story_characters\n story_characters.each do |story_character|\n\n character =generate_character(story_character)\n # create a new protagnist link\n protagnist = Protagnist.new()\n protagnist.character = character\n protagnist.story = story\n protagnist.save\n end\n end\n\n generate_ship(story_characters, story)\nend",
"title": ""
},
{
"docid": "74f9db115941bf20777936434014d2fe",
"score": "0.46264645",
"text": "def test_course_has_many_readings_through_course_lessons\n # Set up a Course to have many readings through the Course's lessons.\n biology = Course.create(name: \"Integer Math\")\n lesson = Lesson.create(name: \"Addition\", course_id: biology.id)\n r1 = Reading.create(caption: \"1\", lesson_id: lesson.id, order_number: 3, url: \"http://reading_one.com\")\n r2 = Reading.create(caption: \"2\", lesson_id: lesson.id, order_number: 3, url: \"http://reading_one.com\")\n r3 = Reading.create(caption: \"3\", lesson_id: lesson.id, order_number: 3, url: \"http://reading_one.com\")\n\n assert_equal [r1, r2, r3], biology.readings\n assert_equal biology, r1.course\n assert_equal biology, r2.course\n assert_equal biology, r3.course\n end",
"title": ""
},
{
"docid": "d992561618d09ddc0aad362e97d62ea0",
"score": "0.46238607",
"text": "def notes_from_training\n end",
"title": ""
},
{
"docid": "23a59aeba16aeced988f89886b0e677b",
"score": "0.46224147",
"text": "def participants\n User.find([self.thought.user_id,*thought.comments.map(&:user_id)].compact-[self.user_id])\n end",
"title": ""
},
{
"docid": "5be162e4758c448a02b2ab4ff08ea50a",
"score": "0.46112716",
"text": "def characters\n self.char_episode.collect{ |char_episode| char_episode.character }\n end",
"title": ""
},
{
"docid": "98156e4841a46637a2ec9b102610613b",
"score": "0.4593465",
"text": "def talks\n @talks ||= Talk.all.select { |t| t.edition_id == self.id }\n end",
"title": ""
},
{
"docid": "89db7140caa4d20ba50317e904078014",
"score": "0.45893493",
"text": "def sub_facts\n MatterFact.all(:conditions => [\"parent_id = ?\", self.id])\n end",
"title": ""
},
{
"docid": "b700fc3fc96d2d28513f8ddf31c59101",
"score": "0.4585518",
"text": "def goals(player_id)\n Stat.where(player_id: player_id).sum(:goals)\n end",
"title": ""
},
{
"docid": "f437092ce0595bd1d5260a575463beef",
"score": "0.45824406",
"text": "def index\n @challenge_participants = @challenge.challenge_participants.includes(:team, :user)\n end",
"title": ""
},
{
"docid": "50ce48550fbe05386e2cf2af5ac1a758",
"score": "0.4577385",
"text": "def quest_duration\n Objective.find_by_id(self.objective_id).duration.capitalize\n end",
"title": ""
},
{
"docid": "8860ae2dc311ed00fc7ca4635e92a05c",
"score": "0.4575108",
"text": "def replies\n Reply.find_by_question_id(self.id)\n end",
"title": ""
},
{
"docid": "76f1a84b927240a9cc7517c58c501a78",
"score": "0.45738932",
"text": "def index\n @goals = Goal.where(user_id:current_user)\n end",
"title": ""
},
{
"docid": "ab217d643e7d3a16f969ccaa7eb2e45c",
"score": "0.45645592",
"text": "def show\n @participated = false\n # continue here\n @rounds = @tournament.rounds\n if current_user\n @characters = current_user.characters\n @characters.each do |character|\n @chatours = character.tournaments\n @chatours.each do |chatour|\n if chatour.id == @tournament.id\n @participated = true\n @character = character\n end\n end\n end\n end \n\n end",
"title": ""
},
{
"docid": "6bdc5fbabf00b830794438126a7f8283",
"score": "0.4563085",
"text": "def pending_quests\n quests = UsersQuest.where(:assignee_id => @current_user.id,:is_accepted => false,:is_rejected =>false).pluck(:quest_id)\n @quests = Quest.where(:id => quests).order('due_date')\n by_me_quests = UsersQuest.where(:assignor_id => @current_user.id,:is_accepted => false,:is_rejected =>false).pluck(:quest_id)\n @by_me_quests = Quest.where(:id => by_me_quests).order('due_date')\n end",
"title": ""
},
{
"docid": "7dc5ec992c09579ac6c3ace4b284ad60",
"score": "0.45613077",
"text": "def characters\n chars = []\n participants.each do |participant|\n chars << participant.character unless chars.include?(participant.character)\n end\n chars\n end",
"title": ""
},
{
"docid": "5ebc79616410668a57559c5f4d988464",
"score": "0.45597193",
"text": "def test_has_many_patients\r\n responsible_party_patient_count = @responsible_party.patients.count\r\n patient_count = Patient.count\r\n assert_not_equal(0, responsible_party_patient_count, \"No Patient's found for this ResponsibleParty.\")\r\n end",
"title": ""
},
{
"docid": "f43811b5ce5441dff9741620d2246ff4",
"score": "0.45586085",
"text": "def index\n @objectives = @goal.objectives.all \n render json: @objectives \n end",
"title": ""
},
{
"docid": "93feaf8168902e9f5f6715f67ff899d1",
"score": "0.4557761",
"text": "def new\n @training = training_class.new\n\n current_user.goals.each { |my_goal|\n training_achievement = TrainingAchievement.new\n training_achievement.users_goal = my_goal\n @training.training_achievements << training_achievement\n }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @training }\n end\n end",
"title": ""
},
{
"docid": "93a3bde3eec0fbb463bf8cd88b6c6277",
"score": "0.45493296",
"text": "def child_replies\n Reply.find_by_parent_id(self.id) \n end",
"title": ""
},
{
"docid": "0e760d8f9064b710bda14603ecaa89aa",
"score": "0.45452124",
"text": "def test_relationships_broken\n character1 = Character.new(BLANK_RACE)\n character2 = Character.new(BLANK_RACE)\n character3 = Character.new(BLANK_RACE)\n character4 = Character.new(BLANK_RACE)\n party = Party.new([character1, character2, character3, character4])\n\n party.remove(character1)\n assert_nil(character1.party, \"Relationships should be broken when characters are removed from parties\")\n\n party.remove!(character2)\n assert_nil(character2.party, \"Relationships should be broken when characters are removed from parties\")\n\n character3.leave_party\n assert_nil(character3.party, \"Relationships should be broken when characters leave their parties\")\n end",
"title": ""
},
{
"docid": "e38db2860642561ddc5d3a0c9e588f5e",
"score": "0.45375505",
"text": "def goals_scored(player)\n\t\tself.positions.where(\"positions.player_id = ?\",player.id).joins(:goals).merge(Goal.scored_goal).count\n\tend",
"title": ""
},
{
"docid": "974fc8d0e4e1d462706f726c9616d975",
"score": "0.4532038",
"text": "def games(complete = nil)\n games_scope = Game.where('challenger_id = ? OR challenged_id = ?', id, id)\n games_scope.includes(:challenged, :challenger)\n games_scope.where('complete = ?', complete) if complete\n games_scope = games_scope.order('created_at DESC')\n\n games_scope\n end",
"title": ""
},
{
"docid": "61fb36ce06b9d9f725ae52440e679ac4",
"score": "0.4530752",
"text": "def general_quests\n quests = UsersQuest.where(:assignee_id => @current_user.id,:is_accepted => true).where.not(:assignor_id => @current_user.id).pluck(:quest_id)\n @quests = Quest.where(:id => quests).order('due_date')\n end",
"title": ""
},
{
"docid": "8035c90eba633a7f5328af9b47b05527",
"score": "0.45277497",
"text": "def notes\n return Note.find(:all, :conditions => [\"type_id = ? AND owner = ?\", self.id, :property ])\n end",
"title": ""
},
{
"docid": "8b038fad5a07e1b0b5e6c57ebfe7ddae",
"score": "0.45230186",
"text": "def test_has_many_through_belongs_to_with_has_many_through_source_reflection\n welcome_general, thinking_general = taggings(:welcome_general), taggings(:thinking_general)\n\n assert_equal [welcome_general, thinking_general],\n categorizations(:david_welcome_general).post_taggings.order(\"taggings.id\")\n end",
"title": ""
},
{
"docid": "2dd4e18431236061af1347426b7b4277",
"score": "0.45204982",
"text": "def all_objectives\n Objective.all\n end",
"title": ""
},
{
"docid": "b63630fdc5fa1422d4a2edd3da929aa8",
"score": "0.4519093",
"text": "def skills\n\t\t[]\n\tend",
"title": ""
},
{
"docid": "6b19565cf455cdb7163cb7ef2f688566",
"score": "0.45151109",
"text": "def index\n @goals = Goal.all\n end",
"title": ""
},
{
"docid": "6b19565cf455cdb7163cb7ef2f688566",
"score": "0.45151109",
"text": "def index\n @goals = Goal.all\n end",
"title": ""
},
{
"docid": "6b19565cf455cdb7163cb7ef2f688566",
"score": "0.45151109",
"text": "def index\n @goals = Goal.all\n end",
"title": ""
},
{
"docid": "6b19565cf455cdb7163cb7ef2f688566",
"score": "0.45151109",
"text": "def index\n @goals = Goal.all\n end",
"title": ""
},
{
"docid": "79670b1598b146e4b504f1b32c404495",
"score": "0.45123005",
"text": "def dictator_Iraq\n puts \"Saddam formally rose to power in 1979, although he had been the de facto head\n of Iraq for several years prior. Within his own country, he suppressed\n his own citizens, particularly the Shi'a and Kurdish people. He also maintained\n power during the Iran–Iraq War and the Gulf War, and was accused of using\n chemical weapons. To alleviate the threat of revolution, Saddam afforded\n certain benefits to the potentially hostile population. Membership in the\n Ba'ath Party remained open to all Iraqi citizens regardless of background.\n However, repressive measures were taken against its opponents. The major\n instruments for accomplishing this control were the paramilitary and police\n organizations. Saddam was notable for using terror against his own people.\n Saddam's regime was responsible for the deaths of at least 250,000\n Iraqis and committed war crimes in Iran, Kuwait, and Saudi Arabia. Human\n Rights Watch and Amnesty International issued regular reports of widespread\n imprisonment and torture.\"\n\n crazy_acts\n\nend",
"title": ""
},
{
"docid": "077086131fee62b038dc117cb2036e66",
"score": "0.45066872",
"text": "def notes\n\t\tall.map do |tone|\n\t\t\tKey.from_index(tone.tone, tone.letter_index).name\n\t\tend.extend(NoteSequence)\n\tend",
"title": ""
},
{
"docid": "b69ccfc7f3d536a4a801a19aceb0c77a",
"score": "0.4504754",
"text": "def new\n @auto_register_game_id = params[:auto_register_game_id]\n\n @character = current_user.characters.new\n 6.times { @character.c_attributes.build }\n 3.times { @character.c_skills.build }\n 3.times { @character.c_special_attributes.build }\n 3.times { @character.c_qualities.build }\n 3.times { @character.c_special_abilities.build }\n 3.times { @character.c_powers.build }\n 3.times { @character.c_maxwounds.build }\n 3.times { @character.c_healings.build }\n 3.times { @character.c_armors.build }\n 3.times { @character.c_wound_levels.build }\n 3.times { @character.c_weapons.build }\n 3.times { @character.c_possessions.build }\n\n @character.c_distinguishing_features.build\n @character.c_mannerisms.build\n @character.c_virtues.build\n @character.c_flaws.build\n @character.c_educations.build\n @character.c_trainings.build\n @character.c_interests.build\n @character.c_hobbies.build\n @character.c_goals.build\n\n 2.times { @character.c_combats.build }\n # @character.c_combats[0].name = 'Initiative'\n # @character.c_combats[1].name = 'Common Attack'\n # @character.c_combats[2].name = 'Common Attack'\n # @character.c_combats[3].name = 'Common Defense'\n # @character.c_combats[4].name = 'Common Defense'\n # @character.c_combats[5].name = 'Common Maneuver'\n # @character.c_combats[6].name = 'Common Maneuver'\n # @character.c_combats[7].name = 'Common Maneuver'\n # @character.c_combats[8].name = 'Misc Bonuses'\n # @character.c_combats[9].name = 'Misc Penalties'\n\n 2.times { @character.c_damages.build }\n # @character.c_damages[0].name = 'Max Damage'\n # @character.c_damages[1].name = 'Wound Level'\n # @character.c_damages[2].name = 'Wound Level'\n # @character.c_damages[3].name = 'Wound Level'\n # @character.c_damages[4].name = 'Wound Level'\n # @character.c_damages[5].name = 'Wound Level'\n # @character.c_damages[6].name = 'Wound Level'\n # @character.c_damages[7].name = 'Healing Abilities'\n # @character.c_damages[8].name = 'Physical Conditions'\n # @character.c_damages[9].name = 'Mental Conditions'\n\n 2.times { @character.c_movements.build }\n # @character.c_movements[0].name = 'Max Speed'\n # @character.c_movements[1].name = 'Cautious Speed'\n # @character.c_movements[2].name = 'Penalties'\n # @character.c_movements[3].name = 'Misc'\n\n 2.times { @character.c_physical_abilities.build }\n # @character.c_physical_abilities[0].name = 'Lift'\n # @character.c_physical_abilities[1].name = 'Carry'\n # @character.c_physical_abilities[2].name = 'Push/Drag'\n # @character.c_physical_abilities[3].name = 'Jump'\n # @character.c_physical_abilities[4].name = 'Climb'\n # @character.c_physical_abilities[5].name = 'Swim'\n # @character.c_physical_abilities[6].name = 'Fly'\n # @character.c_physical_abilities[7].name = 'Other'\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character }\n end\n end",
"title": ""
},
{
"docid": "2baaf62963fe8fd4db88139ce0d590aa",
"score": "0.45023757",
"text": "def create\n @character = Character.new(character_params)\n @character.user_id = current_user.id\n @character.credits = 500\n\n respond_to do |format|\n if @character.save\n Skill.where(true).each do |skill|\n @character_skill = CharacterSkill.new\n @character_skill.character_id = @character.id\n @character_skill.ranks = 0\n @character_skill.free_ranks_career = 0\n @character_skill.free_ranks_specialization = 0\n @character_skill.free_ranks_race = 0\n @character_skill.free_ranks_equipment = 0\n @character_skill.skill_id = skill.id\n\n @character_skill.save\n end\n\n species = Race.find(@character.race_id)\n\n # Save subspecies.\n if params[:sub_species] && species.respond_to?(\"#{species.name.gsub(' ', '').downcase}_traits\")\n traits = species.send(\"#{species.name.gsub(' ', '').downcase}_traits\")\n if traits[:sub_species][params[:sub_species]]\n # Add experience entry in the adventure log for species bonus XP.\n AdventureLog.where(character_id: @character.id, experience: traits[:sub_species][params[:sub_species]][:exp_bonus], date: @character.created_at, log: 'Subspecies bonus experience', user_id: 0).create\n @character.update_attribute(:subspecies, params[:sub_species])\n end\n end\n\n # Save selectable free species skill ranks.\n if params[:skill_rank_choice]\n @character_skill = CharacterSkill.where(character_id: @character.id, skill_id: params[:skill_rank_choice]).first\n if @character_skill\n @character_skill.free_ranks_race = 1\n @character_skill.save\n\n # Save experience entry.\n set_experience_cost(@character.id, 'skill', params[:skill_rank_choice], 1, 'up', 'race')\n CharacterStartingSkillRank.where(character_id: @character.id, skill_id: params[:skill_rank_choice], granted_by: 'race', ranks: 1).first_or_create\n end\n end\n\n # Create a placeholder character name if no name was given.\n if @character.name.blank?\n @character.update_attribute(:name, \"#{@character.race.name} #{@character.career.name} #(#{@character.id})\")\n end\n\n format.html { redirect_to user_character_url(current_user, @character), notice: 'Character was successfully created.' }\n format.json { render json: @character, status: :created, location: @character }\n else\n format.html { render action: 'new' }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
175b0e3cf87e39db10dc9dd57720e4eb
|
adjust the display numbers (ordering numbers) of a secondary publication based on the study id
|
[
{
"docid": "81d82675f068fcc54c70344c029314c9",
"score": "0.78955173",
"text": "def shift_display_numbers(study_id)\n myNum = self.display_number\n hi_pubs = SecondaryPublication.find(:all, :conditions => [\"study_id = ? AND display_number > ?\", study_id, myNum])\n hi_pubs.each { |pub|\n tmpNum = pub.display_number\n pub.display_number = tmpNum - 1\n pub.save\n }\n end",
"title": ""
}
] |
[
{
"docid": "f19d11bf8730a5667b99b6e9e3dbc3db",
"score": "0.67729294",
"text": "def shift_display_numbers(study_id, ef_id)\n myNum = self.display_number\n high_things = Arm.find(:all, :conditions => [\"study_id = ? AND display_number > ? AND extraction_form_id = ?\", study_id, myNum, ef_id])\n high_things.each do |thing|\n #print \"\\n\\n\\n THING: #{thing.title}\\n\\n\\n\"\n tmpNum = thing.display_number\n #print \"tmpNum: #{tmpNum.to_s}\\n\\n\"\n thing.display_number = tmpNum - 1\n thing.save\n #print \"NEW DISPLAY NUMBER: #{thing.display_number.to_s}\\n\\n\"\n end\n end",
"title": ""
},
{
"docid": "7780ae9e183e0ed8cc69c1e1bae8d801",
"score": "0.6733405",
"text": "def shift_display_numbers(extraction_form_id)\n\t\tputs \"Shifting display numbers.\"\n\t\tmyNum = self.display_number\n\t\tputs \"Display num is #{myNum}\\n\"\n\t\thigh_things = QualityRatingField.find(:all, :conditions => [\"extraction_form_id = ? AND display_number > ?\", extraction_form_id, myNum])\n\t\thigh_things.each { |thing|\n\t\t tmpNum = thing.display_number\n\t\t tmpNum -= 1\n\t\t puts \"Updating #{thing.display_number} to #{tmpNum}\\n\"\n\t\t thing.display_number = tmpNum\n\t\t thing.save \n\t\t puts \"Should have saved properly.\"\n\t }\n\tend",
"title": ""
},
{
"docid": "ec94657bd273952aa84b7c7064a32f25",
"score": "0.66129297",
"text": "def get_display_number(study_id)\n current_max = SecondaryPublication.maximum(\"display_number\",:conditions => [\"study_id = ?\", study_id])\n if (current_max.nil?)\n current_max = 0\n end\n return current_max + 1\n end",
"title": ""
},
{
"docid": "b4da6988785939688adb4952a63a5623",
"score": "0.5874745",
"text": "def sort_lease_sub_details\n @suites = PropertySuite.find(:all, :conditions=>['real_estate_property_id = ?', params[:id]]).map(&:id) unless @note.nil?\n @sub_leases = PropertyLease.find(:all , :conditions=>['month = ? and year = ? and occupancy_type = ? and property_suite_id IN(?)', params[:tl_month], params[:tl_year], params[:occupancy_type], @suites],:order=>\"#{params[:field]} #{params[:key]}\") unless @suites.nil?\n @sub_leases = @sub_leases.paginate :page => params[:page], :per_page => 10\n render :update do |page|\n page.replace_html 'portfolio_overview_property_graph', :partial=>\"/properties/property_lease_sub_performance\",:locals => {:sub_leases => @sub_leases,\n :start_date => @start_date,:note_collection => @note}\n end\n end",
"title": ""
},
{
"docid": "cce295172cb52eeb7cea3d107aa4c595",
"score": "0.57697326",
"text": "def display(final_hash, docindex)\n new_docindex = Hash.new\n\n docindex.each do |key, value|\n value[0] = 0\n end\n\n # update value[0] with scores (save space)\n final_hash.each do |key, value|\n docindex[key][0] = value \n end\n # sort with links with higher scores in the front\n docindex = docindex.sort {|a, b| a[1] <=> b[1]}.reverse\n \n # value[0] - scores, value[1] - title, value[2] - link\n docindex.each do |key, value|\n new_docindex[key] = [value[2],value[1],value[0]]\n\n end\n return new_docindex\nend",
"title": ""
},
{
"docid": "b34bf243cc64d1c6c900c3bae69d8e22",
"score": "0.5753574",
"text": "def update_display_numbers_for_deletion\n higher_numbers = OutcomeDataEntry.find(:all, :conditions=>[\"outcome_id = ? AND subgroup_id = ? AND extraction_form_id = ? AND study_id = ? AND display_number > ?\", self.outcome_id, self.subgroup_id, self.extraction_form_id, self.study_id, self.display_number])\n unless higher_numbers.empty?\n higher_numbers.each do |obj|\n obj.display_number = obj.display_number - 1\n obj.save \n end\n end\n end",
"title": ""
},
{
"docid": "cf4754e44f2e21cfd6be7df51abc1b65",
"score": "0.574613",
"text": "def increment_display_order\n target_display_order = self.display_order + 1\n self.move_display_field(target_display_order) unless target_display_order > self.survey_version.display_fields.count\n end",
"title": ""
},
{
"docid": "8b0a4231ab5744bd08e15f61fa32e170",
"score": "0.5745466",
"text": "def get_secondary_publications(ef_id)\n secondary = SecondaryPublication.find(:all, :order => 'display_number ASC', :conditions => [\"study_id = ?\", self.id])\n return secondary\n end",
"title": ""
},
{
"docid": "715972c7acbd742e08757d6c1f4c1192",
"score": "0.5604655",
"text": "def display_number\n \"Lesson #{lesson.number}, Part #{number}\"\n end",
"title": ""
},
{
"docid": "b00664bab8f54f1b069a9dd6307cbb8c",
"score": "0.55920124",
"text": "def update\n @primary_publication = PrimaryPublication.find(params[:id])\n\t @study = Study.find(@primary_publication.study_id)\t\n \n # Handle Primary Publication Identifier list management -------------------------------------------\n id_numbers = params[:publication_ids]\n id_types = params[:publication_types]\n\n current_values = PrimaryPublicationNumber.where(:primary_publication_id=>@primary_publication.id)\n current_values_by_id = Hash.new\n current_values.each do |cv|\n current_values_by_id[cv.id] = cv\n end\n unless id_numbers.nil?\n # for each of the identifiers specified\n id_numbers.keys.each do |key|\n this_number = id_numbers[key]\n this_type = id_types[key]\n # if the key is negative, it means we need to create a new entry in the database\n if key.to_i < 0\n PrimaryPublicationNumber.create(:primary_publication_id=>@primary_publication.id, :number=>this_number, :number_type=>this_type)\n else\n # if the key is positive, collect the pre-existing identifier and update it with the new information\n ppid = PrimaryPublicationNumber.find(key)\n ppid.number = this_number\n ppid.number_type = this_type\n ppid.save\n\n # remove this from the current_values hash so we know we're still using it\n current_values_by_id.delete(ppid.id)\n end\n end\n end\n\n # get rid of any primary publication numbers that were not included this time\n current_values_by_id.keys.each do |k|\n PrimaryPublicationNumber.destroy(k)\n end\n \n # Now refresh list of publication identifiers\n @publication_ids = PrimaryPublicationNumber.find(:all, :conditions=>[\"primary_publication_id = ?\", @primary_publication.id])\n \n if @saved = @primary_publication.update_attributes(params[:primary_publication])\n @message_div = \"saved_indicator_1\"\n @new_citation = @study.get_citation.gsub(\"\\n\",\"\")\n @author = \"#{@study.get_first_author} (#{@primary_publication.pmid})\"\n else\n problem_html = create_error_message_html(@primary_publication.errors)\n flash[:modal_error] = problem_html\n @error_partial = \"layouts/info_messages\" \n @error_div = \"validation_message\" \n end\n # Return to previous page\n # redirect_to :back\n end",
"title": ""
},
{
"docid": "522d0b9b6c2344d9bfe90ce36ad35248",
"score": "0.5529785",
"text": "def update_display_number new_position\n current_position = self.display_number\n unless current_position.nil? || current_position == 0\n # if the new position is lower, take all existing with display numbers ranging from\n # new position to current position - 1 and increment them. \n if new_position < current_position\n displays_to_change = (new_position..current_position-1).to_a\n existing_objs = OutcomeDataEntry.where(:outcome_id=>self.outcome_id, :subgroup_id=>self.subgroup_id,\n :extraction_form_id=>self.extraction_form_id,:study_id=>self.study_id,\n :display_number=>displays_to_change)\n unless existing_objs.empty?\n existing_objs.each do |eo|\n eo.display_number = eo.display_number + 1\n eo.save\n end\n end\n # if the new position is higher, take all existing with display numbers ranging from\n # current position+1 to new position and decrement them. \n elsif new_position > current_position\n displays_to_change = (current_position+1..new_position).to_a\n existing_objs = OutcomeDataEntry.where(:outcome_id=>self.outcome_id,:subgroup_id=>self.subgroup_id,\n :extraction_form_id=>self.extraction_form_id,\n :study_id=>self.study_id, :display_number=>displays_to_change)\n unless existing_objs.empty?\n existing_objs.each do |eo|\n eo.display_number = eo.display_number - 1\n eo.save\n end\n end\n end\n # if the current_position was nil or zero...\n # (THIS WAS IMPLEMENTED FOR OLD DATABASE ENTRIES THAT DIDN'T HAVE DISPLAY NUMBERS)\n else\n # cycle through existing objects and assign a random order other than the one we just updated\n existing_objs = OutcomeDataEntry.where(:outcome_id=>self.outcome_id, :subgroup_id=>self.subgroup_id,\n :extraction_form_id=>self.extraction_form_id,:study_id=>self.study_id)\n iter = 1\n existing_objs.each_with_index do |obj|\n if iter == new_position\n iter += 1\n end\n unless obj.id == self.id\n obj.display_number = iter\n obj.save\n iter += 1\n end\n end\n\n end\n self.display_number = new_position\n self.save\n end",
"title": ""
},
{
"docid": "30ab3d165e3958df85852da028ff070b",
"score": "0.5485336",
"text": "def special_fulladvisory_sort_helper(fulladvisory)\n case fulladvisory\n when /^RHSA/\n \"1000_#{fulladvisory}\"\n when /^RHBA/\n \"2000_#{fulladvisory}\"\n when /^RHEA/\n \"3000_#{fulladvisory}\"\n else\n # should never get here?\n \"4000_#{fulladvisory}\"\n end\n end",
"title": ""
},
{
"docid": "868db32954c23ec1574d780cfcf30b73",
"score": "0.5463823",
"text": "def increment_display_order\n @display_field = @survey_version.display_fields.find(params[:id])\n @display_field.increment_display_order\n\n redirect_to survey_survey_version_display_fields_path, :notice => \"Successfully updated display field order\"\n end",
"title": ""
},
{
"docid": "bc379f2e3def510ef705cbef7d4a6d59",
"score": "0.542255",
"text": "def display_score\n p1.alias + \" -- \" + p1_score.to_s + \":\" + p2_score.to_s + \" -- \" + p2.alias\n end",
"title": ""
},
{
"docid": "f31845a7cd78523cbfe82aa4ffa66f7d",
"score": "0.54037094",
"text": "def get_display_number(study_id, ef_id)\n displays = Arm.where(:study_id=>study_id, :extraction_form_id=>ef_id).collect{|x| x.display_number}\n retVal = 1\n unless displays.empty?\n retVal = displays.max + 1\n end\n return retVal\n\n end",
"title": ""
},
{
"docid": "d88bc80fd7f273b2aa018e2d98af2b4a",
"score": "0.5353335",
"text": "def set_order_of_display!\n if folder && folder.ordered_by_specification? || self.class.ordered_by_specification_always?\n self.order_of_display = \n if max = \n (self.class.parent_attrs.reduce(self.class) do |other, attr|\n if v = send(attr)\n other.where(\"#{attr.to_s} = ?\", v)\n else\n other.where(\"#{attr.to_s} IS NULL\")\n end\n end).maximum('order_of_display')\n max + 1\n else\n 1\n end\n end\n end",
"title": ""
},
{
"docid": "52c4c22c9b26d84b2417034ecd3d603c",
"score": "0.5337575",
"text": "def thesis_identifier_field(presenter)\n if presenter.human_readable_type.downcase == 'thesis'\n presenter.attribute_to_html(:identifier, render_as: :external_link, search_field: 'identifier_tesim', html_dl: true)\n else\n presenter.attribute_to_html(:identifier, render_as: :linked, search_field: 'identifier_tesim', html_dl: true)\n end\n end",
"title": ""
},
{
"docid": "d18b0d98e533a00b30020e7e3cf413a6",
"score": "0.5281348",
"text": "def set_display_order\n new_display_order = params[:display_order].to_i\n old_display_order = @object.display_order\n if new_display_order == old_display_order\n flash[:warning] = \"No changes made.\"\n redirect_to(pages_url)\n return false\n end\n \n # This sets up to renumber the _other_ pages, not the one targeted.\n # if the old number is larger than the new number, then we need to re-number as follows:\n if old_display_order > new_display_order\n start = new_display_order # start at the new number...\n finish = old_display_order - 1 # and go until 1 less than the old number\n else\n start = old_display_order + 1 # start one above the old number, and...\n finish = new_display_order # go until the new number\n end\n \n # collect the siblings which need re-ordering\n counter = 0\n Page.find(:all,\n :conditions => {:parent_id => @object.parent_id, :display_order => (start..finish)},\n :order => 'display_order ASC'\n ).each do |page|\n logger.debug('setting display_order for \"' + page.title + '\"')\n page.display_order = counter + old_display_order\n page.save(false)\n counter += 1\n end\n \n # now set the page we're moving\n @object.display_order = new_display_order\n @object.save(false)\n \n respond_to do |format|\n format.html { redirect_to(pages_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e5d53a5b55a499496098444dccfd2b78",
"score": "0.52795106",
"text": "def sortable_for_solr_doc(solr_doc)\n solr_doc['title_ssort'] = solr_doc['title_ssi']\n solr_doc['creator_sfacet'] = solr_doc['creator_sim']\n solr_doc['contributor_sfacet'] = solr_doc['contributor_sim']\n solr_doc['contributor_advisor_sfacet'] = solr_doc['contributor_advisor_sim']\n end",
"title": ""
},
{
"docid": "c484ccfa92f6e4159cab10c1d0178330",
"score": "0.52633595",
"text": "def show\n #author_string\n author_count = @chapter.chapter_authors.count\n author_map = @chapter.chapter_authors.each_with_index.map{|a, i|\n if i < author_count -1\n if a.first_name.blank?\n \"#{a.last_name} & \"\n else\n \"#{a.last_name}, #{a.first_name.strip.first}. & \"\n end\n else\n if a.first_name.blank?\n \"#{a.last_name}\"\n else\n \"#{a.last_name}, #{a.first_name.strip.first}.\"\n end\n end\n }.compact\n @author_string = author_map.join(\"\")\n \n if (@chapter.page_range_end.to_i - @chapter.page_range_start.to_i) < 100\n top = @chapter.page_range_end\n else\n top = @chapter.page_range_end\n end\n\n @be = \"in #{@chapter.book_edition}, \" unless @chapter.book_edition.blank?\n\n #@first = \"#{@author_string} #{@chapter.publication_year.strftime('%Y')}, '#{@chapter.chapter_title}', in #{@chapter.book_edition},\"\n #@ital = \"#{@chapter.book_name},\"\n #@rest = \"#{@chapter.publisher_name}, #{@chapter.publisher_city}, pp. #{@chapter.page_range_start}-#{top}.\"\n @ref = \"#{@author_string} #{@chapter.publication_year.strftime('%Y')}, '#{@chapter.chapter_title}', #{@be}<i>#{@chapter.book_name}</i>, #{@chapter.publisher_name}, #{@chapter.publisher_city}, pp. #{@chapter.page_range_start}-#{top}.\"\n end",
"title": ""
},
{
"docid": "d5a4bd04d2f1a28068b5e9a490064912",
"score": "0.5258519",
"text": "def edit_display_name\n @student = Student.find(params[:id], :include => :index)\n @titles = Title.find(:all, :order => \"label\").collect {|p| [ p.label, p.id ] }\n @index = @student.index\n @display_name = @index.student.display_name\n @firstname = @index.student.firstname\n @lastname = @index.student.lastname\n @title_before_id = @index.student.title_before_id\n @title_after_id = @index.student.title_after_id\n end",
"title": ""
},
{
"docid": "df7850916ec639961b7ecf4ae71e5d91",
"score": "0.5245563",
"text": "def sort_biblio_key(bib)\n pubclass = pub_class(bib)\n ids = sort_biblio_ids_key(bib)\n title = title_key(bib)\n sortkey3 = author_title_key(pubclass, title, bib)\n num = if ids[:num].nil? then ids[:abbrid]\n else sprintf(\"%09d\", ids[:num].to_i)\n end\n \"#{pubclass} :: #{ids[:type]} :: #{sortkey3} :: #{num} :: \" \\\n \"#{sprintf('%09d', ids[:partid])} :: #{ids[:id]} :: #{title}\"\n end",
"title": ""
},
{
"docid": "4b7898834281ed165912ea46c390c425",
"score": "0.5216734",
"text": "def description id, component, rec\n sections = Sections::sort(rec)\n id+' Sequence:'+component.seqname+\"_#{component.start}:#{component.end} (\"+\n sections.map { |s| \"#{s.first}:#{s.last}\" }.join(', ') +\")\"\n end",
"title": ""
},
{
"docid": "1f65dc83cedde098689d9ea28ecc54ec",
"score": "0.5205631",
"text": "def ordering\n \"coalesce(substr(reference.iso_publication_date,1,4),'9999'), \\\n primary_instance desc, \\\n coalesce(reference.iso_publication_date,'9999'), \\\n author.name, instance.id\"\n end",
"title": ""
},
{
"docid": "a51e1a865c1dab004b03c4ca10fe5e81",
"score": "0.51870084",
"text": "def create\n\t@publication = Publication.new(params[:publication])\n \[email protected]_number = @publication.get_display_number(session[:study_id])\n\[email protected]_id = session[:study_id]\n\n\[email protected]\n\t@secondary_publications = Publication.find(:all, :order => 'display_number ASC', :conditions => {:study_id => session[:study_id]})\t\n \n \n respond_to do |format|\n if @publication.save\n\t\t\tformat.js {\n\t\t\t\trender :update do |page|\n\t\t\t\t\tpage.replace_html 'secondary_publication_table', :partial=>'publications/table'\n\t\t\t\t\tpage['secondary_pub_form'].reset\n\t\t\t\tend\n\t\t\t}\n\t \n #format.html { redirect_to(@publication, :notice => 'Publication was successfully created.') }\n #format.xml { render :xml => @publication, :status => :created, :location => @publication }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @publication.errors, :status => :unprocessable_entity }\n end\n end\n\n end",
"title": ""
},
{
"docid": "c347058cb556cf648500e6dfa7c8fcd6",
"score": "0.51764697",
"text": "def index\n @publication = Publication.find(params[:publication_id])\n @sections = @publication.sections.order(\"sections.position ASC\")\n end",
"title": ""
},
{
"docid": "96b7dfbd123e136a2659bb2035df071a",
"score": "0.51743674",
"text": "def compute_subtitle_count_change(al_st_pair)\n al_st_pair[:to][:subtitle_count] - al_st_pair[:from][:subtitle_count]\n end",
"title": ""
},
{
"docid": "818f415f66707ab7eee76ca3d0624884",
"score": "0.5169484",
"text": "def index\n @publication_subtypes=PublicationSubtype.joins(:publication_type)\n .order(\"publication_types.name ASC\").order(\"name ASC\")\n end",
"title": ""
},
{
"docid": "32b808215cce52b454837f7c311dd64e",
"score": "0.51634604",
"text": "def get_display_number(extraction_form_id)\n\t current_max = QualityRatingField.maximum(\"display_number\",:conditions => [\"extraction_form_id = ?\", extraction_form_id])\n\t if (current_max.nil?)\n\t \tcurrent_max = 0\n\t end\n\t\treturn current_max + 1\n\tend",
"title": ""
},
{
"docid": "db6a83b9efb5b1a780654b7cf529275b",
"score": "0.5146382",
"text": "def display_sorted\nend",
"title": ""
},
{
"docid": "64a4bd7266e5b8f128a14107bdceca28",
"score": "0.51414376",
"text": "def salient_subtitle\n # TODO: handle deletes and inserts!\n if 'merge' == operation_type\n affected_stids.first\n else\n affected_stids.last\n end\n end",
"title": ""
},
{
"docid": "a1c8661038dbc6516ea20e23290a6724",
"score": "0.51384145",
"text": "def show\n @number = @story.id-1\n end",
"title": ""
},
{
"docid": "8aaccf85332e73011a34c90e070ba7b3",
"score": "0.5131294",
"text": "def update\n @primary_publication_number = PrimaryPublicationNumber.find(params[:id])\n\t @primary_publication_number.update_attributes(params[:primary_publication_number])\n end",
"title": ""
},
{
"docid": "0222b4bd2d8b8a11ac72329e83659833",
"score": "0.510335",
"text": "def show\n @publication.page_views += 1 \n @publication.save\n @publication_attachments = @publication.publication_attachments.all\n \n @publications = Publication.all\n end",
"title": ""
},
{
"docid": "e8bc9df6bf4377409a9fc4301b01478d",
"score": "0.50922763",
"text": "def display_title(document)\n if document['subtitle_display']\n return document['title_display'].join(\" : \") << \" : \" << document['subtitle_display'].join(\" : \") \n else\n if document['alt_title_display']\n return document['title_display'].join(\" : \") << \" : \" << document['alt_title_display'].join(\" : \")\n else\n return document['title_display'].join (\" : \")\n end\n end\n end",
"title": ""
},
{
"docid": "af2e924a1bb498a94fe8c5d7b4bc8339",
"score": "0.50760984",
"text": "def detail\n @probation_term = ProbationTerm.find(params[:id])\n @students = Student.find_to_enroll(@probation_term, :sort)\n end",
"title": ""
},
{
"docid": "4fc06cc288c8b580bc763b79beb9cd67",
"score": "0.506015",
"text": "def update_rollno(name, department, section, college, student)\n self.sort_all_section(college)\n department_no = self.find_department_no(name, department, college)\n section_no = self.find_sec_no(name, department, section, college)\n department = self.shrink_department(department)\n roll_no= department + department_no + section + section_no\n student[roll_no]=[name, department, section, department_no.to_i, section_no.to_i]\n return roll_no\n end",
"title": ""
},
{
"docid": "9abef2e8a1a677b2e7df536e5522f84a",
"score": "0.50583184",
"text": "def inc_dec\n @rank_levels = @course.ranking_levels.order('prioriy ASC')\n @rank_lev1 = @course.ranking_levels.find(params[:format])\n end",
"title": ""
},
{
"docid": "0e4feac8d4a4424a2a9b50d879e30704",
"score": "0.50574166",
"text": "def get_provenance_display(rec)\n acc = []\n acc += rec.fields('561')\n .select { |f| ['1', '', ' '].member?(f.indicator1) && [' ', ''].member?(f.indicator2) && f.any?{ |sf| sf.code == 'a' && sf.value !~ /^Athenaeum copy: / } }\n .map do |field|\n value = join_subfields(field, &subfield_in(%w{a}))\n { value: value, link: false } if value\n end.compact\n acc += rec.fields('880')\n .select { |f| has_subfield6_value(f, /^561/) }\n .select { |f| ['1', '', ' '].member?(f.indicator1) && [' ', ''].member?(f.indicator2) }\n .map do |field|\n value = join_subfields(field, &subfield_in(%w{a}))\n { value: value, link: false } if value\n end.compact\n acc += get_650_and_880(rec, 'PRO')\n acc\n end",
"title": ""
},
{
"docid": "4ddbebb4c2cb6b9edb89b7b6cc15a48e",
"score": "0.5049352",
"text": "def formatted_number(node)\n if node['class'] == 'chapter'\n # Tralics numbers figures & equations\n # overall, not per chapter, so we need\n # counters.\n @equation = 0\n @figure = 0\n @table = 0\n @aside = 0\n @cha = article? ? nil : node['id-text']\n elsif node['class'] == 'section'\n @sec = node['id-text']\n label_number(@cha, @sec)\n elsif node['class'] == 'subsection'\n @subsec = node['id-text']\n label_number(@cha, @sec, @subsec)\n elsif node['class'] == 'subsubsection'\n @ssubsec = node['id-text']\n label_number(@cha, @sec, @subsec, @ssubsec)\n elsif node['textype'] == 'equation'\n @equation = ref_number(node, @cha, @equation)\n label_number(@cha, @equation)\n elsif node['class'] == 'codelisting'\n @listing = number_from_id(node['id-text'])\n label_number(@cha, @listing)\n elsif node['class'] == 'aside'\n @aside = @cha.nil? ? number_from_id(node['id-text']) : @aside + 1\n label_number(@cha, @aside)\n elsif node.name == 'table' && node['id-text']\n @table = ref_number(node, @cha, @table)\n label_number(@cha, @table)\n elsif node.name == 'figure'\n @figure = ref_number(node, @cha, @figure)\n label_number(@cha, @figure)\n end\n end",
"title": ""
},
{
"docid": "b2cd93a439090a38473545081c3b6f48",
"score": "0.5044452",
"text": "def donations_sorted_for_display\n storg_id = Organization.find_savetogether_org.id\n donations.sort {|this, that|\n if this.to_user_id == storg_id\n 1\n elsif that.to_user_id == storg_id\n -1\n elsif this.id && that.id\n this.id <=> that.id\n else\n 0\n end\n }\n end",
"title": ""
},
{
"docid": "4d31636a9c05ed289c6d8604a14629f1",
"score": "0.5034227",
"text": "def display_related_items( document )\n\n document_related_fields = []\n related_fields = {\"continues_display\" => \"Item continues\", \"continues_in_part_display\" => \"Item continues\", \"supersedes_display\" => \"Item supersedes\", \"supersedes_in_part_display\" => \"Item supersedes\", \"formed_by_display\" => \"Item formed by\", \"absorbed_display\" => \"Item absorbed by\", \"absorbed_in_part_display\" => \"Item absorbed by\" , \"s\nep_from_display\" => \"Item seperate from\", \"continued_by_display\" => \"Item continued by\", \"continued_in_part_display\" => \"Item continued by\", \"superseded_by_display\" => \"Item superseded by\", \"superseded_part_by_display\" => \"Item superseded by\", \"absorbed_by_display\" => \"Item absorbed by\", \"absorbed_in_part_by_display\" => \"Item absorbed by\", \"split_into_display\" => \"Item split into\", \"merged_with_display\" => \"Item merged with\", \"changed_to_display\" => \"Item changed to\"}\n\n #Add all the matched fields to document_related_fields hash\n related_fields.each_key do |solr_fname|\n if document.has? solr_fname\n document_related_fields << solr_fname if document.has? solr_fname\n end\n end\n\n if document_related_fields.length > 0\n content_tag(:h3, \"Related\") + content_tag(:dl, :class => \"dl-vertical-left dl-invert\") {\n document_related_fields.reduce('') { |c , field|\n c << content_tag(:dt, related_fields.fetch(field), :class => \"blacklight-dt-\" + field) << content_tag(:dd, :class => \"blacklight-dd-\" + field) { link_to(render_index_field_value(:document => document, :field => field), {:controller => \"catalog\", :action => \"index\", :q=> render_index_field_value(:document => document, :field => field).gsub(\" \", \"+\"), :search_field => \"title\"}, :target => \"_blank\" ) }\n \n }.html_safe\n } \n end\n end",
"title": ""
},
{
"docid": "f6a37dee8dabfd55036df47bb21a51a9",
"score": "0.5033994",
"text": "def sort_by_major\n sort_by 'Major'\n end",
"title": ""
},
{
"docid": "d65bf9640b06979665ae1d42457f8dd4",
"score": "0.5030672",
"text": "def display_number\n \"Lesson #{number}\"\n end",
"title": ""
},
{
"docid": "d42618f77626347e51debbc44cefaa5c",
"score": "0.5026788",
"text": "def science\n if @authors.size > 4\n authors = rev_name(@authors[0]) + \" et al.\"\n else\n authors = @authors.collect {|name| rev_name(name)}.join(', ')\n end\n page_from, = @pages.split('-')\n \"#{authors}, #{@journal} #{@volume} #{page_from} (#{@year}).\"\n end",
"title": ""
},
{
"docid": "2d130e2abe931f88200032c15efec30a",
"score": "0.50219417",
"text": "def update_change\n return unless page_number\n return unless story_number\n current_article_id = working_article_id\n page = Page.where(issue_id: issue_id, page_number: page_number).first\n unless page\n puts \"we don't have page!!!\"\n return\n end\n new_article = WorkingArticle.where(page_id: page.id, order: story_number).first\n unless new_article\n puts \"we don't the article with story number!!!\"\n return\n end\n puts \"new_article.id:#{new_article.id}\"\n if new_article && new_article.id != current_article_id\n puts \"change to different article\"\n self.working_article_id = new_article.id\n self.used_in_layout = false\n self.save\n place_image\n # clear image from current_article, if it exits\n end\n if working_article\n working_article.generate_pdf\n working_article.update_page_pdf\n end\n end",
"title": ""
},
{
"docid": "289ab6a4fb4bfa26a56150ff79c75b25",
"score": "0.50107527",
"text": "def sort_by_published_at_or_number\n self.draft? ? 'published_at' : 'number'\n end",
"title": ""
},
{
"docid": "996be7a3c8e4fbafc38f58213bd459df",
"score": "0.49971858",
"text": "def show\n @working_articles = @page.working_articles\n @ad_boxes = @page.ad_boxes\n @page_number_templates = Section.where(ad_type:@page.ad_type, page_number: @page.page_number).order(:column, :story_count).reverse_order\n @page_templates = Section.where(ad_type:@page.ad_type).order(:column, :story_count).reverse_order\n # binding.pry\n unless @page_templates.count > 0\n if @page.page_number != 1\n if @page.page_number == 22 || @page.page_number == 23\n # do not add any\n elsif @page.page_number.even?\n section_template = Section.where(\"section_name like ?\", \"%#{@page.section_name}%\").select{|s| s.ad_type == @page.ad_type && @page.page_number.even?}\n # section_template = Section.where(ad_type:@page.ad_type, section_name: @page.section_name, page_number: 100)\n if section_template.length > 0\n @page_templates += section_template\n else\n @page_templates += Section.where(ad_type:@page.ad_type, page_number: 100) \n end\n else\n section_template = Section.where(\"section_name like ?\", \"%#{@page.section_name}%\").select{|s| s.ad_type == @page.ad_type && @page.page_number.odd?}\n # section_template = Section.where(ad_type:@page.ad_type, section_name: @page.section_name, page_number: 101)\n if section_template.length > 0\n @page_templates += section_template\n else\n @page_templates += Section.where(ad_type:@page.ad_type, page_number: 100) \n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "ccd68e84331f117ff5206660d1b41519",
"score": "0.4994986",
"text": "def set_display_orders\n return if items.nil?\n\n items.each_with_index do |it, idx|\n if it.displayOrder.nil?\n it.displayOrder = idx + 1\n end\n end\n end",
"title": ""
},
{
"docid": "96067d9e9823d82afbb2f3ea8a04d27c",
"score": "0.4994877",
"text": "def recalculate_ordinals\n return unless self.ordinal_changed? || self.id_changed?\n\n self.survey.pages.order(:ordinal).each_with_index do |page, index|\n page.update_column(:ordinal, (index+1)*ORDINAL_INCREMENT)\n end\n end",
"title": ""
},
{
"docid": "34849748f755ad52bb285bd595a359c4",
"score": "0.49845076",
"text": "def display_number\n 'X' + id.to_s\n end",
"title": ""
},
{
"docid": "f6ac2aaf63dbe69618946b14cc329160",
"score": "0.49831054",
"text": "def generate_solr_document\n super.tap do |solr_doc|\n FIELD_ORDERS.each_key do |field|\n #puts \"field=#{field}\"\n #puts \"object.respond_to?(field)=#{object.respond_to?(field)}\"\n solr_doc[\"#{field}_display_ssim\"] = format_names(field) if object.respond_to?(field)\n end\n\n solr_doc[\"work_orcids_tsim\"] = extract_orcids\n end\n end",
"title": ""
},
{
"docid": "b5fe5cadaa4dcb1d0ca7426ef6e7080f",
"score": "0.49790603",
"text": "def count_print_sort\n @count.print_sort\n end",
"title": ""
},
{
"docid": "c06978ae06315545b258a19c37531229",
"score": "0.49786672",
"text": "def show\n @maxnum = Section.maximum(\"ordernum\")\n @comments = Comment.where('(commentable_type = ? and commentable_id = ?)', 'Section', @section.id)\n @new_comment = Comment.new\n\n\n nextord = (@section.ordernum + 1)\n backord = (@section.ordernum - 1)\n @nextid = @section.getidfromord(nextord)\n @backid = @section.getidfromord(backord)\n\n\n end",
"title": ""
},
{
"docid": "82a63ecadc55c40247655f4447637519",
"score": "0.4970597",
"text": "def show\n if @sub.counter == nil\n @sub.update_attribute(:counter, 1)\n else\n @sub.update_attribute(:counter, @sub.counter+1)\n end\n end",
"title": ""
},
{
"docid": "1246a5ebbdab17709563e1a3a6ce4667",
"score": "0.49624887",
"text": "def add_number_to_title(new_number)\n new_title = title + \" (##{new_number})\"\n self.title = new_title\n end",
"title": ""
},
{
"docid": "5c8007e101964be185943bc06d7cf40d",
"score": "0.4959513",
"text": "def show\n # @books = Book.where({id: params[:id]})\n @books = Book.all\n @book = Book.where({id: @contract.book_id })\n @contracts = Contract.where({ book_id: @contract.book_id })\n @this_book = Book.find(@contract.book_id)\n # @contracts = Contract.where({book_id: params[:id]})\n \n @book_id = @contract.book_id\n # @contracts = Contract.where({ book_id: 1 })\n @home = @contracts\n # @books = Book.where({id: @contract.book_id})\n @all_layouts = PageLayout.all.length\n @page_parts = PagePart.where(contract_id: params[:id]).reorder('id ASC')\n @page_parts.length\n # @layouts = PageLayout.where({contract_id: params[:id]}).order('page_area DESC').reorder('id ASC')\n @layouts = PageLayout.where({contract_id: params[:id]}).reorder('id ASC')\n # @hold = []\n # a = 0\n # @page_parts.each do |z|\n # @hold.push([z.name, z.id])\n # puts @hold[a]\n # a = a + 1\n # end\n # @layouts = PageLayout.all\n if(@all_layouts.to_i < params[:id].to_i )\n @needed = 1\n @set_tbl_col = 2 + @needed\n else\n @needed = 0\n @set_tbl_col = 2\n end\n\n\n\n\n\n\n\n\nend",
"title": ""
},
{
"docid": "270eece794757b0c537a7530c63c9c73",
"score": "0.49532464",
"text": "def update_working_article_order_by_position\n sorted_box = working_articles.sort_by{|article| [article.grid_y, article.grid_x]}\n sorted_box.each_with_index do |article, i|\n article.order = i + 1\n article.save\n end\n end",
"title": ""
},
{
"docid": "a7f020175550241fabf905bb33ad8a15",
"score": "0.49357626",
"text": "def show_students\n sort_cohort(cohort_display)\n print_footer\nend",
"title": ""
},
{
"docid": "b82643161b8359b3b4814304a9409fbe",
"score": "0.49347377",
"text": "def show\n Publication.record_timestamps = false\n @publication.score += 1\n @publication.save\n Publication.record_timestamps = true\n @attachment = Attachment.new\n @first_image_attachment = @publication.attachments.select {|a| a.mime_type =~ /image/}.first\n @image_attachments = @publication.attachments.select {|a| a.mime_type =~ /image/} - [@first_image_attachment]\n @not_image_attachments = @publication.attachments.select {|a| a.mime_type !~ /image/}\n @next_publication = @issue.publications.find_by_id(params[:id].to_i + 1)\n @previous_publication = @issue.publications.find_by_id(params[:id].to_i - 1)\n end",
"title": ""
},
{
"docid": "15ad730478e808b2b6b104a084cbed69",
"score": "0.49336767",
"text": "def update_study_site_num(new_num)\n ses_site_number.set new_num\n save_ses.click\n end",
"title": ""
},
{
"docid": "833b01c0ff6a453fb373cb98806ad72d",
"score": "0.49267006",
"text": "def renumber\n # re-numbering seq_number of each entry\n @list.reduce(SEQ_NUM_DIV) do |number, each|\n each.seq_number = number\n number + SEQ_NUM_DIV\n end\n end",
"title": ""
},
{
"docid": "a15ad990ffb51617cce1d18207fe775d",
"score": "0.49256527",
"text": "def sfx_relationship_display(sfx_code)\n sfx_code = sfx_code.to_s\n # Most can simply be #humanized, a couple of over-rides\n @sfx_relationship_display ||= {\n \"TRANSLATION_ENTRY\" => \"Translation\",\n }\n\n display = @sfx_relationship_display[sfx_code]\n display = sfx_code.humanize if display.nil?\n\n return display\n end",
"title": ""
},
{
"docid": "8721eb35c8b9d0fba8e70ec50195fbc5",
"score": "0.49214986",
"text": "def numbered_title\n \"#{track.number}. #{track.decorate.title}\\n\"\n end",
"title": ""
},
{
"docid": "020bb41353fbb2f04ffb7e3a14e376d6",
"score": "0.4921306",
"text": "def output_index_ranking\n check_subselect\n output_ranking(@subselect_ranking)\n end",
"title": ""
},
{
"docid": "7a91fff486bcff6187d3377690b06178",
"score": "0.49201387",
"text": "def destroy\n @publication = Publication.find(params[:id])\n\[email protected]_display_numbers(session[:study_id])\n @publication.destroy\n\n respond_to do |format|\n # The AJAX call in this case is used to refresh the table of secondary publications\n\t\t # The format.js block below is taking care of this.\n \tformat.js { \n \t @secondary_publications = Publication.find(:all, :order => 'display_number ASC', :conditions => {:study_id => session[:study_id]})\n render :update do |page|\n page.replace_html 'secondary_publication_table', :partial=>'publications/table'\n \n # if we're in the js index function it means we're probably coming from a deletion\n # in that case we want to be sure that if they were editing a record at the time of deletion,\n # that we remove it, create a new publication and get rid of the editing form. \n @publication = Publication.new\n page.replace_html 'secondary_publication_entry',:partial=>'publications/form'\n end\n }\n \tformat.html { redirect_to(publications_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "a16493efe46e57f26c12f0c6526516c3",
"score": "0.4917909",
"text": "def show\n @article.number = @article.number+1\n @article.save!\n @category = @article.category\n set_sub_nav\n end",
"title": ""
},
{
"docid": "3c4e58c41491d0f39fe501e043901b75",
"score": "0.49052164",
"text": "def decrement_display_order\n @display_field = @survey_version.display_fields.find(params[:id])\n @display_field.decrement_display_order\n\n redirect_to survey_survey_version_display_fields_path, :notice => \"Successfully updated display field order\"\n end",
"title": ""
},
{
"docid": "3e3801b3d01b0fa325fd9c0de6ffccd7",
"score": "0.49012128",
"text": "def page_number\n newspaper.pages.pluck(:id).index(id) + 1\n end",
"title": ""
},
{
"docid": "9a863a00e7a04c45fc60b9c74525bb3b",
"score": "0.48959398",
"text": "def set_top_priority_item\n @document=SolrDocument.find(params[:id])\n @document.set_top_priority\n flash[:success] = t('revs.messages.set_top_priority')\n end",
"title": ""
},
{
"docid": "ab5dd060afda1b89fbbf4d4ae3ce6a96",
"score": "0.4889165",
"text": "def index\n @publications = Publication.all.order('rank')\n end",
"title": ""
},
{
"docid": "3be529a846eeecab1856887e488c9979",
"score": "0.48891073",
"text": "def add_pub_year_tisim(doc_hash)\n pub_date_sort_val = doc_hash[:pub_year_isi]\n if positive_int? pub_date_sort_val\n doc_hash[:pub_year_tisim] = pub_date_sort_val # for date slider\n end\n doc_hash\n end",
"title": ""
},
{
"docid": "f092b0b922ee14b6dc5be1af26426322",
"score": "0.48784292",
"text": "def edit_publication\n \n edit_publication_routine\n \n add_breadcrumb \"Finalize Article\", 'finalize_article_url'\n set_breadcrumb_for @article, 'edit_publication_path' + \"(#{@article.id})\", \n \"Edit Publication Date\"\n end",
"title": ""
},
{
"docid": "b684a62959084aa7b21138e148faaaf5",
"score": "0.48784047",
"text": "def display_team_scores\n team_scores = {}\n team_details = \"\\nDetails (article name, this year views, projected this year views, last year views, projected ratio, projected points[* if locked for the month])\\n\"\n TEAMS.each do |team_name,articles| \n team_details << \"\\n#{team_name}:\\n\\n\"\n team_score = 0\n articles.each_with_index do |article, index|\n this_year = views_for_article(article,'2015','04')[0].to_f\n this_year_projected = if SCORING_METHOD == \"totals\"\n this_year * MONTH_ADJUSTMENT\n elsif SCORING_METHOD == \"averages\"\n this_year * 31.0 / views_for_article(article,'2015','04')[1]\n end\n last_year = views_for_article(article,'2014','04')[0]\n ratio = (this_year_projected / last_year)\n points = determine_points(ratio) * 2\n team_score += points if index < 8\n team_details << \"#{article}, #{clean_number(this_year)}, #{clean_number(this_year_projected)}, #{clean_number(last_year)}, #{ratio.round(3)}, #{points}#{'*' if this_year / last_year > SCORING.keys.max}\\n\"\n end\n team_details << \"team score: #{team_score}\\n\"\n team_scores[team_name] = team_score\n end\n puts \"Standings:\\n\\n\"\n team_scores.sort_by{|k,v| v + SCORES[k]}.reverse.each_with_index do |k,i| \n puts \"#{i+1}) #{k[0]}: #{k[1]} (#{k[1] + SCORES[k[0]]})\"\n end\n puts team_details\nend",
"title": ""
},
{
"docid": "29f45fd5943ef9398f1e737e1c8710c1",
"score": "0.4876897",
"text": "def index\n @publicity_topics = PublicityTopic.all.sort_by do |topic|\n topic.id\n end\n end",
"title": ""
},
{
"docid": "fcf98e931e0916552caa4a9b5b39e91d",
"score": "0.48759162",
"text": "def link_author_id\n return unless params[:thesis][:authors_attributes]\n\n author = Author.find_by(thesis_id: @thesis.id, user_id: current_user.id)\n params[:thesis][:authors_attributes]['0'][:id] = author.id\n end",
"title": ""
},
{
"docid": "e19423bfa92724b2a17bc8f5308076d8",
"score": "0.4872849",
"text": "def displayid\n Display.all(class_id: 15, subclass_id: 0).sample.displayid\n end",
"title": ""
},
{
"docid": "998ceb1b0b5429d4a135fe110379df25",
"score": "0.48721287",
"text": "def sort\n @assignments = @school.assignments.where(:module => params[:mod_id])\n @assignments.each do |a|\n a.position = params['assignment'].index(a.id.to_s) + 1\n a.save\n end \n respond_to do |format|\n format.js {render 'shared/save_success'}\n end\n end",
"title": ""
},
{
"docid": "ede63cf929a876e0a9a3a28095ecb35f",
"score": "0.48721156",
"text": "def storewide_identification_number\n \"KLNT#{self.order.customer.id}\" +\n \"BEST#{self.order.sequence_number}\" +\n \"FACT#{self.sequence_number}\" +\n \"-#{I18n.l self.updated_at, format: :invoice}\"\n end",
"title": ""
},
{
"docid": "59f9fe39da54f053373dcc50a0fd0598",
"score": "0.48715466",
"text": "def sort\n\t\t@topic = Topic.find(params[:methodParam][0]) \n\t\t@course = @topic.course \n\t\t@topics = @course.topics\n\t\[email protected] do |t|\n\t\t\tt.order_factor = (params[:methodParam]).index(t.id.to_s)\n\t\t\tt.save\n\t\tend\n\t\trender 'show'\n\tend",
"title": ""
},
{
"docid": "134c0687ffc2e831773cd6f94c6f1fb3",
"score": "0.48715216",
"text": "def display_index(groups); end",
"title": ""
},
{
"docid": "134c0687ffc2e831773cd6f94c6f1fb3",
"score": "0.48715216",
"text": "def display_index(groups); end",
"title": ""
},
{
"docid": "e843f124c62035844de1a920e98d3414",
"score": "0.48682892",
"text": "def displayed_number\n return calculated_number unless display_number.present?\n display_number\n end",
"title": ""
},
{
"docid": "ccb793415ca252c1cbff0230c741bd44",
"score": "0.4867232",
"text": "def humanize\n return @display if @display != to_s\n return self.to_s.gsub(/_id$/, \"\").gsub(/_/, \" \").capitalize\n end",
"title": ""
},
{
"docid": "249de8c4ddf1ad73cde6f654026fa1ae",
"score": "0.4866613",
"text": "def reformatCourseNum(edited)\n numbers = /\\d+/.match(edited)\n letters = /[a-zA-Z]+/.match(edited)\n numbers = numbers.to_s.gsub!(/^#{'0'}+/,'')\n return letters.to_s+numbers.to_s\n end",
"title": ""
},
{
"docid": "35cfbb39c9ad7c5f9e7a5f3be5071577",
"score": "0.48552626",
"text": "def section_title(sec = self)\n sectnumlevels = document.attr(:sectnumlevels, 3).to_i\n\n if sec.numbered && !sec.caption && sec.level <= sectnumlevels\n [sec.sectnum, sec.captioned_title].join(' ')\n else\n sec.captioned_title\n end\n end",
"title": ""
},
{
"docid": "35cfbb39c9ad7c5f9e7a5f3be5071577",
"score": "0.48552626",
"text": "def section_title(sec = self)\n sectnumlevels = document.attr(:sectnumlevels, 3).to_i\n\n if sec.numbered && !sec.caption && sec.level <= sectnumlevels\n [sec.sectnum, sec.captioned_title].join(' ')\n else\n sec.captioned_title\n end\n end",
"title": ""
},
{
"docid": "77f7d0e9c0de6dc934c0adc52864a665",
"score": "0.48536813",
"text": "def secondary_sort\n # This function is empty as it's a placeholder for custom code...\n end",
"title": ""
},
{
"docid": "47ac046b07f7cf0fb69b0e857afd5581",
"score": "0.4846123",
"text": "def save_desc_number\n @student = Student.find(params[:student][:id])\n @student.update_attribute(:desc_number, params[:student][:desc_number])\n end",
"title": ""
},
{
"docid": "777fa034e8ea8beabad81f66ee0151ba",
"score": "0.48386317",
"text": "def add_number\n label(\"Number\")\n nums = collection_numbers + herbarium_records + [mo_number]\n @para << nums.join(\" / \")\n @para << \" #{specimen_available}\" if nums.length == 1\n @para.line_break\n end",
"title": ""
},
{
"docid": "46b5b4eac69bac974e2510b4d6ec498b",
"score": "0.48099098",
"text": "def section_title(sec = self)\r\n sectnumlevels = document.attr(:sectnumlevels, DEFAULT_SECTNUMLEVELS).to_i\r\n\r\n if sec.numbered && !sec.caption && sec.level <= sectnumlevels\r\n [sec.sectnum, sec.captioned_title].join(' ')\r\n else\r\n sec.captioned_title\r\n end\r\n end",
"title": ""
},
{
"docid": "6917a5696ee099472d0980c64f45df97",
"score": "0.48054814",
"text": "def citation_for_by_subsequent_designation_of\n \"#{Taxt.ref(reference.id)}: #{pages}\"\n end",
"title": ""
},
{
"docid": "677f4da3a0f576012a312a8d263fbbed",
"score": "0.48034987",
"text": "def show\n @journal = Journal.find(params[:id])\n\n # using sql to grab the total number of annotations for this journal\n sql = \"select annotations.aspect, count(annotations.id) as total_annots from journals, publications, annotations where journals.id = #{@journal.id} and journals.id = publications.journal_id and publications.id = annotations.publication_id group by annotations.aspect\"\n results = ActiveRecord::Base.connection.execute(sql)\n @journal_annotations = Hash.new({'P' => 0,'F' => 0,'C' => 0})\n row_num = 0\n while row_num < results.num_rows\n row = results.fetch_row\n @journal_annotations[row[0]] = row[1]\n row_num += 1\n end\n end",
"title": ""
},
{
"docid": "e6da569eb3c5a2ad9bb54b279403422c",
"score": "0.48005217",
"text": "def show\n @artical.read_number +=1\n @artical.save\n \n @replies = @artical.replies\n \n# @replies = Reply.paginate_by_sql(\"select * from replies where article_id =\"+ @artical.id.to_s() ,page: params[:page])\n end",
"title": ""
},
{
"docid": "fe6319c05bfa9764f3e476e5a19ac227",
"score": "0.47985944",
"text": "def section_title(sec = self)\n sectnumlevels = document.attr(:sectnumlevels, DEFAULT_SECTNUMLEVELS).to_i\n\n if sec.numbered && !sec.caption && sec.level <= sectnumlevels\n [sec.sectnum, sec.captioned_title].join(' ')\n else\n sec.captioned_title\n end\n end",
"title": ""
},
{
"docid": "fe6319c05bfa9764f3e476e5a19ac227",
"score": "0.47985944",
"text": "def section_title(sec = self)\n sectnumlevels = document.attr(:sectnumlevels, DEFAULT_SECTNUMLEVELS).to_i\n\n if sec.numbered && !sec.caption && sec.level <= sectnumlevels\n [sec.sectnum, sec.captioned_title].join(' ')\n else\n sec.captioned_title\n end\n end",
"title": ""
},
{
"docid": "fe6319c05bfa9764f3e476e5a19ac227",
"score": "0.47985944",
"text": "def section_title(sec = self)\n sectnumlevels = document.attr(:sectnumlevels, DEFAULT_SECTNUMLEVELS).to_i\n\n if sec.numbered && !sec.caption && sec.level <= sectnumlevels\n [sec.sectnum, sec.captioned_title].join(' ')\n else\n sec.captioned_title\n end\n end",
"title": ""
},
{
"docid": "fe6319c05bfa9764f3e476e5a19ac227",
"score": "0.47985944",
"text": "def section_title(sec = self)\n sectnumlevels = document.attr(:sectnumlevels, DEFAULT_SECTNUMLEVELS).to_i\n\n if sec.numbered && !sec.caption && sec.level <= sectnumlevels\n [sec.sectnum, sec.captioned_title].join(' ')\n else\n sec.captioned_title\n end\n end",
"title": ""
},
{
"docid": "c2b4e83352287e34c7a530c3ef91f498",
"score": "0.47913763",
"text": "def render_section_number\n return nil unless section_number && !section_number.empty?\n\n # if we are bound to a section, add section number\n span = xelem('span')\n span['class'] = 'maruku_section_number'\n span << xtext(section_number)\n end",
"title": ""
},
{
"docid": "24293c6330a3db7f269efb845bffd8a4",
"score": "0.4790805",
"text": "def joss_id\n if self.is_a_retraction_notice?\n return retracted_paper.joss_id + \"R\"\n else\n id = \"%05d\" % review_issue_id\n return \"#{setting(:abbreviation).downcase}.#{id}\"\n end\n end",
"title": ""
}
] |
7b8d715c3f6cee0341ff53dd56e1feba
|
boolean Allow uploaders to set `provided_modified_at` for uploaded files?
|
[
{
"docid": "689454b064e2dc33122bec0227ee6398",
"score": "0.7101692",
"text": "def use_provided_modified_at\n @attributes[:use_provided_modified_at]\n end",
"title": ""
}
] |
[
{
"docid": "fa028a2457935ecffee9218a1667891f",
"score": "0.7618188",
"text": "def requires_modified_files?\n false\n end",
"title": ""
},
{
"docid": "dcc3f175d1562a67f038c4a4d7fb9914",
"score": "0.6946516",
"text": "def modified?\n file_modification_time.to_s != last_modified.getutc.to_datetime.to_s\n end",
"title": ""
},
{
"docid": "bb0e5e439397167e24c28ea19ee14b28",
"score": "0.6813917",
"text": "def not_modified?; end",
"title": ""
},
{
"docid": "2c87e6604ea7cc18840659cef59f3393",
"score": "0.6792486",
"text": "def uploaded?\n !uploaded_at.nil?\n end",
"title": ""
},
{
"docid": "dd77e58d12ff6a6ce5c2cf4bf8d57b93",
"score": "0.6695108",
"text": "def file_modified; end",
"title": ""
},
{
"docid": "a867dadb40ae0c4b8416d057fc1a9441",
"score": "0.65899545",
"text": "def file_modified\n end",
"title": ""
},
{
"docid": "a91e94b508487bd8ae0dfb4d746ce05b",
"score": "0.64649063",
"text": "def want?\n super || (Date.today - path.mtime.to_date) > OLD_FILE_AGE\n end",
"title": ""
},
{
"docid": "5fc254d0ca61d4dbaa5349839afab505",
"score": "0.64180624",
"text": "def file_modified?(path)\n !status[path] or status[path].type\n end",
"title": ""
},
{
"docid": "83b547ad34fd4da2e64e85946ff6f166",
"score": "0.6385848",
"text": "def not_modified?(asset, env)\n env[\"HTTP_IF_MODIFIED_SINCE\"] == asset.mtime.httpdate\n end",
"title": ""
},
{
"docid": "3c492e7463f2a32f0b67fa52c6b6cf52",
"score": "0.63442993",
"text": "def modified?\r\n\tupdated_at == created_at\r\nend",
"title": ""
},
{
"docid": "085c20689e1530231fcd25eb7b99a4a3",
"score": "0.62186056",
"text": "def same_modification_as?(other_file)\n @file_modified && @file_modified == other_file.file_modified ? true : false\n end",
"title": ""
},
{
"docid": "f805a8889be92c07974b1ac6be34ba12",
"score": "0.6191078",
"text": "def file_modified?(file, opts={})\n file_status(file, opts) == :included\n end",
"title": ""
},
{
"docid": "3164048e88ce8efc2f553e45473b041b",
"score": "0.618253",
"text": "def modified?\n (self.created_at != self.updated_at) || (description != nil) || (structure.modified?)\n end",
"title": ""
},
{
"docid": "492a3c29059e0c20eebf3582069b37ce",
"score": "0.6176738",
"text": "def last_modified_at?(time_value)\n time_value && last_modified == time_value\n end",
"title": ""
},
{
"docid": "2e867a805434404b3917ff4590ca9921",
"score": "0.61724603",
"text": "def immutable_files_set_at\n @attributes[:immutable_files_set_at]\n end",
"title": ""
},
{
"docid": "2e867a805434404b3917ff4590ca9921",
"score": "0.61724603",
"text": "def immutable_files_set_at\n @attributes[:immutable_files_set_at]\n end",
"title": ""
},
{
"docid": "90958fa1296a000410f9f557eba6c95c",
"score": "0.61718524",
"text": "def modified?\n type == :modified\n end",
"title": ""
},
{
"docid": "39b19c33977211dccf0e8bdbc8b2a439",
"score": "0.61657375",
"text": "def modified?\n self.class.mtimes[path] != mtime\n end",
"title": ""
},
{
"docid": "d900e7e1d663e7fe6761b233e966f48f",
"score": "0.6154654",
"text": "def modified?; end",
"title": ""
},
{
"docid": "ee327582196bb87c87c8fe73a4d0d1e8",
"score": "0.61008143",
"text": "def not_modified?(response); end",
"title": ""
},
{
"docid": "e82c68672c5f695c459a269ab1749c59",
"score": "0.6084528",
"text": "def modified?\n created_at != updated_at\n end",
"title": ""
},
{
"docid": "687c23e616ce8f979e8add64514ddef7",
"score": "0.6080472",
"text": "def modified?\n end",
"title": ""
},
{
"docid": "bff17dea8810165a9febf7ac37df443b",
"score": "0.6036357",
"text": "def file_uploaded_on_or_after?(the_date = Date.current)\n return false if uploaded_files.blank?\n\n most_recent_uploaded_file_date = most_recent_uploaded_file.send(most_recent_upload_method)\n # ensure we are comparing Dates (a Timestamp with the same date is considered > a Date)\n most_recent_uploaded_file_date >= the_date.to_date\n end",
"title": ""
},
{
"docid": "bf1268308959657b102de00baad4d0a1",
"score": "0.6009944",
"text": "def modified_since?(modified_since, headers); end",
"title": ""
},
{
"docid": "bf1268308959657b102de00baad4d0a1",
"score": "0.6009944",
"text": "def modified_since?(modified_since, headers); end",
"title": ""
},
{
"docid": "bf1268308959657b102de00baad4d0a1",
"score": "0.6009944",
"text": "def modified_since?(modified_since, headers); end",
"title": ""
},
{
"docid": "4a4b7ba7758219487078fc7dba446fd4",
"score": "0.6005233",
"text": "def last_modified?\n @last_modified.exist?\n end",
"title": ""
},
{
"docid": "fa9f3af0fc901d10a6dba7ab00be6feb",
"score": "0.59845304",
"text": "def modified?\n self.is_modified\n end",
"title": ""
},
{
"docid": "437f4b30038a4e045f0bc244adc42d51",
"score": "0.59820104",
"text": "def modified?\n super || self.class.mtimes.fetch(href, -1) < mtime\n end",
"title": ""
},
{
"docid": "d32867be2f9d84b5449f4f246b6ade0d",
"score": "0.59747165",
"text": "def before_save\n self.modified_date = Time.now\n end",
"title": ""
},
{
"docid": "7c458541bdb624eb147f758d6fd6dd8a",
"score": "0.596615",
"text": "def last_modified\n nil\n end",
"title": ""
},
{
"docid": "ca06a2bb2e62fd85e7c2782d8429bb08",
"score": "0.59655565",
"text": "def file_modified!(file)\n if $file_target_dict[file].class == FileTarget\n $cur_file_time_dict[file] = File.mtime(file)\n elsif $file_target_dict[file].class == PhonyTarget\n $cur_file_time_dict[file] = true\n else\n raise \"file type error #{file.class}\"\n end\nend",
"title": ""
},
{
"docid": "78128d3838516de66275c96d63ca0842",
"score": "0.5964683",
"text": "def uploaded_at\n created_at\n end",
"title": ""
},
{
"docid": "d8383a8bc07beac98a74da92e24db481",
"score": "0.5963549",
"text": "def manageable_files?\n false\n end",
"title": ""
},
{
"docid": "d8383a8bc07beac98a74da92e24db481",
"score": "0.5963549",
"text": "def manageable_files?\n false\n end",
"title": ""
},
{
"docid": "2260ae2e6aad5161a599ad4b4df362c8",
"score": "0.5960169",
"text": "def allows_upload?\n return true\n end",
"title": ""
},
{
"docid": "6d4d76dacd333399750e2e6492fa8baf",
"score": "0.59499896",
"text": "def modified?\n @@mtimes[path] != mtime\n end",
"title": ""
},
{
"docid": "146f76f6fd69674975efc95c54760188",
"score": "0.5940757",
"text": "def need_reload?\n return true if super\n @modified_time.any? do |path, time| \n File.exist?(path) && File.mtime(path) != time \n end\n end",
"title": ""
},
{
"docid": "5fdc5bf70f483eff5aa537680ed834da",
"score": "0.5934377",
"text": "def update_last_modified_at\n self.last_modified_at = DateTime.now\n end",
"title": ""
},
{
"docid": "7069ef361c19ea8765604a9b2641e91e",
"score": "0.5930421",
"text": "def asset_stamp\n false\n end",
"title": ""
},
{
"docid": "119e86742b132ed18976c4d9dd7e1776",
"score": "0.59300584",
"text": "def modified?\n @modified\n end",
"title": ""
},
{
"docid": "119e86742b132ed18976c4d9dd7e1776",
"score": "0.59300584",
"text": "def modified?\n @modified\n end",
"title": ""
},
{
"docid": "19290869119c3538a15357c637dfc217",
"score": "0.59201324",
"text": "def last_modified=(time)\n end",
"title": ""
},
{
"docid": "af492426caaa62e17e201586a80a0068",
"score": "0.5915014",
"text": "def dirty?\n return true unless test(?e, destination)\n @mtime > ::File.mtime(destination)\n end",
"title": ""
},
{
"docid": "706ffc8933b8786e8a4d25bdee200b71",
"score": "0.5910692",
"text": "def last_modified_at\n return nil unless self.class.timestamps_enabled?\n updated_at || created_at\n end",
"title": ""
},
{
"docid": "5c1bbac11a2a7a6001411c793eaa4661",
"score": "0.5908683",
"text": "def modified_date\n nil\n end",
"title": ""
},
{
"docid": "717f078ab2426866dd635a72c72ba860",
"score": "0.5908467",
"text": "def need_update?(filename)\n\told = File.mtime(filename)\n\tage = DateTime.now - (DateTime.parse old.to_s)\n\treturn age >= 1\nend",
"title": ""
},
{
"docid": "6fe45ac709cfc0033078d7d275a0acc5",
"score": "0.58940464",
"text": "def last_modified; end",
"title": ""
},
{
"docid": "6fe45ac709cfc0033078d7d275a0acc5",
"score": "0.58940464",
"text": "def last_modified; end",
"title": ""
},
{
"docid": "6fe45ac709cfc0033078d7d275a0acc5",
"score": "0.58940464",
"text": "def last_modified; end",
"title": ""
},
{
"docid": "6fe45ac709cfc0033078d7d275a0acc5",
"score": "0.58940464",
"text": "def last_modified; end",
"title": ""
},
{
"docid": "6fe45ac709cfc0033078d7d275a0acc5",
"score": "0.58940464",
"text": "def last_modified; end",
"title": ""
},
{
"docid": "5cf09a3b95f81b28864d6ab17ab19dd5",
"score": "0.58898807",
"text": "def file_uploaded_during_right_time?\n return false if uploaded_files.blank?\n\n # The STATE_ constants below are defined by the AASM gem based on the states defined\n case membership_status\n when STATE_CURRENT_MEMBER\n file_uploaded_during_this_membership_term?\n when STATE_IN_GRACE_PERIOD, STATE_FORMER_MEMBER\n file_uploaded_on_or_after?(membership_last_day + 1.day)\n when STATE_NOT_A_MEMBER\n !uploaded_files.blank?\n else\n false\n end\n end",
"title": ""
},
{
"docid": "5a45b2db34778e5c11d83999c7bb58f4",
"score": "0.58867675",
"text": "def validateable?\n headers.key?('Last-Modified') || headers.key?('ETag')\n end",
"title": ""
},
{
"docid": "fc1d2aacafa46dd0d167ce5ef9672201",
"score": "0.58817923",
"text": "def not_modified!; end",
"title": ""
},
{
"docid": "e67cda5e698dacaf0d6a94469f039bfb",
"score": "0.5874751",
"text": "def file_edited?\n @file_edited\n end",
"title": ""
},
{
"docid": "8546ce3a4780986d68930aad70623664",
"score": "0.5865612",
"text": "def allow_manual_timestamp_update?\n @allow_manual_timestamp_update\n end",
"title": ""
},
{
"docid": "12b27cec4211c364b05543ca2fee872d",
"score": "0.5864822",
"text": "def set_avatar_uploaded_at(file=nil)\n if model.respond_to?(:avatar_uploaded_at)\n t = DateTime.now\n model.set(:avatar_uploaded_at,t)\n model.set(:updated_at,t)\n end\n end",
"title": ""
},
{
"docid": "459f10458de93d137dce51f06efba4f4",
"score": "0.5856887",
"text": "def changed? file\n file.mtime > (@mtimes[file.path] ||= file.mtime)\n end",
"title": ""
},
{
"docid": "8505938c2de316430b638914c221d270",
"score": "0.5855057",
"text": "def modified?\n @modified == true\n end",
"title": ""
},
{
"docid": "cc971ef4fdcf9d2cf187dbca7467b73f",
"score": "0.5844082",
"text": "def set_posted_at\n if self.is_public? && self.is_public_changed?\n # becoming public\n self.posted_at = Time.now\n\n elsif !self.is_public? && self.is_public_changed?\n # loosing public\n self.posted_at = nil\n\n end\n\n return true\n end",
"title": ""
},
{
"docid": "cc971ef4fdcf9d2cf187dbca7467b73f",
"score": "0.5844082",
"text": "def set_posted_at\n if self.is_public? && self.is_public_changed?\n # becoming public\n self.posted_at = Time.now\n\n elsif !self.is_public? && self.is_public_changed?\n # loosing public\n self.posted_at = nil\n\n end\n\n return true\n end",
"title": ""
},
{
"docid": "4b6d412a0a2e788333eab9762afd9785",
"score": "0.5843658",
"text": "def changed?\n File.mtime(@file).to_i != @mtime rescue true\n end",
"title": ""
},
{
"docid": "37c314297c5a621e14a12cc5a2c67dae",
"score": "0.5841183",
"text": "def modified?\n resources_loaded? && (@dirty || @modified_time.nil? || (@path.mtime > @modified_time))\n end",
"title": ""
},
{
"docid": "318d2832cab7739b564e7086078e19c3",
"score": "0.5824732",
"text": "def file_modified_since?( filename, timestamp )\r\n modified_timestamp = File.mtime( filename )\r\n bname = File.basename(filename)\r\n if timestamp[bname] != nil && timestamp[bname] == modified_timestamp\r\n return false\r\n else\r\n timestamp[bname] = modified_timestamp\r\n return true\r\n end\r\nend",
"title": ""
},
{
"docid": "9de151005ac7f9956cec52d3461a47dc",
"score": "0.58228004",
"text": "def modified_existing?\n false\n end",
"title": ""
},
{
"docid": "9de151005ac7f9956cec52d3461a47dc",
"score": "0.58228004",
"text": "def modified_existing?\n false\n end",
"title": ""
},
{
"docid": "9de151005ac7f9956cec52d3461a47dc",
"score": "0.58228004",
"text": "def modified_existing?\n false\n end",
"title": ""
},
{
"docid": "27a2b56616aebf7ec5c56ede78f72de4",
"score": "0.5821265",
"text": "def needs_update?(from, to) #:doc:\n File.exists?(to) ? File.mtime(from) > File.mtime(to) : true\n end",
"title": ""
},
{
"docid": "103b93212d588dfc3d6cbc6cb07e89be",
"score": "0.5814619",
"text": "def needs_to_be_updated\n remote_modification = self.get_last_modified\n if remote_modification == 'resource not available' \n return false\n else\n self.jar_last_modified.blank? || (self.jar_last_modified < self.get_last_modified) || ! File.exists?(self.path)\n end\n end",
"title": ""
},
{
"docid": "2def444895062386d7c0f717afbd95df",
"score": "0.58112955",
"text": "def modified_time\n mtime\n end",
"title": ""
},
{
"docid": "94d6bf905b6b1363785a3022d9550204",
"score": "0.5809069",
"text": "def has_last_modified?\n @last_modified.exist?\n end",
"title": ""
},
{
"docid": "9aa8c06b968e00306bfd15eb03d27924",
"score": "0.58052194",
"text": "def modified?(doc)\n return true if metadata[doc.path]&.[](:forced)\n return true unless File.exist?(site.in_dest_dir(doc.path))\n modified, hash = file_mtime_of(doc.path), metadata[doc.path]\n return modified > hash[:last_modified] if hash && !hash[:dynamic] && hash[:seen_before]\n return hash[:seen_before] = true if hash && !hash[:seen_before]\n return dependencies_modified?(hash) if hash\n add(doc.path).update(seen_before: true)\n\n true\n end",
"title": ""
},
{
"docid": "510c3376ac17b5e9c136b1e46a5e1d2a",
"score": "0.5780081",
"text": "def change\n updated = false\n if work.date_uploaded != nil && work.date_uploaded.is_a?(String)\n work.date_uploaded = DateTime.parse(work.date_uploaded)\n updated = true\n end\n if work.date_modified != nil && work.date_modified.is_a?(String)\n work.date_modified = DateTime.parse(work.date_modified)\n updated = true\n end\n return updated\n end",
"title": ""
},
{
"docid": "ee7fed2daeee37e3b790509d5b7b3e97",
"score": "0.5779165",
"text": "def mtime=(value); end",
"title": ""
},
{
"docid": "09009aedffab24beb4750260555cdc56",
"score": "0.57601726",
"text": "def validateable?\n header?('Last-Modified') || header?('Etag')\n end",
"title": ""
},
{
"docid": "cf92f45058175739a9d61bbdf365c597",
"score": "0.5757036",
"text": "def create_timestamp_overwrite?\n @create_timestamp_overwrite\n end",
"title": ""
},
{
"docid": "31adf4dbbb6336abf6bf347235f57838",
"score": "0.57564",
"text": "def not_modified?\n @payload[:status] == 304\n end",
"title": ""
},
{
"docid": "d04c9e1a1243fcdaca56e0c9635267da",
"score": "0.5750153",
"text": "def edited?\n created_at != updated_at\n end",
"title": ""
},
{
"docid": "7e3759b26c84ec0c8680883dad77fe29",
"score": "0.5749947",
"text": "def update_modified_at\n self.modified_at = Time.now.utc\n end",
"title": ""
},
{
"docid": "d9494d6c2ead3de901ab9791b752707c",
"score": "0.5749393",
"text": "def overwritten?\n\t\t@overwrite > Time.now rescue false\n\tend",
"title": ""
},
{
"docid": "3d7eee0f906cf2b3a43705357ba95d8e",
"score": "0.57376707",
"text": "def file_modified?(file, opts={})\n raise NotImplementedError.new(\"file_modified?() must be implemented by subclasses of AbstractLocalRepository.\")\n end",
"title": ""
},
{
"docid": "3239dd303a73cf8a7a84e33bf72a2421",
"score": "0.5736237",
"text": "def use_event_dates_in_filenames?\n @config_info['Use Event Dates in Filenames']\n end",
"title": ""
},
{
"docid": "14d1bb0017f5b3eee4f4e42070d17a09",
"score": "0.5733314",
"text": "def last_modified\n return unless file_set && file_set.original_file\n if @imaging_uid_update\n file_set.parent.date_modified.iso8601\n else\n file_set.original_file.fcrepo_modified.first.iso8601\n end\n end",
"title": ""
},
{
"docid": "2c8829533df278d5472377e7bec26a6d",
"score": "0.57326233",
"text": "def accepts_file_upload?\n true\n end",
"title": ""
},
{
"docid": "2c8829533df278d5472377e7bec26a6d",
"score": "0.57323796",
"text": "def accepts_file_upload?\n true\n end",
"title": ""
},
{
"docid": "2c8829533df278d5472377e7bec26a6d",
"score": "0.57323796",
"text": "def accepts_file_upload?\n true\n end",
"title": ""
},
{
"docid": "2c8829533df278d5472377e7bec26a6d",
"score": "0.57323796",
"text": "def accepts_file_upload?\n true\n end",
"title": ""
},
{
"docid": "2c8829533df278d5472377e7bec26a6d",
"score": "0.57323796",
"text": "def accepts_file_upload?\n true\n end",
"title": ""
},
{
"docid": "24dac2b82bcb258f842faccdd07b334c",
"score": "0.57279724",
"text": "def not_modified?(response)\n last_modified = @request.env['HTTP_IF_MODIFIED_SINCE']\n if etags = @request.env['HTTP_IF_NONE_MATCH']\n etags = etags.split(/\\s*,\\s*/)\n (etags.include?(response.etag) || etags.include?('*')) && (!last_modified || response.last_modified == last_modified)\n elsif last_modified\n response.last_modified == last_modified\n end\n end",
"title": ""
},
{
"docid": "469c166aa48e7cfdeccd3cdde014fb19",
"score": "0.572775",
"text": "def modified_date\n nil\n end",
"title": ""
},
{
"docid": "ea6e20af7275dda1f490814ce655e23d",
"score": "0.5724807",
"text": "def is_uploaded\n state == 'uploaded'\n end",
"title": ""
},
{
"docid": "55eb84f49e4e6a6e8bded432848104ff",
"score": "0.57190883",
"text": "def set_LastModified(value)\n set_input(\"LastModified\", value)\n end",
"title": ""
},
{
"docid": "8a577741e4c94d3db398872404baa471",
"score": "0.57128954",
"text": "def modified?\n @response.modified?\n end",
"title": ""
},
{
"docid": "69ca7bb34a582ba58597e852db86a8b0",
"score": "0.57087195",
"text": "def file_modified?(file)\n if $file_target_dict[file].class == FileTarget\n # 文件真正被修改:文件之前不存在,或文件现在已经不存在,或时间戳修改\n real_modified = $file_time_dict[file] == nil || !File.exist?(file) || ($file_time_dict[file] != File.mtime(file))\n # 文件依赖被修改\n return real_modified || $file_target_dict[file].depend_modified?\n elsif $file_target_dict[file].class == PhonyTarget\n # 假目标被修改:依赖被修改或之前不存在\n return $file_time_dict[file] == nil || $file_target_dict[file].depend_modified?\n elsif $file_target_dict[file] == nil\n # 对无目标的文件,判断其存在,存在则直接使用即可\n if !File.exist?(file)\n raise \"file not found #{file}\"\n else\n $cur_file_time_dict[file] = File.mtime(file)\n return $file_time_dict[file] == nil || ($file_time_dict[file] != File.mtime(file))\n end \n else\n raise \"file type error #{$file_target_dict[file].class}\"\n end\nend",
"title": ""
},
{
"docid": "cb8634101d8600b6d1c2dce60432819c",
"score": "0.5706791",
"text": "def last_modified\n end",
"title": ""
},
{
"docid": "cb8634101d8600b6d1c2dce60432819c",
"score": "0.5706791",
"text": "def last_modified\n end",
"title": ""
},
{
"docid": "0e63038dba47aaf94ced9b9ee7c03249",
"score": "0.570518",
"text": "def collectible_file=(obj)\n super(obj)\n self.collectible_file_has_just_been_uploaded = true\n end",
"title": ""
}
] |
1cbed9b17cd8c827ac398e94d5e0652f
|
GET /store/manager/reviews/new GET /store/manager/reviews/new.json
|
[
{
"docid": "0a5c09bd71230344d4ff3331fd4f1a04",
"score": "0.7786833",
"text": "def new\n @store_manager_review = Store::Manager::Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store_manager_review }\n end\n end",
"title": ""
}
] |
[
{
"docid": "4e332acab47989be36b61489590e1f9a",
"score": "0.81043017",
"text": "def new\n @review = @reviewable.reviews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end",
"title": ""
},
{
"docid": "fbd148ef75a9983941baac78c1507d5d",
"score": "0.79692847",
"text": "def new\n @review=Recipe.find(params[:id]).reviews.new()\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end",
"title": ""
},
{
"docid": "af1aedfd486cb21de3e6fa5f047a639e",
"score": "0.779191",
"text": "def new\n @new_review = NewReview.new\n respond_with(@new_review)\n end",
"title": ""
},
{
"docid": "01b65c0fb8ae2c9c41715579ac8ccd30",
"score": "0.76756865",
"text": "def new\n @review = Review.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end",
"title": ""
},
{
"docid": "01b65c0fb8ae2c9c41715579ac8ccd30",
"score": "0.76756865",
"text": "def new\n @review = Review.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end",
"title": ""
},
{
"docid": "c4879e1b4efc711d5e5574665c6df9c3",
"score": "0.7674515",
"text": "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end",
"title": ""
},
{
"docid": "c4879e1b4efc711d5e5574665c6df9c3",
"score": "0.7674515",
"text": "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end",
"title": ""
},
{
"docid": "c4879e1b4efc711d5e5574665c6df9c3",
"score": "0.7674515",
"text": "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end",
"title": ""
},
{
"docid": "c4879e1b4efc711d5e5574665c6df9c3",
"score": "0.7674515",
"text": "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end",
"title": ""
},
{
"docid": "c4879e1b4efc711d5e5574665c6df9c3",
"score": "0.7674515",
"text": "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end",
"title": ""
},
{
"docid": "c4879e1b4efc711d5e5574665c6df9c3",
"score": "0.7674515",
"text": "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end",
"title": ""
},
{
"docid": "c4879e1b4efc711d5e5574665c6df9c3",
"score": "0.7674515",
"text": "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end",
"title": ""
},
{
"docid": "c4879e1b4efc711d5e5574665c6df9c3",
"score": "0.7674515",
"text": "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end",
"title": ""
},
{
"docid": "3004622b994fa1e8a246c066b6416289",
"score": "0.7472176",
"text": "def new\n @store_manager_products_review = Store::Manager::Products::Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store_manager_products_review }\n end\n end",
"title": ""
},
{
"docid": "95d45dbd31833b918f188771cca72e9d",
"score": "0.742157",
"text": "def create\n @store_manager_review = Store::Manager::Review.new(params[:store_manager_review])\n\n respond_to do |format|\n if @store_manager_review.save\n format.html { redirect_to @store_manager_review, notice: 'Review was successfully created.' }\n format.json { render json: @store_manager_review, status: :created, location: @store_manager_review }\n else\n format.html { render action: \"new\" }\n format.json { render json: @store_manager_review.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "62472ed7387e0bf4aebfc6baf81bc5c3",
"score": "0.72840387",
"text": "def new\n @shelf = Shelf.find(params[:shelf_id])\n @book = Book.find(params[:book_id])\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end",
"title": ""
},
{
"docid": "32d5606698a99334ebad787f1e7041b0",
"score": "0.7276773",
"text": "def new\n @review = Review.new(:organization_id => params[:o_id])\n @review.user = current_user\n \n authorize! :new, @review\n\n @title = new_action_title\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end",
"title": ""
},
{
"docid": "fb9ed90522884a3baa7dc2e65a4a56d3",
"score": "0.7262109",
"text": "def new\n @review = Review.new\n respond_with(@review)\n end",
"title": ""
},
{
"docid": "c787beba1147c19c1c8dad0480e2df61",
"score": "0.7247829",
"text": "def create\n render json: Review.create(review_params)\n end",
"title": ""
},
{
"docid": "628fb475ef691e1c7b17c9cda86a23a1",
"score": "0.7205576",
"text": "def new\n @product = Product.find(params[:product_id])\n @review = @product.reviews.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end",
"title": ""
},
{
"docid": "19246d8d3ee7dc6bc050136b12137603",
"score": "0.7193065",
"text": "def new\n\t @review = Review.new\n\t @shopList = Shop.find(:all) #for the dropdown menu, we might need to filter or sort this later. \n\t\n \trespond_to do |format|\n \t\tformat.html # new.html.erb\n \t\tformat.xml { render :xml => @review }\n \tend\n end",
"title": ""
},
{
"docid": "b9b6c4a115c7988fe1574861dafe21e1",
"score": "0.7188249",
"text": "def create\n @review = Review.create!(review_params)\n\n render json: @review\n end",
"title": ""
},
{
"docid": "e11826dfefdba03eef19db0553c32871",
"score": "0.7173718",
"text": "def new\n\t\tif !authenticate_user!(\"You must be logged in to write a review. Login now or sign up!\", true) \n\t\t\treturn \n\t\tend\t\t\n\t\t#@store_item_review = @store_item.store_item_reviews.build\t\t\n\t\trender layout: false\t\t\n\tend",
"title": ""
},
{
"docid": "f7b528ff5b424c405b44f8c363e8abb5",
"score": "0.716235",
"text": "def create\n @stores_review = Stores::Review.new(stores_review_params)\n\n respond_to do |format|\n if @stores_review.save\n format.html { redirect_to @stores_review, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @stores_review }\n else\n format.html { render :new }\n format.json { render json: @stores_review.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4547888b39b7a97c18ee2e032831927a",
"score": "0.716148",
"text": "def create\n @review = current_user.reviews.new(review_params)\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render action: 'show', status: :created, location: @review }\n else\n format.html { render action: 'new' }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bb6e3041a02c5f4f7c36510785dfe34f",
"score": "0.71567947",
"text": "def new\n\t\t@review = Review.new\n\t\t@book = Book.find params[:book_id]\n\t\t@url = book_reviews_path(@book) \n\tend",
"title": ""
},
{
"docid": "2578dd23767e44c72e78044f7fb6e77d",
"score": "0.7153956",
"text": "def new\n # @review = Review.new\n @reviewable = find_reviewable\n @review = @reviewable.review.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @review }\n end\n end",
"title": ""
},
{
"docid": "02436522301c5a322c1a34248c4f890b",
"score": "0.71504384",
"text": "def new\n @subject = Subject.find(params[:subject_id])\n @review = @subject.reviews.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @review }\n end\n end",
"title": ""
},
{
"docid": "cecc30041c04d42eb4c69312c395d1a3",
"score": "0.7146359",
"text": "def create\n\n @review = Review.new(params[:review])\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to '/', notice: 'Review was successfully created.' }\n format.json { render json: @review, status: :created, location: @review }\n else\n format.html { render action: \"new\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "80f2dbc1cf0dbc0a49c5a9c9621442d6",
"score": "0.71237457",
"text": "def create\n _review = review_params\n @review = Review.new(_review)\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render json: @review, status: :created, location: @review }\n else\n format.html { render action: \"new\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "074ff5022d889511c2f36b7b04a365a1",
"score": "0.7103121",
"text": "def create\n @review = Review.new(params[:review])\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render json: @review, status: :created, location: @review }\n else\n format.html { render action: \"new\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "074ff5022d889511c2f36b7b04a365a1",
"score": "0.7102475",
"text": "def create\n @review = Review.new(params[:review])\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render json: @review, status: :created, location: @review }\n else\n format.html { render action: \"new\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "074ff5022d889511c2f36b7b04a365a1",
"score": "0.7102475",
"text": "def create\n @review = Review.new(params[:review])\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render json: @review, status: :created, location: @review }\n else\n format.html { render action: \"new\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "074ff5022d889511c2f36b7b04a365a1",
"score": "0.7102475",
"text": "def create\n @review = Review.new(params[:review])\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render json: @review, status: :created, location: @review }\n else\n format.html { render action: \"new\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "dd1f8e6bd817eb29a9fa20688980bdbb",
"score": "0.70953405",
"text": "def create\n @review = Review.new(params[:review])\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render json: @review, status: :created, location: @review }\n else\n format.html { render action: \"new\" }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "620d08c726a333d1589079cf6cbd32e1",
"score": "0.70852655",
"text": "def create\n @store_manager_products_review = Store::Manager::Products::Review.new(params[:store_manager_products_review])\n\n respond_to do |format|\n if @store_manager_products_review.save\n format.html { redirect_to @store_manager_products_review, notice: 'Review was successfully created.' }\n format.json { render json: @store_manager_products_review, status: :created, location: @store_manager_products_review }\n else\n format.html { render action: \"new\" }\n format.json { render json: @store_manager_products_review.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8efc0fbf5b99d3ed070fc5f9e06c19f3",
"score": "0.708492",
"text": "def create\n @review = @reviews.build(review_params)\n\n respond_to do |format|\n if @review.save\n format.json { render :index }\n else\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "17d19038f75ae7b6903847e9cd145a2e",
"score": "0.7079586",
"text": "def create\n @review = Review.new(review_params)\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render json: @review }\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b527e426d639495462f10ba4bee842fc",
"score": "0.7077351",
"text": "def new\n @record_review = RecordReview.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @record_review }\n end\n end",
"title": ""
},
{
"docid": "1c345bcaa1636d34ea5a077d87826bc1",
"score": "0.7074516",
"text": "def new\n @review = Review.new\n @title = \"Stressometer | New Review\"\n @classname = params[:classname]\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end",
"title": ""
},
{
"docid": "9c50d3bb02b2a0d7cbe0ca6caf0a7eba",
"score": "0.706817",
"text": "def create\n @review = current_user.reviews.new(review_params)\n\n if @review.save\n render :show\n else\n render json: @review.errors.full_messages\n end\n end",
"title": ""
},
{
"docid": "228aa251bcc7dab112347af181a2b26b",
"score": "0.7065367",
"text": "def new\n\t\t@review = Review.new\n\tend",
"title": ""
},
{
"docid": "b0f616e314816873a56c28771d5794cb",
"score": "0.70599806",
"text": "def new\n @product = Spree::Product.where(:permalink => params[:product_id]).first\n @review = @product.reviews.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end",
"title": ""
},
{
"docid": "6494b587180d60c18cb5d1f99e1d48e6",
"score": "0.7059486",
"text": "def new\n reviewer = current_user\n reviewee = @user\n reviews = Review.users_reviews(reviewee, reviewer)\n if reviews.count > 0\n @review = reviews[0]\n render :edit\n return\n else\n @review = Review.new\n end\n end",
"title": ""
},
{
"docid": "2ac93fcceba9e1f2a9d9c7b7869a1d10",
"score": "0.70496106",
"text": "def create\n @review = Review.new\n @review.owner = current_user\n current_user.reviews << @review\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "49418dc1669146ecfa858901c908c940",
"score": "0.703749",
"text": "def new\n @application_review = ApplicationReview.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application_review }\n end\n end",
"title": ""
},
{
"docid": "d30eb3aa52bea2842c068fb390c8e2e3",
"score": "0.7021166",
"text": "def new\n \t@review = Review.new\n end",
"title": ""
},
{
"docid": "67b3021c49d526fd85de6750e48738d2",
"score": "0.7015123",
"text": "def create\n @review = Review.new(review_params)\n respond_to do |format|\n if @review.save\n format.html { redirect_to reviews_url, notice: \"Review was successfully created.\" }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9b1673a37d721515f622214ca35d7406",
"score": "0.7000296",
"text": "def create\n \n @review = Review.new(review_params)\n \n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f80ccb0f0d4b119f1c3e85a68f78ec82",
"score": "0.6998193",
"text": "def new\n #also sending a restaurant object via set_before action\n @review = Review.new\n end",
"title": ""
},
{
"docid": "0ac930c15739e98f170a2dfe0c142e04",
"score": "0.69973034",
"text": "def new\n @review = @drug.reviews.new\n @user=User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end",
"title": ""
},
{
"docid": "0ac930c15739e98f170a2dfe0c142e04",
"score": "0.69973034",
"text": "def new\n @review = @drug.reviews.new\n @user=User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end",
"title": ""
},
{
"docid": "c1a04b014a87f14bf5a6402031d51f61",
"score": "0.69927025",
"text": "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @review }\n end\n end",
"title": ""
},
{
"docid": "c1a04b014a87f14bf5a6402031d51f61",
"score": "0.69927025",
"text": "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @review }\n end\n end",
"title": ""
},
{
"docid": "c1a04b014a87f14bf5a6402031d51f61",
"score": "0.69927025",
"text": "def new\n @review = Review.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @review }\n end\n end",
"title": ""
},
{
"docid": "2f4cd1ca525579f4af37bdcc8eb1c265",
"score": "0.6986829",
"text": "def create\n @review = Review.new(review_params)\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2f4cd1ca525579f4af37bdcc8eb1c265",
"score": "0.6986829",
"text": "def create\n @review = Review.new(review_params)\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2f4cd1ca525579f4af37bdcc8eb1c265",
"score": "0.6986829",
"text": "def create\n @review = Review.new(review_params)\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c9311779b76a755ca08d2f8e0263fdff",
"score": "0.6984778",
"text": "def create\n @review = Review.new(review_params)\n\n if @review.save\n render :show, status: :created, location: @review\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "923ff715f95db83aa8dc2aaa86dcbfc2",
"score": "0.69846755",
"text": "def create\n #@provider_review = ProviderReview.new(provider_review_params)\n @provider = Provider.find(params[:provider_id])\n @provider_review = @provider.provider_reviews.create(provider_review_params)\n\n respond_to do |format|\n if @provider_review.save\n format.html { redirect_to @provider, notice: 'Provider review was successfully created.' }\n format.json { render :show, status: :created, location: @provider_review }\n else\n format.html { render :new }\n format.json { render json: @provider_review.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a7f2b48b270ca724c22137e57d17cb13",
"score": "0.69830537",
"text": "def new\n\t\tif params[:book_id]\n\t\t\t@book = Book.find(params[:book_id])\n\t\t\t@review = @book.reviews.build(params[:review])\n\t\tend\n\n\t\tif params[:website_id]\n \t@website = Website.find(params[:website_id])\n\t\t\t@review = @website.reviews.build(params[:review])\n\t\tend\n end",
"title": ""
},
{
"docid": "7d2182b3d7f5311a2b2279e902e72d87",
"score": "0.69821984",
"text": "def new\n @restaurant = Restaurant.find(params[:restaurant_id])\n @review = @restaurant.reviews.build\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"title": ""
},
{
"docid": "14950a45b4a0563f4237753a4758621f",
"score": "0.6977528",
"text": "def create\n @review = Review.new(review_params)\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "db173d122a217eea18d22ef0fb8b3ed1",
"score": "0.6946796",
"text": "def new\n @comment = Review.new\n respond_with(@comment)\n end",
"title": ""
},
{
"docid": "41a259abb472d4fa45a7ca2d3409bc3d",
"score": "0.6931042",
"text": "def new\n @psa_review = PsaReview.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @psa_review }\n end\n end",
"title": ""
},
{
"docid": "a4e10ffc1c0c71cbb5678922b35e527f",
"score": "0.69307214",
"text": "def new\n @review_content = ReviewContent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review_content }\n end\n end",
"title": ""
},
{
"docid": "41c272ce92e8b5d6805f6759e17734b8",
"score": "0.69290906",
"text": "def new\n @review_result = ReviewResult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review_result }\n end\n end",
"title": ""
},
{
"docid": "1a4359f504474b3d86c7a811f130e88c",
"score": "0.69192576",
"text": "def new\n @review = Review.new\n end",
"title": ""
},
{
"docid": "1a4359f504474b3d86c7a811f130e88c",
"score": "0.69192576",
"text": "def new\n @review = Review.new\n end",
"title": ""
},
{
"docid": "1a4359f504474b3d86c7a811f130e88c",
"score": "0.69192576",
"text": "def new\n @review = Review.new\n end",
"title": ""
},
{
"docid": "1a4359f504474b3d86c7a811f130e88c",
"score": "0.69192576",
"text": "def new\n @review = Review.new\n end",
"title": ""
},
{
"docid": "1a4359f504474b3d86c7a811f130e88c",
"score": "0.69192576",
"text": "def new\n @review = Review.new\n end",
"title": ""
},
{
"docid": "1a4359f504474b3d86c7a811f130e88c",
"score": "0.69192576",
"text": "def new\n @review = Review.new\n end",
"title": ""
},
{
"docid": "1a4359f504474b3d86c7a811f130e88c",
"score": "0.69192576",
"text": "def new\n @review = Review.new\n end",
"title": ""
},
{
"docid": "1a4359f504474b3d86c7a811f130e88c",
"score": "0.6918247",
"text": "def new\n @review = Review.new\n end",
"title": ""
},
{
"docid": "41d7bdffba535649678fc2cfbfc27ece",
"score": "0.69059616",
"text": "def create\n @review = Review.new(review_params)\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @reviewable, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @review }\n else\n format.html { render :new }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c0c35a25f0de0a55eaf7309af8b9e39e",
"score": "0.6905646",
"text": "def create\n review = Review.create(description: params[:description], customer_id: params[:customer_id], product_id: params[:product_id])\n render json: review\n end",
"title": ""
},
{
"docid": "35e20badee8f3e0fb8668916f7c1cbc3",
"score": "0.690487",
"text": "def new\n @review = Review.new\n end",
"title": ""
},
{
"docid": "35e20badee8f3e0fb8668916f7c1cbc3",
"score": "0.690487",
"text": "def new\n @review = Review.new\n end",
"title": ""
},
{
"docid": "35e20badee8f3e0fb8668916f7c1cbc3",
"score": "0.690487",
"text": "def new\n @review = Review.new\n end",
"title": ""
},
{
"docid": "ce26e30b3d4451af8ddd27c7d7c8cfa3",
"score": "0.6904269",
"text": "def new\n @review = Review.new(\n order_id: params[:order_id],\n client_id: current_user.id,\n pet_sitter_id: params[:pet_sitter_id],\n date: Time.now\n )\n @pet_sitter = User.find(@review.pet_sitter_id)\n @client = User.find(@review.client_id)\n\n p @review\n end",
"title": ""
},
{
"docid": "105987953baf04ac5fc5f54f33f713ce",
"score": "0.690149",
"text": "def new\n @film = Film.new\n @mini_review = MiniReview.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mini_review }\n end\n end",
"title": ""
},
{
"docid": "8746f23033bbabd31720839a1e1103ee",
"score": "0.6899718",
"text": "def create\n\t @info = params[:review]\n\t @name = URI.escape( @info[:name] )\n\t\t@email = URI.escape(@info[:email])\n\n\t\t@phone = URI.escape(@info[:phone])\n\t\t@address = URI.escape(@info[:address])\n\t\n\t \n\t\t# parser = YelpSearchParser.new \n\t\tresults = search_for_yelp_id(@name, @address)\n\t\t$stderr.puts results\n business = results[\"businesses\"][0]\n\t\t\n review_hash = {'rating' => business[\"rating\"], 'comment' => business[\"snippet_text\"] }\n\t\t@review = Review.new(review_hash)\n\n\t\trespond_to do |format|\n format.html { render action: \"show\" }\n end\n end",
"title": ""
},
{
"docid": "c6fe5ff09208f72646440c93b450ec0c",
"score": "0.6899048",
"text": "def new\n @review = Review.new\n end",
"title": ""
},
{
"docid": "c839d975ac135901837e11bc0af938e5",
"score": "0.68844646",
"text": "def create\n @review = @book.reviews.build(review_params)\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to [@book, @review], notice: 'review was successfully created.' }\n format.json { render action: 'show', status: :created, location: @review }\n else\n format.html { render action: 'new' }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2a7899223a367eca4314d91d9e8cf2a9",
"score": "0.68832123",
"text": "def new\n @product = Product.find(params[:product_id])\n @review = @product.reviews.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @review }\n end\n end",
"title": ""
},
{
"docid": "02d3035cb13b6fac37872e7c68f5df46",
"score": "0.6880984",
"text": "def new\n\t@review_type = find_reviewable\n @review = Review.new()\n end",
"title": ""
},
{
"docid": "76b6b5fbb19868c50f9e6c5775e4295e",
"score": "0.6875574",
"text": "def new\n @review_result = ReviewResult.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @review_result }\n end\n end",
"title": ""
},
{
"docid": "87b971d959b68a3d7101ec7d730253f0",
"score": "0.6864414",
"text": "def create\n params_review = { game_id: @game_id, user_id: @user_id }\n .merge(review_params)\n @review = Review.new(params_review)\n @review.save_review\n render 'show', formats: 'json', handlers: 'jbuilder'\n end",
"title": ""
},
{
"docid": "2c67ce9570674db14bb642fb22814b73",
"score": "0.6847415",
"text": "def new\n raise 'shop_idがありません' if params[:shop_id].blank?\n\n @shop_review = ShopReview.new\n @shop_id = params[:shop_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_review }\n end\n end",
"title": ""
},
{
"docid": "4e2cca542a226335eb57513aad85a34f",
"score": "0.6845289",
"text": "def new\n @review = Review.new\n\t@users = User.find(:all)\n\t@merchants = Merchant.find(:all)\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @review }\n end\n end",
"title": ""
},
{
"docid": "4f106e8ced0057f26b77ae4edebd2895",
"score": "0.6844518",
"text": "def create\n @item_review = ItemReview.new(item_review_params)\n\n if @item_review.save\n render json: @item_review, status: :created, location: @item_review\n else\n render json: @item_review.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "0d00ea4418b8ee70a3a07a712e235c7d",
"score": "0.6838036",
"text": "def new\n @review = Review.new\n # @products = Product.all\n\n @product = Product.find(params[:product_id]) if params[:product_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review }\n end\n end",
"title": ""
},
{
"docid": "1d5bc2cd6a0defeca33bd58670714f41",
"score": "0.6828121",
"text": "def new\n @review = topic.reviews.build\n @review.user = current_user\n\n respond_to do |format|\n format.html { render 'form' }\n format.json { render json: @review }\n end\n end",
"title": ""
},
{
"docid": "3ef4accb616df7cec718384f8b6f562d",
"score": "0.6827223",
"text": "def create\n @admin_review = Review.new(admin_review_params)\n\n respond_to do |format|\n if @admin_review.save\n format.html { redirect_to @admin_review, notice: 'Review was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_review }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_review.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3724b1c265de7b63cfa559bdc6606bf8",
"score": "0.6819785",
"text": "def add_review\n cheer_up = CheerUp.find(params[:id])\n review = cheer_up.reviews.new(review_params)\n review.user_id = current_user.id\n if review.save\n render json:\n {\n status: 200,\n cheer_up: cheer_up,\n review: cheer_up.reviews\n }\n else\n render json:\n {\n status: 400,\n cheer_up: cheer_up,\n review: review.errors\n }\n end\n end",
"title": ""
},
{
"docid": "7247e4bb02a4ff3d680c4597f2eeadc8",
"score": "0.6819551",
"text": "def new\n @review = Review.new\n @camp_id = params[:camp_id]\n @url = params[:url]\n\n respond_to do |format|\n format.html { render :layout => false }# new.html.erb\n format.json { render json: @review }\n format.xml { render :xml => @review }\n end\n end",
"title": ""
},
{
"docid": "90f46b2cf59aae63559b688cceb6f73a",
"score": "0.6809266",
"text": "def create\n @review = current_user.reviews.build(review_params)\n\n respond_to do |format|\n if @review.save\n format.html { redirect_to @review, notice: 'Review was successfully created.' }\n format.json { render :review, status: :created, location: @review }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0a098e0d3475f89237f54ba6c33fb55e",
"score": "0.679941",
"text": "def new\n @restaurant = Restaurant.find(params[:restaurant_id])\n @review = Review.new\n end",
"title": ""
},
{
"docid": "5612f42db9702ea21b1ffd01b0c8ac56",
"score": "0.6798633",
"text": "def create\n @review = Review.new(review_params)\n if @review.valid?\n @review.save \n render json: @review\n else \n render json: \"You didn't enter in valid review requirements.\"\n end\n end",
"title": ""
}
] |
e3ff99bf8d4ad261293e75edf5e33d71
|
Demo save_open without blocks
|
[
{
"docid": "06552e5cd230aec3e5be34f0b07b18ea",
"score": "0.0",
"text": "def print_file2(filename)\n\tbegin\n\t\tfile = File.save_open(filename)\n\t\tdata = file.read\n\t\tputs data\n\t\tfile.close\n\t\tprint_separator\n \trescue StandardError => e\n\t\tputs \"Error: Could not read file \\'#{filename}\\'.\"\n \tend\nend",
"title": ""
}
] |
[
{
"docid": "753774cbf875039ce1181e473f2e1b03",
"score": "0.6769537",
"text": "def open_for_write\n end",
"title": ""
},
{
"docid": "65073bce718ae80bec395a1c19e89261",
"score": "0.64422387",
"text": "def save\n ensure_file_open!\n @file.commit\n true\n end",
"title": ""
},
{
"docid": "dbe7a235bd1f0c97f30e9e36961fb935",
"score": "0.63880557",
"text": "def open_and_save_file(path, value = nil, &block)\n # Make sure the directory up to the folder exists\n mkdir_p File.dirname(path)\n # Open the file and use either the block or the value to write the\n # file\n File.open path, 'w' do |f|\n if block_given?\n f.write(yield)\n else\n f.write(value)\n end\n end\nend",
"title": ""
},
{
"docid": "5e3948a1380fa2ba4bd3bf63cc08a416",
"score": "0.63563824",
"text": "def close_write() end",
"title": ""
},
{
"docid": "5e3948a1380fa2ba4bd3bf63cc08a416",
"score": "0.63563824",
"text": "def close_write() end",
"title": ""
},
{
"docid": "5e3948a1380fa2ba4bd3bf63cc08a416",
"score": "0.63563824",
"text": "def close_write() end",
"title": ""
},
{
"docid": "f6999960ff8a94e482be2163f65a6a0d",
"score": "0.63267046",
"text": "def save!; File.write @path, @data end",
"title": ""
},
{
"docid": "479869f298335ebe12113df3a22f9a53",
"score": "0.6289734",
"text": "def close_write; end",
"title": ""
},
{
"docid": "092ebd5c05ee62ae74899a969e6d5efe",
"score": "0.62848854",
"text": "def open_save\n @in_save = true\n call_scene(Save) do |scene|\n @running = false if scene.saved\n Graphics.transition\n end\n @in_save = false\n end",
"title": ""
},
{
"docid": "10a348bbba136b3f3a3b2d91583cad37",
"score": "0.62590426",
"text": "def save\n pathname.open('w') { |file| file.write(data) }\n end",
"title": ""
},
{
"docid": "e87c67f52fc0152c030bc27406c4bfae",
"score": "0.62375075",
"text": "def save_to(path); end",
"title": ""
},
{
"docid": "500814cdd87fb5588750352f429278fe",
"score": "0.6236317",
"text": "def save\n file_path = self.class.file_path(@save_id)\n File.open(file_path, 'w') { |file| \n bytes = file.write @items.inspect\n if bytes > 0\n puts \"saved to #{file_path}\"\n else\n puts \"save to #{file_path} failed\"\n end\n }\n end",
"title": ""
},
{
"docid": "e8590f8ab4c22776d4089f7103c19653",
"score": "0.6226472",
"text": "def open_write(hold_open=false,&block)\n hold_open||=@write_handle # if already open, keep open\n @write_handle=File.open(filename,\"wb\") unless @write_handle\n yield @write_handle if block\n ensure\n close_write unless hold_open\n end",
"title": ""
},
{
"docid": "6c37248fc05cb779c85cc2b34b88d810",
"score": "0.6212353",
"text": "def save(path, mode = ::File::WRONLY|::File::CREAT|::File::TRUNC, **options)\n\t\t\t\t\tif @body\n\t\t\t\t\t\t::File.open(path, mode, **options) do |file|\n\t\t\t\t\t\t\tself.each do |chunk|\n\t\t\t\t\t\t\t\tfile.write(chunk)\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",
"title": ""
},
{
"docid": "6c2d83b05a58fbe1e80e671967cd04c8",
"score": "0.6195096",
"text": "def save_with_load\r\n @oksave = true\r\n save\r\n @oksave = nil\r\n end",
"title": ""
},
{
"docid": "69ca0d76bd4d7a1ca385c627c3c94169",
"score": "0.6173626",
"text": "def close_write(*) end",
"title": ""
},
{
"docid": "a4df0d9c82368f0ddefc5c61db9bc616",
"score": "0.6128999",
"text": "def save_and_close( filename = clean_name )\n result.parent.export filename\n end",
"title": ""
},
{
"docid": "d98ba184bf56df5a231d21b8bbb9e7f4",
"score": "0.6126598",
"text": "def open_for_write\n self.eof_flag = false\n open_data_for_write\n end",
"title": ""
},
{
"docid": "bbbf4fc8692d5c2cfdebd367a553129a",
"score": "0.6121573",
"text": "def save(merge = T.unsafe(nil), file = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "bbbf4fc8692d5c2cfdebd367a553129a",
"score": "0.61213917",
"text": "def save(merge = T.unsafe(nil), file = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "082393f75fc810a4286c16242c18dc01",
"score": "0.60432225",
"text": "def close\n save\n end",
"title": ""
},
{
"docid": "854eafdf45590b2dda41a176c0b4ae91",
"score": "0.6004387",
"text": "def save\n File.open(path, 'w+') { |f| f.write(to_rb + \"\\n\") }\n end",
"title": ""
},
{
"docid": "5e528fa276d7bcd09382e3399aba4fce",
"score": "0.59947747",
"text": "def save(data)\n File.open(@local_file_path, \"wb\") {|file| file.write(data) }\n end",
"title": ""
},
{
"docid": "60018f14d78f3f86e824a2ff10b440da",
"score": "0.59668493",
"text": "def save(&block)\n returning = yield if block_given?\n Taco.storage.save\n returning\n end",
"title": ""
},
{
"docid": "6ec4d4894ae1a2e62bc375ca89cfa5e4",
"score": "0.59596735",
"text": "def save file='GOL.sav'\n File.open(file,'w') do |f|\n Marshal.dump(state,f)\n end\n end",
"title": ""
},
{
"docid": "1610def0624ab935532bf08ad63fd805",
"score": "0.59463835",
"text": "def save!\n begin\n case filename\n when STDOUT_FLAG\n $stdout.write(contents)\n else\n ::File.open(@filename,\"w\") do |f|\n f.write(contents)\n end\n end\n @dirty = false\n rescue => e\n raise FileAccessError, \"Error saving file #{@filename} : #{e.message}\"\n end\n end",
"title": ""
},
{
"docid": "98a0957ced4bbb3010d62fd1c54a85e9",
"score": "0.59201735",
"text": "def save chunk_nr, io\n\t\t\t# retrieve data from io and compare sig \n\t\tend",
"title": ""
},
{
"docid": "b730eeb2c56f3430238795e24e56de8f",
"score": "0.59159726",
"text": "def save(filename = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "b730eeb2c56f3430238795e24e56de8f",
"score": "0.59159726",
"text": "def save(filename = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "c0b155b7ef2acdd2c5835ef09befa170",
"score": "0.59119767",
"text": "def save\n timeout_retry(3, 3){\n write \"SAVE\\r\\n\"\n status_code_reply\n }\n end",
"title": ""
},
{
"docid": "7dfbe95e79278e152d04668f902a381d",
"score": "0.59055436",
"text": "def autosave; end",
"title": ""
},
{
"docid": "0dde32d6e7b86e9eff60e29b897f748b",
"score": "0.58982646",
"text": "def opening; end",
"title": ""
},
{
"docid": "0dde32d6e7b86e9eff60e29b897f748b",
"score": "0.58982646",
"text": "def opening; end",
"title": ""
},
{
"docid": "0dde32d6e7b86e9eff60e29b897f748b",
"score": "0.58982646",
"text": "def opening; end",
"title": ""
},
{
"docid": "1225b448dfa2e7b30dd26c66d7df82e2",
"score": "0.5895184",
"text": "def save!\n File.open(@config[\"state_file\"], \"r\") do |fl|\n fl.flock(File::LOCK_EX)\n\n sequence = (@state.key?(\"sequence\") ? @state[\"sequence\"] + 1 : 0)\n data_file = @config[\"data_dir\"] + format(\"/%03d/%03d/%03d.osm.gz\", sequence / 1000000, (sequence / 1000) % 1000, (sequence % 1000))\n tmp_state = @config[\"state_file\"] + \".tmp\"\n tmp_data = \"/tmp/changeset_data.osm.tmp\"\n # try and write the files to tmp locations and then\n # move them into place later, to avoid in-progress\n # clashes, or people seeing incomplete files.\n begin\n FileUtils.mkdir_p(File.dirname(data_file))\n Zlib::GzipWriter.open(tmp_data) do |fh|\n fh.write(changeset_dump(open_changesets))\n end\n @state[\"sequence\"] = sequence\n File.open(tmp_state, \"w\") do |fh|\n fh.write(YAML.dump(@state))\n end\n\n # sanity check: the files we're moving into place\n # should be non-empty.\n raise \"Temporary gzip file should exist, but doesn't.\" unless File.exist?(tmp_data)\n raise \"Temporary state file should exist, but doesn't.\" unless File.exist?(tmp_state)\n raise \"Temporary gzip file should be non-empty, but isn't.\" if File.zero?(tmp_data)\n raise \"Temporary state file should be non-empty, but isn't.\" if File.zero?(tmp_state)\n\n FileUtils.mv(tmp_data, data_file)\n FileUtils.mv(tmp_state, @config[\"state_file\"])\n fl.flock(File::LOCK_UN)\n\n rescue\n STDERR.puts(\"Error! Couldn't update state.\")\n fl.flock(File::LOCK_UN)\n raise\n end\n end\n end",
"title": ""
},
{
"docid": "35bbb1a8b8a311320887907383da7768",
"score": "0.58529323",
"text": "def save_as(filename = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "35bbb1a8b8a311320887907383da7768",
"score": "0.58529323",
"text": "def save_as(filename = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "35bbb1a8b8a311320887907383da7768",
"score": "0.58529323",
"text": "def save_as(filename = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "9b7ad4a429bf9fa3048a6306a3fc4f54",
"score": "0.58447516",
"text": "def save! filename = nil\n filename ||= @filename\n dirname = File.dirname filename\n FileUtils.mkdir_p dirname\n\n ::File.open(filename, 'wb')do |io|\n until @body_io.eof? do\n io.write @body_io.read 16384\n end\n end\n\n filename\n end",
"title": ""
},
{
"docid": "c80b2db2a6794c64f46f6a662fcb71ba",
"score": "0.5830428",
"text": "def save\n create_file\n true\n end",
"title": ""
},
{
"docid": "3cbc10d98a4861e14d49ac6f49521c0f",
"score": "0.5791039",
"text": "def save!\n if save\n self\n else\n raise FileNotSaved\n end\n end",
"title": ""
},
{
"docid": "147222a56ae1be3927df9e5d9a0c2077",
"score": "0.578953",
"text": "def save # :nodoc:\n if @file\n File.open(SAVE_FILE, 'w') do |f|\n Marshal.dump(file, f)\n end\n else\n forget\n end\n end",
"title": ""
},
{
"docid": "147222a56ae1be3927df9e5d9a0c2077",
"score": "0.578953",
"text": "def save # :nodoc:\n if @file\n File.open(SAVE_FILE, 'w') do |f|\n Marshal.dump(file, f)\n end\n else\n forget\n end\n end",
"title": ""
},
{
"docid": "88888e65a8b26ee2229de219a290d4f7",
"score": "0.57890487",
"text": "def save_level\n File.open(@file_name, 'w') do |file|\n @blocks_array.each do |block|\n new_block = Block.new block.relative_position\n puts new_block.to_s\n end\n end\n end",
"title": ""
},
{
"docid": "a2fa29c9f66d8c07b9f5ca2f8ca3b4c3",
"score": "0.57875293",
"text": "def save_dataE(obj, filename) \r\n File.open(filename, \"wb\") { |f|\r\n Marshal.dump(obj, f)\r\n }\r\nend",
"title": ""
},
{
"docid": "ba1c1c059cf260699b9581d7bcdc92d3",
"score": "0.57771266",
"text": "def open_with_block(opt, block)\n Tempfile.create(TEMPORARY_FILE_PREFIX, **opt) do |temporary_file|\n temporary_file.write(contents)\n temporary_file.seek(0)\n\n block.call(temporary_file)\n end\n end",
"title": ""
},
{
"docid": "8da9f826e4ae144782afbf93fa19f1b7",
"score": "0.57681894",
"text": "def save!\n Powirb.log.debug(\"[#{wid}] saving on #{@filename}\")\n File.open(@filename, 'w+') {|io| io.puts @doc}\n end",
"title": ""
},
{
"docid": "70e15566c41f2a6906f5aac62574f69a",
"score": "0.57451284",
"text": "def create_save\n @save_data = {:turns => @turns,:guesses => @guesses,:secret_word => @secret_word, :hidden_word => @hidden_word}\n save = File.new(\"./lib/save.txt\", \"w+\")\n save.puts JSON::dump(save_data)\n save.close\n end",
"title": ""
},
{
"docid": "6a3443ef276b8510c1b77e166fda8a8d",
"score": "0.5739732",
"text": "def save!(filename = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "6a3443ef276b8510c1b77e166fda8a8d",
"score": "0.5739732",
"text": "def save!(filename = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "1b9b14447c8d1497ead4b3e50e46afad",
"score": "0.57360643",
"text": "def save_to_file(obj)\n File.open(@filename, @mode) do |aFile|\n aFile.puts \"#{obj}\"\n end\n end",
"title": ""
},
{
"docid": "6f9d4c4cc3b919d4eac2bec18cddd8e6",
"score": "0.5735537",
"text": "def persistent_to_quicksave\n p_file = File.open(File.join([self.path, 'persistent.sfs']), 'r'){|f| f.readlines}\n File.open(File.join([self.path, 'quicksave.sfs']), 'w'){|f| f.write(p_file.join)}\n end",
"title": ""
},
{
"docid": "f32049d5741c1cdce07dcc4ce24216a8",
"score": "0.57303",
"text": "def save_with_block(logged, &block)\n if logged\n result = save_without_session_maintenance\n yield(result) if block_given?\n result\n else\n save(true, &block)\n end\n end",
"title": ""
},
{
"docid": "6047fec1ca33fe8e157964b40e15606b",
"score": "0.5723391",
"text": "def open\n object.open\n end",
"title": ""
},
{
"docid": "b7bea51ddfbebe2366d455f3bfe92404",
"score": "0.5703981",
"text": "def closed_write?() end",
"title": ""
},
{
"docid": "5fb9c968f2b0a30f47889672809952da",
"score": "0.5702178",
"text": "def save\n return if saved?\n self.saved = true\n original_path = interpolate_path(:original)\n stream.write_to(original_path)\n end",
"title": ""
},
{
"docid": "31ecbf59156771f83463a4b0030c8581",
"score": "0.57012",
"text": "def save_with_block(logged, &block)\n if logged\n result = save_without_session_maintenance\n yield(result) if block_given?\n result\n else\n save(true, &block)\n end\n end",
"title": ""
},
{
"docid": "cd5a352bf3ba431fd2af7fc040787609",
"score": "0.5696851",
"text": "def save\n dump = Marshal.dump(self)\n file = File.new(FILENAME, 'w')\n file = Zlib::GzipWriter.new(file)\n file.write(dump)\n file.close\n puts \"Bot state saved.\"\n end",
"title": ""
},
{
"docid": "b7a27b8645d2b2c3056a45ebbb558e66",
"score": "0.56491745",
"text": "def dump( obj, &block )\n f = File.open( get_unique_filename, 'w' )\n\n serialized = serialize( obj )\n f.write( serialized )\n\n block.call( serialized ) if block_given?\n\n f.path\n ensure\n f.close\n end",
"title": ""
},
{
"docid": "eef7c5d9440754ec95dec31df5b931a9",
"score": "0.5645559",
"text": "def save filename = nil\n filename = find_free_name filename\n save! filename\n end",
"title": ""
},
{
"docid": "0c9b573cc200e303b4606394a20e9e9b",
"score": "0.56429183",
"text": "def dump_file_data(io)\n end",
"title": ""
},
{
"docid": "1a2087955bd6d63b496a4417b18823f4",
"score": "0.55917895",
"text": "def open(*args, &block)\n end",
"title": ""
},
{
"docid": "fdc82ae818f1eea74503bdd6df342d8b",
"score": "0.5586874",
"text": "def saop\n save_and_open_page\n end",
"title": ""
},
{
"docid": "8b4d5a2ad634619647dc570d62f97156",
"score": "0.55858415",
"text": "def save(path)\n File.open(path,\"w\"){|out| out.puts Marshal.dump(self) }\n end",
"title": ""
},
{
"docid": "274d5db23b2fa970567bf05cf4665858",
"score": "0.55818343",
"text": "def save\n ole = File.open(@file_name, 'w')\n ole << header\n ole << fat\n @storages.each { |s| ole << s.to_s }\n ole << Array.new((512-(ole.pos % 512)), 0).pack('c*')\n ole << mini_fat\n ole << mini_fat_stream\n ole << fat_stream\n ole.close\n end",
"title": ""
},
{
"docid": "87ac46b1507fcb23d2a68df694ee1d4e",
"score": "0.5570147",
"text": "def save\n file_name = ask_save_file\n save_file = File.open(file_name, 'w')\n save_file.puts(serialize)\n save_file.close\n puts \"Game has been saved to Save File #{file_name[-5]}!\"\n puts \"\\n\\n\"\n end",
"title": ""
},
{
"docid": "0256c0682079b0099e0901a498da4d4f",
"score": "0.55508876",
"text": "def create_save\n @save_data = {:turns => @turns,:guesses => @guesses,:secret_word => @secret_word, :hidden_word => @hidden_word}\n save = File.new(\"save.txt\", \"w+\")\n save.puts JSON::dump(save_data)\n save.close\n end",
"title": ""
},
{
"docid": "d651c622388d74a3440edf8be4cb9ef1",
"score": "0.554224",
"text": "def save_state file=nil\n App.out.write_text_files file\nend",
"title": ""
},
{
"docid": "33fb4927eece3f0ddb2dc8d77025b936",
"score": "0.5538264",
"text": "def save_as(path)\n contents = generate\n path.open('w') do |f|\n f.write(contents)\n end\n end",
"title": ""
},
{
"docid": "33fb4927eece3f0ddb2dc8d77025b936",
"score": "0.5538264",
"text": "def save_as(path)\n contents = generate\n path.open('w') do |f|\n f.write(contents)\n end\n end",
"title": ""
},
{
"docid": "33fb4927eece3f0ddb2dc8d77025b936",
"score": "0.5538264",
"text": "def save_as(path)\n contents = generate\n path.open('w') do |f|\n f.write(contents)\n end\n end",
"title": ""
},
{
"docid": "33fb4927eece3f0ddb2dc8d77025b936",
"score": "0.5538264",
"text": "def save_as(path)\n contents = generate\n path.open('w') do |f|\n f.write(contents)\n end\n end",
"title": ""
},
{
"docid": "33fb4927eece3f0ddb2dc8d77025b936",
"score": "0.5538264",
"text": "def save_as(path)\n contents = generate\n path.open('w') do |f|\n f.write(contents)\n end\n end",
"title": ""
},
{
"docid": "9f1bd2abba5e1c0d291231bd1d7fca76",
"score": "0.5530396",
"text": "def save_local(place_path, io)\n file_saved = true\n begin\n file = open(place_path, \"w\")\n file.write(io.read)\n file.close\n rescue => e\n file_saved = false\n end\n return file_saved\n end",
"title": ""
},
{
"docid": "7b8a1a893ec22959d4c9b62ee13ee805",
"score": "0.5530281",
"text": "def save_opf!\n file.write(opf_path, opf_xml.to_s)\n\n opf_xml\n end",
"title": ""
},
{
"docid": "85f3bc9847ef954a315f0757c8fed342",
"score": "0.55295825",
"text": "def open(*args)\n tempfile = new(*args)\n \n if block_given?\n begin\n yield(tempfile)\n ensure\n tempfile.close\n end\n \n nil\n else\n tempfile\n end\n end",
"title": ""
},
{
"docid": "0fca5d6f15bd1c19ef89c4edff0fdd68",
"score": "0.5528885",
"text": "def save_data(obj, filename) \r\n File.open(File.join(Yrgss.game.getPath.getAbsolutePath,filename), \"wb\") { |f|\r\n Marshal.dump(obj, f)\r\n }\r\nend",
"title": ""
},
{
"docid": "58568c32cc4970821819f7d843e1440d",
"score": "0.5525876",
"text": "def file_open_puts object, filename\n File.open(filename, 'w') do |f|\n f.puts(object)\n end\n\n end",
"title": ""
},
{
"docid": "f4673fe4fa17dfc16c0dc6f7e133192e",
"score": "0.55193305",
"text": "def save_diff_file(full_diff_pathname, open_mode = 'a+')\n File.open(full_diff_pathname, open_mode) do |f|\n f.puts \"-- #{full_diff_pathname}\\r\\n\"\n f.puts 'SET SQL_MODE = \"NO_AUTO_VALUE_ON_ZERO\";'\n f.puts 'SET AUTOCOMMIT = 0;'\n f.puts 'START TRANSACTION;'\n f.puts 'SET time_zone = \"+00:00\";'\n f.puts '/*!40101 SET NAMES utf8 */;'\n f.puts \"\\r\\n--\\r\\n\"\n\n f.puts sql_diff_text_log\n\n f.puts \"\\r\\n--\\r\\n\"\n f.puts 'COMMIT;'\n end\n end",
"title": ""
},
{
"docid": "5dbd42a3a2fd9d3fd066a85b12bc4dba",
"score": "0.5518154",
"text": "def open(path, &block)\n @io = File.open(path, 'r+') # TODO: r+ will create the file if it doesn't exist =( Do a exists? check before this and simply return nil? Or raise error? I hate errorrrs\n sleep(0.1) until [email protected]?\n\n @io.readbyte # Sync\n\n if block_given?\n yield(self)\n\n close\n end\n\n self\n end",
"title": ""
},
{
"docid": "e1bc32fd2c089cd0970361af2451f3ae",
"score": "0.5509596",
"text": "def save_file(url, file)\n puts \"Downloading http://...#{url[-8..-1]} -> #{file}\"\n File.open(file, \"wb\") do |saved_file|\n # the following \"open\" is provided by open-uri\n open(url) do |read_file|\n saved_file.write(read_file.read)\n end\n end\nend",
"title": ""
},
{
"docid": "49dbcf1609a0d4737dbcb0eeaa438684",
"score": "0.5500683",
"text": "def open\n _close\n mode = @mode & ~(File::CREAT|File::EXCL)\n @tmpfile = File.open(@tmpfile.path, mode, **@opts)\n __setobj__(@tmpfile)\n end",
"title": ""
},
{
"docid": "ce6b4a1a5e7aaca10c11169a5a843819",
"score": "0.5495857",
"text": "def _close_write\n @_write_closed = true\n end",
"title": ""
},
{
"docid": "af2412e9acaab94cae7a183cfe23e981",
"score": "0.54882693",
"text": "def save_as_lss()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.Run_save_as_lss(@handle.ptr)\n result\n end",
"title": ""
},
{
"docid": "affd7b25de8154428ab1a4cf97257f19",
"score": "0.5486453",
"text": "def save(filename, data)\n\tf = File.open(filename, 'w')\n\tf.puts(data)\n\tf.close\nend",
"title": ""
},
{
"docid": "c00d236b197760a1625c390549a6b3f1",
"score": "0.54754984",
"text": "def save\n\n playerset('')\n $savefile = File.new(\"../Resources/Saves/save.txt\", \"w\")\n $savefile.puts(@@hand, @@ehand)\n cputs(\"saved\", \"green\")\n\nend",
"title": ""
},
{
"docid": "333032f9d926ddc18a070de121225f29",
"score": "0.5474",
"text": "def save(options = {})\n save_to(@path, options)\n end",
"title": ""
},
{
"docid": "2c099ebff8d962936e791cb997d30faa",
"score": "0.5471359",
"text": "def close() end",
"title": ""
},
{
"docid": "2c099ebff8d962936e791cb997d30faa",
"score": "0.5471359",
"text": "def close() end",
"title": ""
},
{
"docid": "2c099ebff8d962936e791cb997d30faa",
"score": "0.5471359",
"text": "def close() end",
"title": ""
},
{
"docid": "2c099ebff8d962936e791cb997d30faa",
"score": "0.5471359",
"text": "def close() end",
"title": ""
},
{
"docid": "2c099ebff8d962936e791cb997d30faa",
"score": "0.5471271",
"text": "def close() end",
"title": ""
},
{
"docid": "5aafd7493424c6c0618c5f1f71700f36",
"score": "0.54564077",
"text": "def reopen\n end",
"title": ""
},
{
"docid": "c99ebc0fe02e35b69ad32211b54b8fd1",
"score": "0.5455981",
"text": "def open\n writer.open\n end",
"title": ""
},
{
"docid": "215a8e7d5064ae0aa7fd11625e5bde64",
"score": "0.54438895",
"text": "def open_safely!\n yield current_file.open\n ensure\n current_file.close\n end",
"title": ""
},
{
"docid": "49ef2e6de0c52c399f8220b0544408e6",
"score": "0.54393685",
"text": "def open_without_block(opt)\n file = Tempfile.new(TEMPORARY_FILE_PREFIX, Dir.tmpdir, **opt)\n file.write(contents)\n file.seek(0)\n file\n rescue StandardError\n file&.close!\n raise\n end",
"title": ""
},
{
"docid": "ec1fdca850cc00ccb5f9c8c15cc6605b",
"score": "0.5438615",
"text": "def open\n @spoolfile.close if @spoolfile\n @spoolfile = ::File.open(@path, 'r+')\n __setobj__(@spoolfile)\n end",
"title": ""
},
{
"docid": "6f0269edb5f5b42ec6ce989339b03e60",
"score": "0.5433922",
"text": "def save\n \tdata = self\n \t\n \tFile.open('store.yml','w') do |f|\n \t\tf.write(data.to_yaml)\n \tend\n \tputs data\n \tputs \"Saved!\"\n \tputs \"\"\n end",
"title": ""
},
{
"docid": "adec29250d8cb7e1b1d7f28f65254513",
"score": "0.5427026",
"text": "def close\n persist\n end",
"title": ""
},
{
"docid": "7a83e0b5656fe52eb4b5f8af3c7c534c",
"score": "0.5420184",
"text": "def open(id, **options, &block)\n path(id).open(binmode: true, **options, &block)\n end",
"title": ""
},
{
"docid": "23c8cb43b9a9594ef3238537e24b7ed4",
"score": "0.5409706",
"text": "def write\n open(@fname,\"wb\") do |file|\n Marshal.dump(@data,file)\n end\n end",
"title": ""
}
] |
597d66fcbf61484c95072a5ad1384047
|
rails r "SlackAgent.error_send(Exception.new)" rails r "SlackAgent.error_send((1/0 rescue $!))"
|
[
{
"docid": "e547e80571ea8ec979987d277cac7aaf",
"score": "0.58502907",
"text": "def error_send(error)\n message_send(key: \"ERROR\", body: [\"#{error.message} (#{error.class})\", error.backtrace].compact.join(\"\\n\"))\n end",
"title": ""
}
] |
[
{
"docid": "41d537c42ca976946a95b3b7a132b9d3",
"score": "0.66842365",
"text": "def sendError(msg)\n sendCmd \"ERROR #{msg}\"\nend",
"title": ""
},
{
"docid": "4d39812641282aa0d09ef5e89fc0c536",
"score": "0.64314",
"text": "def invoke_internal_error msg = \"???\"\n @return_values.elapsed_time = Time.now - @return_values.start_time\n @return_values.responder = @responder\n @return_values.code = 900\n @return_values.message = msg\n set_deferred_status :failed, @return_values\n send_data \"QUIT\\r\\n\"\n close_connection_after_writing\n end",
"title": ""
},
{
"docid": "d7fc78e5f7d18ecb842683ae08694b69",
"score": "0.6425437",
"text": "def run_failed(exception, run_status); end",
"title": ""
},
{
"docid": "5a94c7c0f76d67a145d58e0264783536",
"score": "0.63687426",
"text": "def error(exception)\n puts \"execution failed: #{exception}\"\n end",
"title": ""
},
{
"docid": "d3c2cb94d5d312ece40455dfdf0f6313",
"score": "0.6353418",
"text": "def display_game_exception(message)\r\n puts message\r\n puts format('Error type : %<class>s', class: $!.class)\r\n puts format('Error message : %<message>s', message: $!.message)\r\n puts $!.backtrace\r\n Audio.bgm_stop rescue nil\r\n Audio.bgs_stop rescue nil\r\n Audio.me_stop rescue nil\r\n Audio.se_stop rescue nil\r\n FMOD::System.close rescue nil\r\n exit!\r\nend",
"title": ""
},
{
"docid": "3dd49bf89ca13eba8cb278cfe6edcd89",
"score": "0.62408906",
"text": "def rescue_result; end",
"title": ""
},
{
"docid": "250e5f780c1d2076c8e1c4e94873cfb6",
"score": "0.62285364",
"text": "def error!(text, **message)\n\t\t\t\t\tsend(status: text, **message)\n\t\t\t\tend",
"title": ""
},
{
"docid": "8a3f99b211d1a60c7e7e2b5e64219500",
"score": "0.6173236",
"text": "def rails_report_rescued_exceptions=(_arg0); end",
"title": ""
},
{
"docid": "9d552bc0d1f512b54a63381c4fbe28ea",
"score": "0.6172617",
"text": "def send_error(msg)\n send_frame(\"ERROR\",{'message' => 'See below'},msg)\n end",
"title": ""
},
{
"docid": "7f6e5535534b796dd3b4bf52da7e51a2",
"score": "0.6168406",
"text": "def email_on_failure(reason, e)\n # `echo \"#{reason}\\n\\nException trace:\\n#{e.inspect}\" | mail #{TO_EMAIL} -F #{FROM_EMAIL} -s \"Passenger Management Exception\"`\n puts \"Passenger Management Exception\"\n puts reason\n puts \"Exception Trace:\\n#{e.inspect}\"\nend",
"title": ""
},
{
"docid": "6c049febee9f25a8fce8268d288cd932",
"score": "0.6149235",
"text": "def run_err cmd\n execute cmd, \"run_err\"\n end",
"title": ""
},
{
"docid": "6c049febee9f25a8fce8268d288cd932",
"score": "0.6149235",
"text": "def run_err cmd\n execute cmd, \"run_err\"\n end",
"title": ""
},
{
"docid": "17b4a3a9d1b7fa15103b5f79c92d73f9",
"score": "0.61458886",
"text": "def hello\n # ...\nrescue => e\n puts e.message\nend",
"title": ""
},
{
"docid": "094c9345165edc4f2a1bb8693be69fdc",
"score": "0.6138552",
"text": "def error(content)\n post_to_slack(content)\n end",
"title": ""
},
{
"docid": "0afc63e1cbd40c7fc9136c2cb1d8104d",
"score": "0.6133965",
"text": "def handleError(msg)\n errorMessage = \"Error while uploading sequence results to LIMS. Working Dir : \" +\n Dir.pwd + \" Message : \" + msg.to_s\n\n obj = EmailHelper.new()\n emailFrom = \"[email protected]\"\n emailTo = obj.getErrorRecepientEmailList()\n emailSubject = \"Error while uploading sequence results to LIMS\" \n\n obj.sendEmail(emailFrom, emailTo, emailSubject, errorMessage)\n puts errorMessage.to_s\n exit -1\n end",
"title": ""
},
{
"docid": "277cb18faf06741e91f62c376b2e9f16",
"score": "0.6133721",
"text": "def call_err cmd, *args\n call_execute cmd, \"run_err\", *args\n end",
"title": ""
},
{
"docid": "3417aa87057ad12e72bda803fe57f344",
"score": "0.6115113",
"text": "def call(kernel, ex)\n backtrace = case ex\n when ::WLang::Error\n ex.wlang_backtrace\n when ::Exception\n ex.backtrace\n else \n []\n end\n [500, {'Content-Type' => 'text/html'}, ex_to_html(ex, backtrace)]\n end",
"title": ""
},
{
"docid": "96fc5c7207ba66e06d7b9c9e07e844b7",
"score": "0.6103518",
"text": "def handleError(commandName)\n errorMessage = \"Error while processing command : \" + commandName.to_s +\n \" for flowcell : \" + @fcBarcode.to_s + \" Working Dir : \" +\n Dir.pwd.to_s + \" Hostname : \" + @envInfo.getHostName() \n # For now keep like this\n emailSubject = \"Error while mapping : \" + @fcBarcode.to_s\n\n obj = EmailHelper.new()\n emailFrom = \"[email protected]\"\n emailTo = obj.getErrorRecepientEmailList()\n emailSubject = \"Error during mapping on host \" + @envInfo.getHostName() \n\n obj.sendEmail(emailFrom, emailTo, emailSubject, errorMessage)\n\n puts errorMessage.to_s\n exit -1\n end",
"title": ""
},
{
"docid": "3952eed34373c936f3dcba9cf7536e02",
"score": "0.60774785",
"text": "def try_err cmd, *args\n call_execute cmd, \"try_err\", *args\n end",
"title": ""
},
{
"docid": "ead99a04f603adb55144913001ad3af8",
"score": "0.60640234",
"text": "def try_err cmd\n execute cmd, \"try_err\"\n end",
"title": ""
},
{
"docid": "ead99a04f603adb55144913001ad3af8",
"score": "0.60640234",
"text": "def try_err cmd\n execute cmd, \"try_err\"\n end",
"title": ""
},
{
"docid": "419bf687832ad6fae160e41a914ce051",
"score": "0.6025488",
"text": "def send_error_email(exception)\n send_to_email = \"[email protected]\"\n send_from_email = settings.send_from_email\n subject = \"[#{settings.environment}] Vistazo: an error occurred\"\n\n @url = APP_CONFIG[\"base_url\"]\n @backtrace = \"\"\n exception.backtrace.each { |e| @backtrace += \"#{e}\\n\" }\n @exception = \"#{exception.class}: #{exception.message}\"\n\n send_google_email(send_from_email, send_to_email, subject, erb(:error_email, :layout => false))\nend",
"title": ""
},
{
"docid": "9b44ed7d06c1b54dcf5898bae6597246",
"score": "0.6016221",
"text": "def send_error(e, res)\n res.status = 500\n res['Content-Type'] = 'application/json'\n body = { code: -1, error: \"#{e.class}: #{e.message}\" }\n body[:backtrace] = e.backtrace\n res.body = @shell.data(body).json(@shell.indent)\n @shell.logger.warn(Impl.format_error(e))\n\tend",
"title": ""
},
{
"docid": "8a17141f78d9e9392654b46382e81de4",
"score": "0.60025465",
"text": "def error!(msg)\n raise CommandFailed, msg\n end",
"title": ""
},
{
"docid": "1215ae15df8db1b99426ef6aaa75561d",
"score": "0.60018975",
"text": "def hipchat_exception(exception)\n # If the background fails only send one message the first time\n return if @background_failed\n\n # If this is a failing scenario output includes:\n # 1a) file & line number for scenario\n # 1b) all tags, including those declared on the feature\n # 1c) scenario name\n # 2) failing step\n # 3) The exception\n\n # If this is a failing example, then output includes:\n # 1) For the first failing example in an outline the same as above, omitted for the subsequent examples\n # 2) \"Example #X failed:\"\n # 3) the exception\n\n # If this was a failing background step:\n # 1a) file & line number for background\n # 1b) \"Background step failed:\"\n # 2) failing step\n # 3) the exception\n\n sb = ''\n\n # part 1\n unless @had_failing_example\n if @current_scenario_info\n sb << \"# #{ @current_scenario_info[:file_colon_line] }\\n\"\n all_tags = (@background_tags || []) + (@current_scenario_info[:tags] || [])\n sb << all_tags.join(' ') + \"\\n\" if all_tags.size > 0\n sb << \"#{ @current_scenario_info[:keyword]}: #{ @current_scenario_info[:name]}\\n\"\n elsif @in_background\n sb << \"# #{ @in_background.file_colon_line }\\nBackground step failed:\\n\"\n @background_failed = true\n else\n sb = 'error: no scenario info'\n end\n end\n\n # part2\n if @current_failed_step_info # Failing scenario or background, not example\n sb << \"#{ current_step_match_to_str } # \"\n fcl = @current_failed_step_info[:file_colon_line] # line in the feature file, may be nil\n sb << fcl << ' → ' if fcl\n sb << @current_failed_step_info[:step_match].file_colon_line << \"\\n\"\n elsif @example_num\n @had_failing_example = true\n sb << \"Example ##{@example_num} failed:\\n\"\n end\n\n adapter.hip_post( \"#{ sb }#{ build_exception_detail(exception) }\", color: :error )\n end",
"title": ""
},
{
"docid": "cd3e3d91161f9388ab253c1b7dc59bb0",
"score": "0.60007507",
"text": "def error job, exception\n self.errmsg = \"#{exception.class.to_s} ERROR: #{exception.to_s}\"\n if exception.respond_to?(:response_code)\n elaboration =\n case errcode = exception.response_code.to_i\n when 503\n ' Host isn\\'t talking at the moment'\n when 404\n ' URL doesn\\'t point to anything!'\n end\n self.errmsg << \"(HTTP Response Code #{errcode}#{elaboration})\"\n else\n self.errcode = -1\n end\n cutoff = exception.backtrace.find_index { |lev| lev.match('scraper.rb') && lev.match('perform') } || -1\n self.errmsg << \"\\n\\t\" + exception.backtrace[0..cutoff].join(\"\\n\\t\")\n # Adding an error here ensures that the object will be recorded as :bad\n Rails.logger.info \"!!!Scraper ##{id} Failed on #{url} with status #{status}:\\n#{errmsg}\"\n errors.add :base, \"Error ##{errcode} (#{errmsg})\"\n end",
"title": ""
},
{
"docid": "5888e4c5b7bc876ff99e943b6adf2d54",
"score": "0.5995693",
"text": "def exception(ex)\n error(ETL::Job::Result.error(ex))\n end",
"title": ""
},
{
"docid": "5888e4c5b7bc876ff99e943b6adf2d54",
"score": "0.5995693",
"text": "def exception(ex)\n error(ETL::Job::Result.error(ex))\n end",
"title": ""
},
{
"docid": "7cae28fee49a0e1009c90efafacbe9bf",
"score": "0.598276",
"text": "def error(exception)\n logger.info \"execution failed: #{exception}\"\n end",
"title": ""
},
{
"docid": "7cae28fee49a0e1009c90efafacbe9bf",
"score": "0.598276",
"text": "def error(exception)\n logger.info \"execution failed: #{exception}\"\n end",
"title": ""
},
{
"docid": "8d86f337369f2e5bd23a66a453edda4c",
"score": "0.59809905",
"text": "def send_email(reason, type, notes, email_from, email_to, mail_server, region, to)\n return if reason.to_s.empty? # Don't spam when exiting/killing the code.\n puts \"region=[#{region}]\\t[#{get_time}] Sending exception email for reason=[#{reason}]\"\n hostname = Socket.gethostname\n message = \"From: ruby-cloudtrail-slack <#{email_from}>\\n\"\n message += \"To: #{to} <#{email_to}>\\n\"\n message += \"Subject: Ruby-CloudTrail-Slack Exception error occurred\\n\\n\"\n message += \"Current process name and location:\\n\"\n message += \"Program name [#{$PROGRAM_NAME}] is located at [#{Dir.pwd}/.] on [#{hostname}]\\n\\n\"\n # Possibly print IPs on the host to make locating it a bit easier, but is somewhat of an info leak:\n # Socket.ip_address_list.each{|x| print x.ip_address + \", \"}\n message += \"Thread region:\\n\"\n message += \"#{region}\\n\\n\"\n message += \"Error type:\\n\"\n message += \"#{type}\\n\\n\"\n message += \"Exception reason:\\n\"\n message += \"#{reason}\\n\\n\"\n message += \"Notes from developer regarding this exception (if any):\\n\"\n message += \"#{notes}\\n\"\n Net::SMTP.start(mail_server) do |smtp|\n smtp.send_message message, email_from, email_to\n end\nend",
"title": ""
},
{
"docid": "a11eb7d0088b221901dbf6d963545574",
"score": "0.5960918",
"text": "def rescueing; end",
"title": ""
},
{
"docid": "bfa739ea7482d2704cef6b6850cac1e7",
"score": "0.59419113",
"text": "def sendError(errText)\n # an error is written as an interaction thusly:\n # (commentBody is used for the error text)\n j = { 'kind' => 'error' , 'commentBody' => errText }\n return writeInteraction(j)\n end",
"title": ""
},
{
"docid": "fb9489ab0dba035c9e9c7bdfb63aea5a",
"score": "0.5932027",
"text": "def error(exception)\n @exception = exception\n mail to: \"[email protected]\", subject: \"Rescue error occurred: #{exception}\"\n end",
"title": ""
},
{
"docid": "2dfd61e476b236551cb24284de2e78a0",
"score": "0.59301704",
"text": "def handleError(errorMsg)\n errorMessage = \"Error while obtaining information from LIMS for flowcell : \" +\n @fcName + \" Error message : \" + errorMsg.to_s\n obj = EmailHelper.new\n emailFrom = \"[email protected]\"\n emailTo = obj.getErrorRecepientEmailList()\n emailSubject = \"LIMS error while getting info for flowcell : \" + @fcName.to_s\n obj.sendEmail(emailFrom, emailTo, emailSubject, errorMessage)\n puts errorMessage.to_s\n exit -1\n end",
"title": ""
},
{
"docid": "7c47b04adcecfeff95c5afac5630ac9d",
"score": "0.59301096",
"text": "def raise_server_error!; end",
"title": ""
},
{
"docid": "28f62290e323f7472ebce66f2d624a05",
"score": "0.5921631",
"text": "def app_error(str, calls=5)\r\n format_msg('APP_ERROR: ', str, calls, print_calls=true)\r\n end",
"title": ""
},
{
"docid": "8f58b306a8219da794fe3b7854794cd1",
"score": "0.5919938",
"text": "def on_rescue(exceptions, variable, statements, consequent); end",
"title": ""
},
{
"docid": "7ed4f73bd5bf46834a0c3203ad47a333",
"score": "0.59189075",
"text": "def test_logs_errors_to_rack_logger\n app = TestApp.new(LogErrors) do |env|\n raise 'Kaboom'\n end\n\n logger_output = StringIO.new\n without_error do\n app.get('/', 'rack.logger' => Logger.new(logger_output))\n end\n\n assert_match /ERROR -- : Kaboom/, logger_output.string\n end",
"title": ""
},
{
"docid": "863621af7102684cdfe36c831bb76120",
"score": "0.59129065",
"text": "def failure_message(message)\n sender = \"Database Team <[email protected]\"\n recipients = \"[email protected]\"\n hostname = `hostname`.chomp\n subject = \"An error has occurred while purging binary logs on #{hostname}\"\n mailtext = <<EOF\nFrom: #{sender}\nTo: #{recipients}\nSubject: #{subject}\n#{message}\nEOF\n\n begin Net::SMTP.start('mail') do |smtp|\n smtp.sendmail(mailtext, 'root@' + hostname, recipients)\n end\n rescue Exception => e\n log_error \"Exception occurred: \" + e\n end\n \n exit(1)\nend",
"title": ""
},
{
"docid": "48452286012eb838ca2d9fc705655c95",
"score": "0.59074306",
"text": "def report_exception\n self.class.client.chat_postMessage(channel: self.class.channel, text: \"```#{text}```\", as_user: true)\n end",
"title": ""
},
{
"docid": "990a37f96e9c04a220f52a84d228af97",
"score": "0.5896274",
"text": "def error(msg)\n $evm.log(:error, msg)\n $evm.root['ae_result'] = 'error'\n $evm.root['ae_reason'] = msg.to_s\n exit MIQ_STOP\nend",
"title": ""
},
{
"docid": "cf24711afed58f62c1e14590340f4d6d",
"score": "0.5896046",
"text": "def failure_message(message)\n sender = \"Database Team <[email protected]\"\n recipients = \"[email protected]\"\n hostname = `hostname`.chomp\n subject = \"An error has occurred while purging binary logs on #{hostname}\"\n mailtext = <<EOF\nFrom: #{sender}\nTo: #{recipients}\nSubject: #{subject}\n#{message}\nEOF\n\t\n begin Net::SMTP.start('mail') do |smtp|\n smtp.sendmail(mailtext, 'root@' + hostname, recipients)\n end\n rescue Exception => e\n log_error \"Exception occurred: \" + e\n end\n \n exit(1)\nend",
"title": ""
},
{
"docid": "8d626201739043924256ad0497446b5d",
"score": "0.5894779",
"text": "def rescue(&block); end",
"title": ""
},
{
"docid": "8d626201739043924256ad0497446b5d",
"score": "0.5894779",
"text": "def rescue(&block); end",
"title": ""
},
{
"docid": "7fb8fd5c995d5343c849510e90688308",
"score": "0.5889588",
"text": "def error!; end",
"title": ""
},
{
"docid": "7fb8fd5c995d5343c849510e90688308",
"score": "0.5889588",
"text": "def error!; end",
"title": ""
},
{
"docid": "8967bfcff2c1b3e1783575ba00f212ef",
"score": "0.58747184",
"text": "def error(msg)\n $evm.log(:error, msg)\n $evm.root['ae_result'] = 'error'\n $evm.root['ae_reason'] = msg.to_s\n exit MIQ_OK\nend",
"title": ""
},
{
"docid": "8967bfcff2c1b3e1783575ba00f212ef",
"score": "0.58747184",
"text": "def error(msg)\n $evm.log(:error, msg)\n $evm.root['ae_result'] = 'error'\n $evm.root['ae_reason'] = msg.to_s\n exit MIQ_OK\nend",
"title": ""
},
{
"docid": "fda240ec10c62e45aab79145921748cf",
"score": "0.58727705",
"text": "def invoke_error\n @return_values.elapsed_time = Time.now - @return_values.start_time\n @return_values.responder = @responder\n @return_values.code = @code\n @return_values.message = @msg\n set_deferred_status :failed, @return_values\n send_data \"QUIT\\r\\n\"\n close_connection_after_writing\n end",
"title": ""
},
{
"docid": "1b735f17cfeffcc43d8e34d80af5298d",
"score": "0.58603877",
"text": "def run\n @error_procs.inject(nil) do |response, error_proc|\n result = begin\n error_proc.call(@exception, @context)\n rescue StandardError => proc_exception\n @exception = proc_exception\n response = nil # reset response\n end\n response || result\n end\n end",
"title": ""
},
{
"docid": "7543f8021a786b9d5e3c63830975a70d",
"score": "0.58596206",
"text": "def error text\n STDERR.puts \"farcall ws server error #{text}\"\n EM.schedule {\n @errback.call(text) if @errback\n close\n }\n end",
"title": ""
},
{
"docid": "05db3170829e0e06b9e5e2c5b3cf7263",
"score": "0.5858833",
"text": "def send_error message\n send_data \"ERROR: \" + message\n end",
"title": ""
},
{
"docid": "b676a600d41e71c04d63f829443f30e0",
"score": "0.5857155",
"text": "def unknown_error(server, error, kind = T.unsafe(nil), env = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "da7042bb861324b2d1e6dc9d3703c539",
"score": "0.5856075",
"text": "def RescueEx(exceptions, variable); end",
"title": ""
},
{
"docid": "f9f63f0feef20da2f05a1af1f886985d",
"score": "0.5838923",
"text": "def rescueing=(_arg0); end",
"title": ""
},
{
"docid": "6032aee85b9fb8dda65874831d97d005",
"score": "0.5838005",
"text": "def report_exception\n event_metadata = {\n :sourcetype => 'storm_multi_line',\n :host => node.hostname,\n :project => @project_id}\n\n api_params = event_metadata.collect{ |k,v| [k, v].join('=') }.join('&')\n url_params = URI.escape(api_params)\n endpoint_path = [API_ENDPOINT, url_params].join('?')\n\n request = RestClient::Resource.new(\n SPLUNKSTORM_URL, :user => @access_token, :password => 'x')\n\n request[endpoint_path].post(Array(run_status.backtrace).join(\"\\n\"))\n end",
"title": ""
},
{
"docid": "e12fd8bcc27db21f677e8f8251c906f4",
"score": "0.5837751",
"text": "def run_failed(exception)\n send_run_completion(\"failure\")\n end",
"title": ""
},
{
"docid": "f75265b1340a078fecfec0e4412f0a3d",
"score": "0.5832512",
"text": "def handle_error(excpt, request, response)\n ###\n # Ok, something very bad happend here... what to do..\n # send_file_full(@cfg[\"error\"][\"img\"],request,response,@cfg[\"error\"][\"format\"])\n stuff = \"Broken at #{Time.now.to_s}\"\n stuff += \"--------------------------\\n\"\n stuff += excpt.to_s + \"\\n\"\n stuff += \"--------------------------\\n\"\n stuff += excpt.backtrace.join(\"\\n\")\n stuff += \"--------------------------\\n\"\n stuff += \"request => \" + YAML.dump(request)+ \"\\n-------\\n\"\n error_msg(response, 'A problem has occured..')\n @logger.logerr(\"Crash in::#{@lt}\" + stuff)\n end",
"title": ""
},
{
"docid": "8f25f58c0470d19321aadd411ececaf1",
"score": "0.58138573",
"text": "def error(message); end",
"title": ""
},
{
"docid": "db0637b52c24247abaf95cf29bfeafe2",
"score": "0.57988346",
"text": "def errback(&block); end",
"title": ""
},
{
"docid": "86191313a2c66e91c63af56a79fc0014",
"score": "0.5796476",
"text": "def build_loop_failed(exception)\n end",
"title": ""
},
{
"docid": "86191313a2c66e91c63af56a79fc0014",
"score": "0.5796476",
"text": "def build_loop_failed(exception)\n end",
"title": ""
},
{
"docid": "eda4c5338fea12c75fb50a960eaa6f50",
"score": "0.5794455",
"text": "def call(env)\n @app.call(env)\n rescue StandardError => e\n exception_string = dump_exception(e)\n\n write_exception_to_shelf_errors(exception_string, env)\n\n body = production? ? Utils::HTTP_STATUS_CODES[500] : exception_string\n\n [\n 500,\n { CONTENT_TYPE => 'text/plain', CONTENT_LENGTH => body.bytesize.to_s },\n [body]\n ]\n end",
"title": ""
},
{
"docid": "70f5781930903f1ee563479137eb0336",
"score": "0.579341",
"text": "def error!(e)\n @env['rack.errors'].puts(e.message)\n @status = 500 if new?\n @state = :errored\n @handler.close!(false)\n end",
"title": ""
},
{
"docid": "cb51451c94ebd91eeb482b6ad9ad3e5c",
"score": "0.57926196",
"text": "def executa_erro\n\traise \"um teste do backtrace\"\nend",
"title": ""
},
{
"docid": "121a8d235b907bf69587632f649dddb6",
"score": "0.5790938",
"text": "def error(msg); output(:error, msg); end",
"title": ""
},
{
"docid": "2ffb095526a7ca703552ab1d360027f9",
"score": "0.5786421",
"text": "def on_ssl_connectfail(parms)\n begin\n @log.debug \"SSL Connect Fail Parms #{info(parms)}\"\n @log.debug \"SSL Connect Fail Exception #{parms[:ssl_exception]}, #{parms[:ssl_exception].message}\"\n rescue\n @log.debug \"SSL Connect Fail oops\"\n end\n=begin\n # An example LoggerConnectionError raise\n @log.debug \"SSL Connect Fail, will raise\"\n raise Stomp::Error::LoggerConnectionError.new(\"quit from SSL connect\")\n=end\n end",
"title": ""
},
{
"docid": "41858c359432263b446098ad45987bc1",
"score": "0.57856995",
"text": "def with_frontend_rescue_pattern\n output = \"\"\n begin\n yield(output)\n rescue OpenShift::Runtime::FrontendHttpServerExecException => e\n report_exception(nil, nil, e)\n OpenShift::Runtime::NodeLogger.logger.error(\"#{e.message}\\n#{e.backtrace.join(\"\\n\")}\")\n return e.rc, e.message + e.stdout + e.stderr\n rescue OpenShift::Runtime::FrontendHttpServerException => e\n report_exception(nil, nil, e)\n OpenShift::Runtime::NodeLogger.logger.error(\"#{e.message}\\n#{e.backtrace.join(\"\\n\")}\")\n return 129, e.message\n rescue Exception => e\n report_exception(nil, nil, e)\n OpenShift::Runtime::NodeLogger.logger.error(\"#{e.message}\\n#{e.backtrace.join(\"\\n\")}\")\n return 1, e.message\n else\n return 0, output\n end\n end",
"title": ""
},
{
"docid": "b660d7a7e793d825055946b164da6c7c",
"score": "0.578047",
"text": "def raise_error_if_failed!(result)\n return if result.status.statusCode == 0\n error_message = result.status.errorMessage || 'Execution failed!'\n raise error_message\n end",
"title": ""
},
{
"docid": "b660d7a7e793d825055946b164da6c7c",
"score": "0.578047",
"text": "def raise_error_if_failed!(result)\n return if result.status.statusCode == 0\n error_message = result.status.errorMessage || 'Execution failed!'\n raise error_message\n end",
"title": ""
},
{
"docid": "382d7339fbc48312fdc639dedffb87fd",
"score": "0.57785445",
"text": "def exception_raised message = '', backtrace=nil\n #@@time_last_job_failure = Time.now\n msg = \"Exception thrown \" + message \n info msg, backtrace\n @@failures_in_hour = (@@failures_in_hour + 1)\n if @@failures_in_hour >= 290\n wait = (Time.now + 300.seconds - @@time_last_job_failure)\n msg = \"Sleeping for #{(wait/60).to_s} minutes because of too many failures............\"\n info msg#, backtrace\n sleep wait\n @@time_last_job_failure = 0\n @@time_last_job_failure = Time.now\n end\n end",
"title": ""
},
{
"docid": "3b1d96d83bf86b81bf8a9e69c20dc6e8",
"score": "0.57740396",
"text": "def run_script\n begin\n yield\n rescue Exception => x\n print \"Content-type: text/plain\\r\\n\\r\\n\"\n print \"Exception: \" + x.message + \"\\r\\n\\r\\n\"\n puts x.backtrace\n end\nend",
"title": ""
},
{
"docid": "dae4b7a2c99898300702fba290291fbb",
"score": "0.5766817",
"text": "def rescue_action(e); raise e; end",
"title": ""
},
{
"docid": "f9c5f34b6fb44c9a9ea450dffadab49b",
"score": "0.5752844",
"text": "def msg\n 'error processing'\n end",
"title": ""
},
{
"docid": "f765a5b4d98af1002dffd73e2403a29a",
"score": "0.5743641",
"text": "def em!\n if @__status__.exception then\n puts @__status__.exception.message\n elsif @__status__.failure_reason\n puts @__status__.failure_reason\n else\n puts \"No exception or failure reason available\"\n end\n end",
"title": ""
},
{
"docid": "f1b4085057aad80fc6d8b1b090be5dff",
"score": "0.573802",
"text": "def error(raw_message)\n process Status.error(raw_message)\n end",
"title": ""
},
{
"docid": "f713e842e7ad66ca429522a0fdc0162a",
"score": "0.5735995",
"text": "def launch3\n batten_hatches\n light_seatbelt_sign\n true\nrescue LightError\n puts \"Lights not working, still launching\"\n true\nrescue StandardError => e\n puts $!.message #refers to the same exception object as e\n raise #raise the error again\n false\nend",
"title": ""
},
{
"docid": "f487c8c608a0085b5076b2304c73fc90",
"score": "0.5734361",
"text": "def email_error (msg, dns_response)\n puts msg\n puts dns_response\n puts \"=================\"\nend",
"title": ""
},
{
"docid": "34c265bcf322b31754ed542353045e51",
"score": "0.5723612",
"text": "def test_rescues_errors\n app = TestApp.new(LogErrors) do |env|\n raise 'Kaboom'\n end\n\n without_error do\n app.get('/')\n end\n end",
"title": ""
},
{
"docid": "8faadf2e4197c50795b52b5aa01c2ea2",
"score": "0.57201886",
"text": "def failure\n render :status => 500, :text => params[:message]\n end",
"title": ""
},
{
"docid": "e0b87f52bfe520b31026ee7c696070bf",
"score": "0.57150996",
"text": "def connectionError(ticket, hresult, message)\n 'done'\n end",
"title": ""
},
{
"docid": "e0b87f52bfe520b31026ee7c696070bf",
"score": "0.57150996",
"text": "def connectionError(ticket, hresult, message)\n 'done'\n end",
"title": ""
},
{
"docid": "7e9d3081536f26e90c7bd9743567c998",
"score": "0.5714266",
"text": "def display_error_message(ex); end",
"title": ""
},
{
"docid": "46d6f99439ab6526e281207dc17e5a88",
"score": "0.5704197",
"text": "def fail(message)\n run(\"echo #{message}; false\")\n end",
"title": ""
},
{
"docid": "543b28d9b76d4778f7e0479618e041c0",
"score": "0.5703704",
"text": "def error!(status, message)\n throw :halt, [status, { \"Content-Type\" => \"text/plain\" }, [message]]\n end",
"title": ""
},
{
"docid": "97b5b1025ddf508e9f55ce1938dfc298",
"score": "0.5703504",
"text": "def get_exception\n\t\tinput \"step\"\n\t\tout_stream = buffer_until_complete\n\t\tragex_first = /[[:space:]]+at\\s[[:alnum:]]+\\.main\\([[:alnum:]]+\\.java:\\d+\\)/m\n\t\tregex_second = /[[:space:]]+The application exited\\n*/\n\t\tregex = /#{ragex_first}#{regex_second}/\n\t\tout_stream = out_stream.sub(regex, \"\")\n\t\treturn out_stream\n\tend",
"title": ""
},
{
"docid": "e8010aa2fa64c527e13c0680e84ce6e5",
"score": "0.57024455",
"text": "def error_catch1 err_nice1\n begin\n raise err_nice1\n rescue SystemCallError, IOError, SignalException => e\n p \"I cought `raise err_nice1 # this is from arr and each` \" + e.inspect\n end\nend",
"title": ""
},
{
"docid": "d591952ff56d65a05d982d5f21a10f07",
"score": "0.56921875",
"text": "def invoke_error; end",
"title": ""
},
{
"docid": "8341c6328d332106a8ea1bf27b0b81e6",
"score": "0.56860274",
"text": "def cmd_error(m, params)\n if params.has_key? :channel\n channel = params[:channel]\n else\n channel = m.channel.to_s\n end\n\n if not @errorlog.has_key? channel\n m.reply 'no errors logged'\n return\n end\n\n h = 'Errors in %s:' % [channel]\n (1..3).each do |i|\n obj = @errorlog[channel][i * -1]\n break if not obj\n time = obj[:time]\n error = obj[:error]\n\n h << ' *%d* - %s ' % [i, time.strftime('%d-%m-%Y %H:%M')]\n if error.class == RemoteError\n h << '(%s) %s' % [error.url, error.error.message]\n else\n h << '%s' % [error.message]\n end\n end\n m.reply colorize(h)\n end",
"title": ""
},
{
"docid": "94ec705fec706116f6734437fb6dcfdf",
"score": "0.56859404",
"text": "def failure\n @error_msg = request.params['message']\n puts @error_msg\n end",
"title": ""
},
{
"docid": "59ff17ea4c71483f86dfaf448daaded6",
"score": "0.568264",
"text": "def test_handles_error\n app = TestApp.new(LogErrors) do |env|\n raise 'Kaboom'\n end\n\n response = without_error do\n app.get('/')\n end\n\n assert_equal 500, response.status\n assert_equal 'text/plain', response.content_type\n assert_equal 'Internal Server Error', response.body\n end",
"title": ""
},
{
"docid": "397d707f436d17a6fbba1b8980bc6045",
"score": "0.56823",
"text": "def test_logs_errors_to_stderr\n app = TestApp.new(LogErrors) do |env|\n raise 'Kaboom'\n end\n\n captured_errs = StringIO.new\n without_error(captured_errs) do\n app.get('/')\n end\n\n assert_match /ERROR -- : Kaboom/, captured_errs.string\n end",
"title": ""
},
{
"docid": "a8e70e3a3a995b7183e85e3df5f8fd80",
"score": "0.5680889",
"text": "def err(msg)\n\t\terror(msg)\n\tend",
"title": ""
},
{
"docid": "a8e70e3a3a995b7183e85e3df5f8fd80",
"score": "0.5680889",
"text": "def err(msg)\n\t\terror(msg)\n\tend",
"title": ""
},
{
"docid": "6ed08716d2c8f11266d278c555453b8a",
"score": "0.5678306",
"text": "def err err, status = 1\n\terr_type = if err.is_a? Error then err.class.name else 'Error' end\n\terr_msg = err.message || err\n\n\tputs \"BlackWidow: - #{err.type} #{err_msg}\"\n\texit status\nend",
"title": ""
},
{
"docid": "7f0376fbe2f738ec1a6f55ecc116e6bb",
"score": "0.56778765",
"text": "def enqueue_error=(_arg0); end",
"title": ""
},
{
"docid": "33cb725c78d997115b4cd22cacceea0d",
"score": "0.5672934",
"text": "def inner_error; end",
"title": ""
},
{
"docid": "33cb725c78d997115b4cd22cacceea0d",
"score": "0.5672934",
"text": "def inner_error; end",
"title": ""
},
{
"docid": "2d5e995374f5d36783d4ea8f356060d1",
"score": "0.56727785",
"text": "def jabber_send( stuff )\n retries = 5\n\n begin\n $jabber_component.send(stuff)\n rescue Exception => e\n if retries > 0\n $log.error( \"Couldn't send to jabber due to error: \" )\n $log.error( e )\n $log.error( \"Jabber stanza we couldn't send: : #{YAML::dump(stuff)}\\n\" )\n $log.error( \"Retrying jabber send gently, #{retries}.\" )\n retries -= 1\n sleep 1\n retry\n else\n $log.error( \"Couldn't send to jabber due to error: \" )\n $log.error( e )\n $log.error( \"Jabber stanza we couldn't send: : #{YAML::dump(stuff)}\\n\" )\n $log.error( \"Trying to recover jabber send forcefully\" )\n send_email( \"Arson Error\", \"Couldn't send to jabber\" )\n jabber_reset\n end\n end\nend",
"title": ""
}
] |
cf2ac6a391cd622e10f7a977d7c7fc26
|
TODO: should this be abstracted?
|
[
{
"docid": "e31255b089d6e4ef4e1fa4f18feec9bf",
"score": "0.0",
"text": "def height\n case target\n when :editable then height_for_editable_target\n when :cc, :kiddom, :qti, :schoology then image_height\n end\n end",
"title": ""
}
] |
[
{
"docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1",
"score": "0.7562533",
"text": "def private; end",
"title": ""
},
{
"docid": "d8ae3e2b236950074c4632d180274b8a",
"score": "0.64998645",
"text": "def specie; end",
"title": ""
},
{
"docid": "d8ae3e2b236950074c4632d180274b8a",
"score": "0.64998645",
"text": "def specie; end",
"title": ""
},
{
"docid": "d8ae3e2b236950074c4632d180274b8a",
"score": "0.64998645",
"text": "def specie; end",
"title": ""
},
{
"docid": "d8ae3e2b236950074c4632d180274b8a",
"score": "0.64998645",
"text": "def specie; end",
"title": ""
},
{
"docid": "3660c5f35373aec34a5a7b0869a4a8bd",
"score": "0.62798434",
"text": "def implementation; end",
"title": ""
},
{
"docid": "3660c5f35373aec34a5a7b0869a4a8bd",
"score": "0.62798434",
"text": "def implementation; end",
"title": ""
},
{
"docid": "0b8b7b9666e4ed32bfd448198778e4e9",
"score": "0.6235033",
"text": "def probers; end",
"title": ""
},
{
"docid": "65ffca17e416f77c52ce148aeafbd826",
"score": "0.60538816",
"text": "def schubert; end",
"title": ""
},
{
"docid": "6a6ed5368f43a25fb9264e65117fa7d1",
"score": "0.59019166",
"text": "def internal; end",
"title": ""
},
{
"docid": "cf2231631bc862eb0c98d89194d62a88",
"score": "0.5893029",
"text": "def identify; end",
"title": ""
},
{
"docid": "a02f7382c73eef08b14f38d122f7bdb9",
"score": "0.58844197",
"text": "def custom; end",
"title": ""
},
{
"docid": "a02f7382c73eef08b14f38d122f7bdb9",
"score": "0.58844197",
"text": "def custom; end",
"title": ""
},
{
"docid": "3103349d09f884a9193b8c4ac184a666",
"score": "0.5859796",
"text": "def wrapper; end",
"title": ""
},
{
"docid": "f1736df8e6642c2eeb78e4b30e5cf678",
"score": "0.5765333",
"text": "def from; end",
"title": ""
},
{
"docid": "f1736df8e6642c2eeb78e4b30e5cf678",
"score": "0.5765333",
"text": "def from; end",
"title": ""
},
{
"docid": "f1736df8e6642c2eeb78e4b30e5cf678",
"score": "0.5765333",
"text": "def from; end",
"title": ""
},
{
"docid": "f1736df8e6642c2eeb78e4b30e5cf678",
"score": "0.5765333",
"text": "def from; end",
"title": ""
},
{
"docid": "2d8d9f0527a44cd0febc5d6cbb3a22f2",
"score": "0.57241684",
"text": "def weber; end",
"title": ""
},
{
"docid": "991b6f12a63ef51664b84eb729f67eed",
"score": "0.5698948",
"text": "def formation; end",
"title": ""
},
{
"docid": "40ad11ae52949cc12141dcd7bf3f555c",
"score": "0.56773555",
"text": "def implemented_in; end",
"title": ""
},
{
"docid": "7ff2011fa3dc45585a9272310eafb765",
"score": "0.5669659",
"text": "def isolated; end",
"title": ""
},
{
"docid": "7ff2011fa3dc45585a9272310eafb765",
"score": "0.5669659",
"text": "def isolated; end",
"title": ""
},
{
"docid": "2dbabd0eeb642c38aad852e40fc6aca7",
"score": "0.5663278",
"text": "def operations; end",
"title": ""
},
{
"docid": "2dbabd0eeb642c38aad852e40fc6aca7",
"score": "0.5663278",
"text": "def operations; end",
"title": ""
},
{
"docid": "2cc9969eb7789e4fe75844b6f57cb6b4",
"score": "0.5639704",
"text": "def refutal()\n end",
"title": ""
},
{
"docid": "06b6203baf3c9311f502228839c5ab4e",
"score": "0.5626896",
"text": "def intensifier; end",
"title": ""
},
{
"docid": "005e6fc140cba1f79535dcb415d4bcd9",
"score": "0.5617537",
"text": "def strategy; end",
"title": ""
},
{
"docid": "a7e46056aae02404670c78192ffb8f3f",
"score": "0.5591391",
"text": "def original_result; end",
"title": ""
},
{
"docid": "51cbc664905c5759f5e6775045d2aad7",
"score": "0.5587921",
"text": "def next() end",
"title": ""
},
{
"docid": "51cbc664905c5759f5e6775045d2aad7",
"score": "0.5587921",
"text": "def next() end",
"title": ""
},
{
"docid": "e6431ff47476c9014fb64198d5853e1e",
"score": "0.5586273",
"text": "def overrides; end",
"title": ""
},
{
"docid": "d88aeca0eb7d8aa34789deeabc5063cf",
"score": "0.5585842",
"text": "def offences_by; end",
"title": ""
},
{
"docid": "bc658f9936671408e02baa884ac86390",
"score": "0.5564185",
"text": "def anchored; end",
"title": ""
},
{
"docid": "0a39799e76643367f1b6bfac65569895",
"score": "0.5562984",
"text": "def used?; end",
"title": ""
},
{
"docid": "8742865b78eb755e40bb1bff22199433",
"score": "0.5550599",
"text": "def internship_passed; end",
"title": ""
},
{
"docid": "4ea6f5c11a3bc16e2394d273e748b292",
"score": "0.55465424",
"text": "def internal?; end",
"title": ""
},
{
"docid": "a606ff314b37ba47be08b757ff538b5e",
"score": "0.5543947",
"text": "def processor; end",
"title": ""
},
{
"docid": "4755d31a6608e0430dd90f7323468cc5",
"score": "0.553445",
"text": "def reflector; end",
"title": ""
},
{
"docid": "4755d31a6608e0430dd90f7323468cc5",
"score": "0.553445",
"text": "def reflector; end",
"title": ""
},
{
"docid": "0225a9f23a0fa436bcdab339adc872dd",
"score": "0.55119884",
"text": "def same; end",
"title": ""
},
{
"docid": "ad244bd0c45d5d9274f7612fa6fee986",
"score": "0.5507216",
"text": "def suivre; end",
"title": ""
},
{
"docid": "ccfe4044a5371ef1ee52c0eaecd344fc",
"score": "0.549787",
"text": "def called_from; end",
"title": ""
},
{
"docid": "ccfe4044a5371ef1ee52c0eaecd344fc",
"score": "0.549787",
"text": "def called_from; end",
"title": ""
},
{
"docid": "701359444c3bc529044a50b60481e991",
"score": "0.54785484",
"text": "def reflection; end",
"title": ""
},
{
"docid": "701359444c3bc529044a50b60481e991",
"score": "0.54785484",
"text": "def reflection; end",
"title": ""
},
{
"docid": "072514f3348fe62556dcdfd4b06e3d08",
"score": "0.5474569",
"text": "def spec; end",
"title": ""
},
{
"docid": "072514f3348fe62556dcdfd4b06e3d08",
"score": "0.5474569",
"text": "def spec; end",
"title": ""
},
{
"docid": "dd68931a1a7f77eb4fd41ce35988a9bb",
"score": "0.54726183",
"text": "def returns; end",
"title": ""
},
{
"docid": "c4dc12fd5b8e618db2763499bee57eb9",
"score": "0.54643774",
"text": "def abstract?; end",
"title": ""
},
{
"docid": "cdd16ea92eae0350ca313fc870e10526",
"score": "0.5455013",
"text": "def who_we_are\r\n end",
"title": ""
},
{
"docid": "5ad7e5c7a147626a2b0a2c5956411be5",
"score": "0.5450792",
"text": "def r; end",
"title": ""
},
{
"docid": "5ad7e5c7a147626a2b0a2c5956411be5",
"score": "0.5450792",
"text": "def r; end",
"title": ""
},
{
"docid": "4a8a45e636a05760a8e8c55f7aa1c766",
"score": "0.5442915",
"text": "def terpene; end",
"title": ""
},
{
"docid": "bd395ef5570ec94ad67ca3120a943fca",
"score": "0.54426706",
"text": "def operation; end",
"title": ""
},
{
"docid": "a29c5ce532d6df480df4217790bc5fc7",
"score": "0.54422736",
"text": "def extra; end",
"title": ""
},
{
"docid": "89ea7ca58a6f0c384701f7c5fe348f26",
"score": "0.5441405",
"text": "def base; self; end",
"title": ""
},
{
"docid": "14187174b07e4c51e8d38b1dd3593d4a",
"score": "0.543923",
"text": "def macro; raise NotImplementedError; end",
"title": ""
},
{
"docid": "14187174b07e4c51e8d38b1dd3593d4a",
"score": "0.543923",
"text": "def macro; raise NotImplementedError; end",
"title": ""
},
{
"docid": "14187174b07e4c51e8d38b1dd3593d4a",
"score": "0.543923",
"text": "def macro; raise NotImplementedError; end",
"title": ""
},
{
"docid": "b3d7c178b277afaefb1b9648335941e7",
"score": "0.5425377",
"text": "def loc; end",
"title": ""
},
{
"docid": "b3d7c178b277afaefb1b9648335941e7",
"score": "0.5425377",
"text": "def loc; end",
"title": ""
},
{
"docid": "b3d7c178b277afaefb1b9648335941e7",
"score": "0.5425377",
"text": "def loc; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.54222596",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.54222596",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.54222596",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.54222596",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.54222596",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.54222596",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.54222596",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.54222596",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.54222596",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.54222596",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.54222596",
"text": "def initialize; end",
"title": ""
},
{
"docid": "22eca42bc8ffb4cb933fefb36966d859",
"score": "0.54193145",
"text": "def call; end",
"title": ""
},
{
"docid": "22eca42bc8ffb4cb933fefb36966d859",
"score": "0.54193145",
"text": "def call; end",
"title": ""
},
{
"docid": "22eca42bc8ffb4cb933fefb36966d859",
"score": "0.54193145",
"text": "def call; end",
"title": ""
},
{
"docid": "22eca42bc8ffb4cb933fefb36966d859",
"score": "0.54193145",
"text": "def call; end",
"title": ""
},
{
"docid": "22eca42bc8ffb4cb933fefb36966d859",
"score": "0.54193145",
"text": "def call; end",
"title": ""
},
{
"docid": "22eca42bc8ffb4cb933fefb36966d859",
"score": "0.54193145",
"text": "def call; end",
"title": ""
},
{
"docid": "22eca42bc8ffb4cb933fefb36966d859",
"score": "0.54193145",
"text": "def call; end",
"title": ""
},
{
"docid": "22eca42bc8ffb4cb933fefb36966d859",
"score": "0.54193145",
"text": "def call; end",
"title": ""
},
{
"docid": "126c2c552b724e98ef167fa2195be768",
"score": "0.5410356",
"text": "def overload; end",
"title": ""
},
{
"docid": "9d841b89340438a2d53048b8b0959e75",
"score": "0.5392982",
"text": "def sitemaps; end",
"title": ""
},
{
"docid": "8235ebf7058af650a1d4fa0d7e5d7c56",
"score": "0.5385512",
"text": "def executor; end",
"title": ""
},
{
"docid": "8235ebf7058af650a1d4fa0d7e5d7c56",
"score": "0.5385512",
"text": "def executor; end",
"title": ""
},
{
"docid": "8235ebf7058af650a1d4fa0d7e5d7c56",
"score": "0.5385512",
"text": "def executor; end",
"title": ""
},
{
"docid": "5cf2cba0ee7f9825b63b087af5363b37",
"score": "0.53714716",
"text": "def init; end",
"title": ""
},
{
"docid": "5cf2cba0ee7f9825b63b087af5363b37",
"score": "0.53714716",
"text": "def init; end",
"title": ""
},
{
"docid": "5cf2cba0ee7f9825b63b087af5363b37",
"score": "0.53714716",
"text": "def init; end",
"title": ""
},
{
"docid": "5cf2cba0ee7f9825b63b087af5363b37",
"score": "0.53714716",
"text": "def init; end",
"title": ""
},
{
"docid": "4e7f63d2e8327143b97af38c6fce7a24",
"score": "0.5368993",
"text": "def original; end",
"title": ""
},
{
"docid": "c918c608568a07ccb7942829faf6d0ff",
"score": "0.5367541",
"text": "def result; end",
"title": ""
},
{
"docid": "c918c608568a07ccb7942829faf6d0ff",
"score": "0.5367541",
"text": "def result; end",
"title": ""
},
{
"docid": "c918c608568a07ccb7942829faf6d0ff",
"score": "0.5367541",
"text": "def result; end",
"title": ""
},
{
"docid": "c918c608568a07ccb7942829faf6d0ff",
"score": "0.5367541",
"text": "def result; end",
"title": ""
},
{
"docid": "c918c608568a07ccb7942829faf6d0ff",
"score": "0.5367541",
"text": "def result; end",
"title": ""
},
{
"docid": "c918c608568a07ccb7942829faf6d0ff",
"score": "0.5367541",
"text": "def result; end",
"title": ""
},
{
"docid": "c918c608568a07ccb7942829faf6d0ff",
"score": "0.5367541",
"text": "def result; end",
"title": ""
},
{
"docid": "c918c608568a07ccb7942829faf6d0ff",
"score": "0.5367541",
"text": "def result; end",
"title": ""
},
{
"docid": "30db4e5d165a6098d1aeb8f8dd7b66e8",
"score": "0.5365139",
"text": "def initialize() end",
"title": ""
}
] |
b33a93dac146ecafcd7bec3056559f59
|
secret_key is used like any other property by devise. The getter initializes the secret key entry in the registrations form.
|
[
{
"docid": "202e38c716c0e6d51f8693ae9da9cfac",
"score": "0.74037915",
"text": "def secret_key\n \"\"\n end",
"title": ""
}
] |
[
{
"docid": "9ae404efa5f5cdaaa3c5f50dfb570d5a",
"score": "0.7523233",
"text": "def secret_key; end",
"title": ""
},
{
"docid": "449f94d060363c95a66934c5b451be51",
"score": "0.74140817",
"text": "def secret_key\n credentials['secret_key']\n end",
"title": ""
},
{
"docid": "449f94d060363c95a66934c5b451be51",
"score": "0.74140817",
"text": "def secret_key\n credentials['secret_key']\n end",
"title": ""
},
{
"docid": "516fad58ebecbeca857cfd3b5154e2a4",
"score": "0.72115797",
"text": "def secret_key\n ActionController::Base.session_options[:secret]\n end",
"title": ""
},
{
"docid": "f962c1f79dfec21d507343ebc70d515c",
"score": "0.7157509",
"text": "def secret\n secret_value or raise 'secret is only available for new access keys'\n end",
"title": ""
},
{
"docid": "8594a02db8045e435cce4e000bf1f9db",
"score": "0.7157429",
"text": "def key_generator\n self.class.rails_key_generator(secret_key_base)\n end",
"title": ""
},
{
"docid": "b5c6ca84e5e0bba33ad1ff8d50e7afa9",
"score": "0.7128596",
"text": "def secret\n self\n end",
"title": ""
},
{
"docid": "61143ba63517d960b74c706a2d147f82",
"score": "0.71066225",
"text": "def secret_key\n jwt_config['secret_key']\n end",
"title": ""
},
{
"docid": "6ba999e90a22bb4d7b23324ec98c8af4",
"score": "0.707539",
"text": "def secret\n @secret || ''\n end",
"title": ""
},
{
"docid": "7885e49d253a4e3c8560d3e977c4889b",
"score": "0.69758207",
"text": "def secret_key\n ENV['RANCHER_SECRET']\n end",
"title": ""
},
{
"docid": "80c778e5f6de247456cf94b41e2c6e3e",
"score": "0.69606185",
"text": "def secret\n @secret or raise MissingSecret\n end",
"title": ""
},
{
"docid": "f1035487fbc29fbd867a7130f4176962",
"score": "0.69574803",
"text": "def set_secret_key\n @secret_key = SecretKey.find(params[:id])\n end",
"title": ""
},
{
"docid": "a989092e855ecd97118f51ab483f188f",
"score": "0.6943446",
"text": "def secret\n super\n end",
"title": ""
},
{
"docid": "01c18f1770bd57b0bb9594bf9e0f95cd",
"score": "0.693405",
"text": "def secret_key_base; end",
"title": ""
},
{
"docid": "01c18f1770bd57b0bb9594bf9e0f95cd",
"score": "0.693405",
"text": "def secret_key_base; end",
"title": ""
},
{
"docid": "01c18f1770bd57b0bb9594bf9e0f95cd",
"score": "0.693405",
"text": "def secret_key_base; end",
"title": ""
},
{
"docid": "01c18f1770bd57b0bb9594bf9e0f95cd",
"score": "0.693405",
"text": "def secret_key_base; end",
"title": ""
},
{
"docid": "1fc692a2fdb4da7c23bc85a958adaafe",
"score": "0.69125205",
"text": "def secret\n @secret ||= (\n defined?(Rails) && Rails.application.credentials&.dig(:secret_key_base)\n ) || raise(StandardError, SECRET_MISSING_ERROR)\n end",
"title": ""
},
{
"docid": "c2c0217e8aae712280061b1849e63f52",
"score": "0.6753822",
"text": "def secret_key=(secret_key)\n actual_key = ENV.fetch(\"SECRET_KEY\", User.secret_key_default)\n self.is_student = !(secret_key == actual_key)\n end",
"title": ""
},
{
"docid": "1bd2e73346dbd84a3e089708f39a8c33",
"score": "0.6710626",
"text": "def secret\n decrypt_secret\n end",
"title": ""
},
{
"docid": "1bd2e73346dbd84a3e089708f39a8c33",
"score": "0.6710626",
"text": "def secret\n decrypt_secret\n end",
"title": ""
},
{
"docid": "2615b6dcde7f01d56530486931dbbe7a",
"score": "0.668295",
"text": "def token_secret\n config_method_not_implemented\n end",
"title": ""
},
{
"docid": "6465a9950d8aa98520d56443bd24401f",
"score": "0.66757345",
"text": "def secret\n # EDITOR='code --wait' rails credentials:edit\n # Rails.application.credentials.jwt_secret\n # Use environmental variables for Heroku\n ENV['jwt_secret']\n end",
"title": ""
},
{
"docid": "cee8b4a3aa6a828cd91d66058dd019c1",
"score": "0.6645949",
"text": "def secret_key\n configatron.ramazon.secret_key\n end",
"title": ""
},
{
"docid": "0ab23310907265b8c928f440ef27c26a",
"score": "0.66427404",
"text": "def secret\n base64_decoded_jwt_secret || client_options.secret\n end",
"title": ""
},
{
"docid": "6436698feef014558a2ef9a23a43232c",
"score": "0.6607805",
"text": "def generate_secret\n self.password = self.class.generate_secret\n end",
"title": ""
},
{
"docid": "3d27754629b7151c954d98232835b344",
"score": "0.6565799",
"text": "def secret_key=(key)\n configatron.ramazon.secret_key = key\n end",
"title": ""
},
{
"docid": "f0200a4e80f6660c34b610408f5cd506",
"score": "0.65382093",
"text": "def get_secret(key)\n secret node['openstack']['secret']['secrets_data_bag'], key\n end",
"title": ""
},
{
"docid": "535467b9b9bd93b7265b7b3ebc1eaecb",
"score": "0.6529125",
"text": "def after_create\n self.secret_key = secret_keygen\n self.save!\n end",
"title": ""
},
{
"docid": "84d20fccc0ea8847564ef68f9208fe66",
"score": "0.6521515",
"text": "def consumer_secret\n config_method_not_implemented\n end",
"title": ""
},
{
"docid": "5cdae6682971c8d3f6a0c0683e3feacc",
"score": "0.6508826",
"text": "def secret\n # ````'badbreathbuffalo'\n\n # Hide in React Auth pt2 1:20:00 \n # ```ENV['jwt_secret']\n # Export in ~/.bash_profile\n # export jwt_secret = 'badbreathbuffalo'\n\n # OR\n\n # $ EDITOR='code --wait' rails credentials:edit\n # Add to the bottom of the file:\n # `jwt_secret: 'badbreathbuffalo'`\n # Save and close the file\n Rails.application.credentials.jwt_secret\n\n # Heroku Config Vars\n # ```ENV['jwt_secret']\n end",
"title": ""
},
{
"docid": "2fe85a6d9a57e7fcd16c37b85b6d2815",
"score": "0.65066326",
"text": "def secret_access_key\n return Brevidy::Application::S3_SECRET_ACCESS_KEY\n end",
"title": ""
},
{
"docid": "076574d1caffd39b1b250145d5d2740f",
"score": "0.6479779",
"text": "def app_secret\n @app_secret ||= if self.encoding_app_secret.present?\n CryptService.decrypt(self.encoding_app_secret)\n end\n end",
"title": ""
},
{
"docid": "cd9a612ebc7ffbb575a82a8a65c17770",
"score": "0.6449764",
"text": "def secret\n @secret ||= begin\n secret = load_secret\n unless secret\n ui.fatal('A secret or secret_file must be specified')\n show_usage\n exit 1\n end\n secret\n end\n end",
"title": ""
},
{
"docid": "8e7d4b4c621816b4a15a4ce5ded25591",
"score": "0.64061064",
"text": "def secret\n (@service.connector? and @service.secret == nil) ? @this.secret : @service.secret\n end",
"title": ""
},
{
"docid": "093c597cf82c874fbcdce1924fad8bd8",
"score": "0.6344018",
"text": "def secret_generate\n Secret.generate\n end",
"title": ""
},
{
"docid": "33bf870e5f35307f0dec63d7586aff56",
"score": "0.62769747",
"text": "def getsecretword\r\n\t\t return @secretword\r\n\t\t end",
"title": ""
},
{
"docid": "4c5509a0f4440c994905e2d7a5e17ba3",
"score": "0.625193",
"text": "def private_key\n @key\n end",
"title": ""
},
{
"docid": "c5607583c8ffb4d2c266903e65a225d3",
"score": "0.6248799",
"text": "def secret_key\n encode_tz(:edsk, 32)\n end",
"title": ""
},
{
"docid": "b0dcf69e24da2760722195ab84ef7cfa",
"score": "0.6236605",
"text": "def value\n if show_secret\n secret\n else\n Digest::SHA1.hexdigest secret\n end\n end",
"title": ""
},
{
"docid": "aa4fe79826d93c1cfc4dc4f4e5db71dc",
"score": "0.62339616",
"text": "def app_config_key\n return @app_config_key\n end",
"title": ""
},
{
"docid": "1f96c1b56c5776ebe1d79272c5ccc7bc",
"score": "0.62253606",
"text": "def app_jwt_token_secret\n Rails.application.secrets.app_jwt_token_secret\n end",
"title": ""
},
{
"docid": "ba1701f488ed4feb09ceaa5b6dc75282",
"score": "0.61986697",
"text": "def facebook_secret_key(value=nil)\n rw_config(:facebook_secret_key, value, nil)\n end",
"title": ""
},
{
"docid": "ba1701f488ed4feb09ceaa5b6dc75282",
"score": "0.61986697",
"text": "def facebook_secret_key(value=nil)\n rw_config(:facebook_secret_key, value, nil)\n end",
"title": ""
},
{
"docid": "ba1701f488ed4feb09ceaa5b6dc75282",
"score": "0.61986697",
"text": "def facebook_secret_key(value=nil)\n rw_config(:facebook_secret_key, value, nil)\n end",
"title": ""
},
{
"docid": "61d6e14e684adeed0f206c04ab028f6b",
"score": "0.6194808",
"text": "def get_secret(params)\n return @api_secret\n end",
"title": ""
},
{
"docid": "a7f39681a491924772afe311349940e3",
"score": "0.61801755",
"text": "def index\n @secret_keys = SecretKey.all\n end",
"title": ""
},
{
"docid": "26248821006d8a9af3339a3404a57136",
"score": "0.6167884",
"text": "def gen_secret\n u = UUID.new\n d = Digest::SHA256.new << u.generate\n self.secret = d.to_s\n end",
"title": ""
},
{
"docid": "2595afd89797b322a51e112792763dd7",
"score": "0.6159513",
"text": "def secret\n query[\"client_secret\"]\n end",
"title": ""
},
{
"docid": "8a3f07765d594deb2d1440025309d322",
"score": "0.61442715",
"text": "def swf_secret_access_key\n return Brevidy::Application::S3_SECRET_ACCESS_KEY\n end",
"title": ""
},
{
"docid": "6836fac281d59c91908dae98cbf95b62",
"score": "0.612664",
"text": "def client_secret\n @client_secret\n end",
"title": ""
},
{
"docid": "e0c128e9a4a06e2d28e00775e6b5d3a3",
"score": "0.61226827",
"text": "def secret\n 's3cr37'\n end",
"title": ""
},
{
"docid": "cad6173dbc168e730216a4fdbe9bbf42",
"score": "0.61014146",
"text": "def initialize(key, secret)\n super()\n self.key = key\n self.secret = secret\n end",
"title": ""
},
{
"docid": "f6a30becd073548a1e3f2dd7be9583b9",
"score": "0.60996604",
"text": "def aws_secret_access_key \n if @aws_secret_access_key\n return @aws_secret_access_key\n elsif !ENV.has_key?('AWS_SECRET_ACCESS_KEY')\n raise FogSettingError, \"secret access key must be set in ENV or configure block\"\n end\n @aws_secret_access_key ||= ENV['AWS_SECRET_ACCESS_KEY']\n end",
"title": ""
},
{
"docid": "b9b8f934652903673cf5d3d01f950faf",
"score": "0.60945994",
"text": "def secret(new_secret = nil)\n if !new_secret\n @secret\n else\n @secret = new_secret\n @encrypt = true if @encrypt.nil?\n end\n end",
"title": ""
},
{
"docid": "ebfe3fd7ae1d434100875227ab6b61b6",
"score": "0.6070073",
"text": "def master_user_secret\n data[:master_user_secret]\n end",
"title": ""
},
{
"docid": "ebfe3fd7ae1d434100875227ab6b61b6",
"score": "0.6070073",
"text": "def master_user_secret\n data[:master_user_secret]\n end",
"title": ""
},
{
"docid": "6790ee9b03b77cbff6c588012913bad2",
"score": "0.6066947",
"text": "def secret\n client.get(\"/user/secret\").fetch(\"result\")\n end",
"title": ""
},
{
"docid": "2177d82b1cd97f15f813712229965c0e",
"score": "0.6056934",
"text": "def set_secret\n @secret = Secret.find(params[:id])\n end",
"title": ""
},
{
"docid": "2177d82b1cd97f15f813712229965c0e",
"score": "0.6056934",
"text": "def set_secret\n @secret = Secret.find(params[:id])\n end",
"title": ""
},
{
"docid": "2177d82b1cd97f15f813712229965c0e",
"score": "0.6056934",
"text": "def set_secret\n @secret = Secret.find(params[:id])\n end",
"title": ""
},
{
"docid": "2177d82b1cd97f15f813712229965c0e",
"score": "0.6056934",
"text": "def set_secret\n @secret = Secret.find(params[:id])\n end",
"title": ""
},
{
"docid": "5fa4220c35525657872806d4fe7d71c1",
"score": "0.6052585",
"text": "def private_key\n return self.authentication.private_key\n end",
"title": ""
},
{
"docid": "5fa4220c35525657872806d4fe7d71c1",
"score": "0.6052585",
"text": "def private_key\n return self.authentication.private_key\n end",
"title": ""
},
{
"docid": "9822ab8d1f81371e02b225c881d675d3",
"score": "0.6044245",
"text": "def token_secret; config[:token_secret]; end",
"title": ""
},
{
"docid": "602bd96c57f705075d50c02dc30269b1",
"score": "0.60245526",
"text": "def access_secret\n @attributes[:access_secret] || client.secret\n end",
"title": ""
},
{
"docid": "602bd96c57f705075d50c02dc30269b1",
"score": "0.60245526",
"text": "def access_secret\n @attributes[:access_secret] || client.secret\n end",
"title": ""
},
{
"docid": "602bd96c57f705075d50c02dc30269b1",
"score": "0.60245526",
"text": "def access_secret\n @attributes[:access_secret] || client.secret\n end",
"title": ""
},
{
"docid": "9300e97d940f6cbc929c672febc70e9b",
"score": "0.6016367",
"text": "def with_secret_key_store(secret_key_store)\n @secret_key_store = secret_key_store\n self\n end",
"title": ""
},
{
"docid": "efba61c7648cd0d3c2afe02b75baa1cb",
"score": "0.6015316",
"text": "def public_key\n return self.authentication.public_key\n end",
"title": ""
},
{
"docid": "efba61c7648cd0d3c2afe02b75baa1cb",
"score": "0.6015316",
"text": "def public_key\n return self.authentication.public_key\n end",
"title": ""
},
{
"docid": "a9596eb278e3d73482a7f27315290341",
"score": "0.600985",
"text": "def api_secret_field(value = nil)\n rw_config(:api_secret_field, value, first_column_to_exist(nil, :api_secret, :application_secret))\n end",
"title": ""
},
{
"docid": "3fa4378d1ce75b3e032a97da30af8571",
"score": "0.5990577",
"text": "def generate_key\n self.key ||= SecureRandom.urlsafe_base64 32\n end",
"title": ""
},
{
"docid": "f5d919fba2dca7531fe3bb54e8eb575a",
"score": "0.5985906",
"text": "def generate_key\n self.key = SecureRandom.hex(KEY_LENGTH / 2)\n end",
"title": ""
},
{
"docid": "a7d7e72daa82a63ccadaba70275ce862",
"score": "0.59813094",
"text": "def secret_key_base=(_arg0); end",
"title": ""
},
{
"docid": "a7d7e72daa82a63ccadaba70275ce862",
"score": "0.59813094",
"text": "def secret_key_base=(_arg0); end",
"title": ""
},
{
"docid": "3038978134b207870e030c4e9b4a2678",
"score": "0.5967",
"text": "def secretkey(apikey)\n get 'secretkey', {apikey: apikey} { |x| x['secretkey'] }\n end",
"title": ""
},
{
"docid": "2f3fe5b5cbdd28454a3e27ca123b69dd",
"score": "0.5944827",
"text": "def set_secret\n @secret = Secret.find(params[:id])\n end",
"title": ""
},
{
"docid": "e7057d32ec53b59bcaff2291287ec3e9",
"score": "0.5941855",
"text": "def generate_secret\r\n ActiveSupport::SecureRandom.hex(64)\r\n end",
"title": ""
},
{
"docid": "a9d1ffec521636d3817f74db549fdb5b",
"score": "0.59363776",
"text": "def secret_key_params\n params.require(:secret_key).permit(:secretKey)\n end",
"title": ""
},
{
"docid": "59db312058822bfaed8f6852bd784e37",
"score": "0.5926469",
"text": "def token_secret\n ENV['DESK_TOKEN_SECRET']\n end",
"title": ""
},
{
"docid": "f33aee689df2589bbec09be642eaa543",
"score": "0.59243244",
"text": "def secret_type\n return @secret_type\n end",
"title": ""
},
{
"docid": "155c5de87ef882fc3870c67372cf5c66",
"score": "0.5921457",
"text": "def consumer_secret\n ENV[CONSUMER_SECRET_NAME]\n end",
"title": ""
},
{
"docid": "f709c8315b360692fba41cc09f14aa1f",
"score": "0.59171504",
"text": "def secret\n \"whatamidoing\"\n end",
"title": ""
},
{
"docid": "aaf215c267e8a0797a8200c5f6a8b53e",
"score": "0.59025025",
"text": "def secret\n source.split('/')[-1].split('_')[1]\n end",
"title": ""
},
{
"docid": "78ad0a6af6d798465ac95f2a47f2cc80",
"score": "0.58971095",
"text": "def encrypt_secret\n return if @secret.to_s.empty?\n self.crypted_secret = Password.create(@secret)\n end",
"title": ""
},
{
"docid": "1a72bb2f1680a5c81b92282f5eb33610",
"score": "0.5893319",
"text": "def private_key\n @priv\n end",
"title": ""
},
{
"docid": "be3bfb078f7bc170f8d480fdb61505f9",
"score": "0.58712405",
"text": "def app_config_key_value\n return @app_config_key_value\n end",
"title": ""
},
{
"docid": "b49ec74fcc326170b934905df73af040",
"score": "0.5863917",
"text": "def shared_secret\n\t\t\tRails.configuration.shopify_secret\n\t\tend",
"title": ""
},
{
"docid": "c01066a5bb136282c9d5895288a9f474",
"score": "0.5862134",
"text": "def get_private_key\n return @private_key\n end",
"title": ""
},
{
"docid": "566d5744136a4cd81a73e9572e87bbe5",
"score": "0.5855187",
"text": "def get_secret_key\n secret_key = ''\n return '' unless File.file? SECRET_KEY_FILE\n open(SECRET_KEY_FILE) do |file|\n file.each do |line|\n if line.include? 'TKTAuthSecret'\n secret_key = line.gsub('TKTAuthSecret', '').strip.gsub(\"\\\"\", '')\n break\n end\n end\n end\n secret_key\n end",
"title": ""
},
{
"docid": "5a89696799d197c476e8002e47390459",
"score": "0.5852999",
"text": "def token_secret; end",
"title": ""
},
{
"docid": "5a89696799d197c476e8002e47390459",
"score": "0.5852999",
"text": "def token_secret; end",
"title": ""
},
{
"docid": "5a89696799d197c476e8002e47390459",
"score": "0.5852999",
"text": "def token_secret; end",
"title": ""
},
{
"docid": "e11eb69276820cd88f746953159c0359",
"score": "0.5851738",
"text": "def client_secret; end",
"title": ""
},
{
"docid": "5d496cac4ea9ae57bd6125f5f98535ce",
"score": "0.5835785",
"text": "def consumer_secret; config[:consumer_secret]; end",
"title": ""
},
{
"docid": "f2990d6564f2c3708ce68d933fcba532",
"score": "0.5834126",
"text": "def private_key; end",
"title": ""
},
{
"docid": "f2990d6564f2c3708ce68d933fcba532",
"score": "0.5834126",
"text": "def private_key; end",
"title": ""
},
{
"docid": "ff34e50a96670953a8711334de76939c",
"score": "0.5830523",
"text": "def client_secret\n base = bb.hex\n # base += BIG_PRIME_N * @multiplier\n base -= modpow(GENERATOR, @user.private_key) * multiplier\n base = base % BIG_PRIME_N\n modpow(base, @user.private_key * u.hex + @a)\n end",
"title": ""
},
{
"docid": "97099445980781a46e0fbf25b0da9f9a",
"score": "0.5823479",
"text": "def secret_strategy\n ::Doorkeeper.config.application_secret_strategy\n end",
"title": ""
}
] |
9244c58c8332d600b02348905df054cd
|
Check whether the user has liked a post.
|
[
{
"docid": "9fe3a798260ef16da0cdc3f2b6b91d69",
"score": "0.71613",
"text": "def liked?(likeable)\n if likeable.likes.loaded?\n if self.like_for(likeable)\n return true\n else\n return false\n end\n else\n Like.exists?(user_id: self.id, likeable_type: likeable.class.base_class.to_s, likeable_id: likeable.id)\n end\n end",
"title": ""
}
] |
[
{
"docid": "a0f7b01c4da7ea68c1281b5f10eaddd4",
"score": "0.86522037",
"text": "def liked?(post)\n logged_in? &&\n current_user.likes.where(post_id: post.id).any?\n end",
"title": ""
},
{
"docid": "6c301d3fbe246d5a2098a4829aa1f0dc",
"score": "0.8533018",
"text": "def liked_by_user?\n\t\tLike.where(user_id: current_user.id, post_id:\n\t \tparams[:post_id]).exists?\n\tend",
"title": ""
},
{
"docid": "923bd2b797153956f8176425f46443e1",
"score": "0.8506042",
"text": "def liked?(post_id)\n Like.where(post_id: post_id, user_id: self.id).exists?\n end",
"title": ""
},
{
"docid": "c7ac63a634f0ed4f95b43aed864bf555",
"score": "0.84489286",
"text": "def already_liked?\n Like.where(user_id: current_user.id, post_id: params[:post_id]).exists?\n end",
"title": ""
},
{
"docid": "cfd7d836a694f4bf98cf8736a655e980",
"score": "0.83298695",
"text": "def liked_post?(post)\n liked_posts.include? post\n end",
"title": ""
},
{
"docid": "4ffc0108b54a1187a6c61369368fedd4",
"score": "0.8227421",
"text": "def like?(post)\n liked_posts.include?(post)\n end",
"title": ""
},
{
"docid": "2491e86eefd74eca17b1410f4322346c",
"score": "0.81497055",
"text": "def user_can_like(user_id)\n\t\t# self makes an object of Post class and tells if a user with user_id: as passed in the function, has a like on this post(like.length == 1)\n\t\tif self.likes.where(user_id: user_id).length == 1\n\t\t\treturn false\n\t\tend\n\n\t\treturn true\n\tend",
"title": ""
},
{
"docid": "3ac925a53bf639e257b43abc4da43736",
"score": "0.8086267",
"text": "def has_liked_userpost(feed_item)\n @like = Like.where(user_id: current_user.id, userpost_id: feed_item.id).first\n [email protected]?\n end",
"title": ""
},
{
"docid": "748fd281059f750fe746ed5476089930",
"score": "0.79789317",
"text": "def post_liked?(post)\n find_like(post).any?\n end",
"title": ""
},
{
"docid": "dd1baa7d9c55d4b9e0204c0aa79a062c",
"score": "0.79167503",
"text": "def is_liked user\n \tLike.find_by(user_id: user_id, post_id: id)\n end",
"title": ""
},
{
"docid": "d5113d892865a00852570b730726bb8e",
"score": "0.7908365",
"text": "def liked_by?(user)\n likes.find_by_user_id(user.id).present?\n end",
"title": ""
},
{
"docid": "fe19c57ad131cb84dce425f921a6e13b",
"score": "0.7872683",
"text": "def liked_by?(user)\n likes_by_user(user).any?\n end",
"title": ""
},
{
"docid": "e9a392a30db0ae5421c2c0d956cd5b95",
"score": "0.78032416",
"text": "def likes?(user)\n if likes.where(user_id: user.id).any?\n return true\n else\n return false\n end\n end",
"title": ""
},
{
"docid": "5386c010feea24b3d08169c16d1a1870",
"score": "0.76930946",
"text": "def like?(post)\n self.likes.where(post_id: post.id.to_s)\n end",
"title": ""
},
{
"docid": "7eae141181b49243d80ccf713bac478c",
"score": "0.7631451",
"text": "def liked_by?(user)\n likers.exists?(user.id)\n end",
"title": ""
},
{
"docid": "ddc97307fa7286c0f6415078538f5e5a",
"score": "0.7615605",
"text": "def liked?\n liked_ids = h.current_user.liked_replies.pluck(:id)\n liked_ids.include?(self.id)\n end",
"title": ""
},
{
"docid": "455d23373b0b2b257b03658140ad40fe",
"score": "0.7534803",
"text": "def liked?(user_id)\n !StoryLike.where(story_id: self.id, user_id: user_id).empty?\n end",
"title": ""
},
{
"docid": "530c35b0823abdec358135d2f4fa01d2",
"score": "0.7454274",
"text": "def likes?(tweet)\n \ttweet.likes.where(user_id: id).any?\n end",
"title": ""
},
{
"docid": "5e40a994ae68438e8e26102d651a6935",
"score": "0.7316634",
"text": "def user_likes_list?\n Like.exists?(:user_id => current_user, :list_id => @list)\n end",
"title": ""
},
{
"docid": "92dd0b4c9314047f48739298a0abd385",
"score": "0.7236926",
"text": "def liked?(user_id)\n Like.where(user_id: user_id, dog_id: self.id).exists?\n end",
"title": ""
},
{
"docid": "51961393560d0bce43ca1a0fc9b6ceb7",
"score": "0.7206604",
"text": "def already_liked_by?(current_user)\n return false unless current_user\n self.likes.where(:user_id => current_user.id).count > 0\n end",
"title": ""
},
{
"docid": "f2e9cd35b5c85aba99a71297c8b8a693",
"score": "0.70906687",
"text": "def like\n post_id = params[:id]\n @post = Post.where(:id => post_id).first\n if current_user && @post\n if @post.is_like?(current_user.id)\n @post.unlike(current_user.id)\n render :text => \"<span class='badge badge-success'> #{@post.get_likes_count}</span> Like\" \n else\n @post.like(current_user.id)\n render :text => \"<span class='badge badge-success'> #{@post.get_likes_count}</span> UnLike\" \n end\n return\n end\n render :text => 'fail' and return\n end",
"title": ""
},
{
"docid": "d58356641e10f778fda53103b0d66ce5",
"score": "0.7066101",
"text": "def already_liked?\n Vote.where(author_id: current_user.id, comment_id:\n params[:comment_id]).exists?\n end",
"title": ""
},
{
"docid": "656d3a8b9a796a5e567ad87b9515c8c8",
"score": "0.69884706",
"text": "def like?\n response[\"like\"]\n end",
"title": ""
},
{
"docid": "3c7c3797577be1a19ad6222f0be5d107",
"score": "0.69728076",
"text": "def likes?(object)\n likes.exists?(:likeable_id => object.id, :likeable_type => object.class.to_s)\n end",
"title": ""
},
{
"docid": "647ee1b9c812304b0a89d90f42b4c69e",
"score": "0.69662195",
"text": "def liked_by? user\n not likes.reject { |like| like.created_by != user }.blank?\n end",
"title": ""
},
{
"docid": "478d13b931bff061010d4c0ab17a5c6c",
"score": "0.6931881",
"text": "def already_liked?\n Like.where(user_id: current_user.id, gosssip_id: params[:gosssip_id]).exists?\n end",
"title": ""
},
{
"docid": "f1c32e128d18c5dd34a36d9a0c62f4bf",
"score": "0.6897053",
"text": "def liked_comment?(comment)\n liked_comments.include? comment\n end",
"title": ""
},
{
"docid": "a3814736bd5d649988d8b955ef3ae882",
"score": "0.687375",
"text": "def like_status(post_id)\n post = Post.where(:id => post_id).first\n count = \"<span class='badge badge-success'> #{post.get_likes_count}  </span>\".html_safe\n post.is_like?(current_user.id) ? count+\" UnLike\" : count+\" Like\" if current_user.present?\n end",
"title": ""
},
{
"docid": "58c3d4361e9bb53fa284e06595593d2d",
"score": "0.68360746",
"text": "def check_if_liked video_id\n get(\"/likes/#{video_id}\", code:204)\n return true\n rescue VimeoMe2::RequestFailed\n return false\n end",
"title": ""
},
{
"docid": "f74c4582ad8f954a7a01b9a92ec79ab2",
"score": "0.6801041",
"text": "def hasLiked\n return @hasLiked.present? ? @hasLiked : false\n end",
"title": ""
},
{
"docid": "56a6d42278a49bc6a5c2df709e6a185c",
"score": "0.67916846",
"text": "def likable?\n if current_user\n !dog_has_owner? || dog_owner.id != current_user.id ? true : false\n else\n false\n end\n end",
"title": ""
},
{
"docid": "4c877e580639dc72ec50c0ee6963ba5b",
"score": "0.6788765",
"text": "def rated_anything?\n likes.count > 0 || dislikes.count > 0\n end",
"title": ""
},
{
"docid": "33d0dfe07ffa4f4361cf564235dc0aae",
"score": "0.67812943",
"text": "def liked_by_user?(id)\n query = self.likes.where(user_id: id).first\n return false unless query.present?\n query.id\n end",
"title": ""
},
{
"docid": "c53c86c222c550d004ef83abcecbc6d6",
"score": "0.67736953",
"text": "def rated?\n liked_by_count > 0 || disliked_by_count > 0\n end",
"title": ""
},
{
"docid": "8c42d67741738b25d67c24e11e107b1b",
"score": "0.67484933",
"text": "def upvoted?(post)\n voted_up_on? post\n end",
"title": ""
},
{
"docid": "6000f0d146bfd66b943ab348d514d0d9",
"score": "0.6710235",
"text": "def has_favourited_post?(post_id)\n Favourite.where(:post_id => post_id, :user_id => self.id).any?\n end",
"title": ""
},
{
"docid": "b1707cd669698f4d43d94e08eed996fb",
"score": "0.670521",
"text": "def liked?(obj)\n Recommendations.redis.sismember(Recommendations::Helpers::RedisKeyMapper.liked_set_for(obj.class, id), obj.id)\n end",
"title": ""
},
{
"docid": "4f30c41b5a58c8ce9cde3cb20945d642",
"score": "0.664794",
"text": "def following?(post)\n posts.include?(post)\n end",
"title": ""
},
{
"docid": "8d8be2307c4ad8074067db5e38d262b9",
"score": "0.6599518",
"text": "def likes?(obj)\n Recommendable.redis.sismember(Recommendable::Helpers::RedisKeyMapper.liked_set_for(obj.class, id), obj.id)\n end",
"title": ""
},
{
"docid": "bf8d50dae29e0c8c321cf870c2e0179d",
"score": "0.6595274",
"text": "def completed?\n user.likes_count >= self.class.config.likes_needed_for_completion\n end",
"title": ""
},
{
"docid": "8bc740d88359b3c902cf721c26b361f6",
"score": "0.6593025",
"text": "def like\n if params[:post_id]\n likeable = Comment.find(params[:id])\n what = \"Comment\"\n else\n likeable = Post.find(params[:id])\n what = \"Post\"\n end\n like = likeable.likes.where(:user_id => current_user.id).first || Like.new\n unless like.id\n like.likeable = likeable\n like.user = current_user\n like.save\n redirect_to back_page_post, flash: { :success => what + ' was liked.' }\n else\n like.destroy\n redirect_to back_page_post, flash: { :success => what + ' was unliked.' }\n end\n end",
"title": ""
},
{
"docid": "b395120714fa4c716f5e665cf2ab7b36",
"score": "0.6576404",
"text": "def like\n @topic = Topic.find(params[:topic_id])\n @post = @topic.posts.find(params[:id])\n if @post.not_liked_already?(current_user)\n @post.likes.create(user: current_user)\n redirect_to [@post.topic, @post]\n else\n @post.likes.where(user: current_user).destroy_all\n redirect_to [@post.topic, @post]\n end\n end",
"title": ""
},
{
"docid": "4d791de0a61ca185164f07b90d73c14e",
"score": "0.6519109",
"text": "def likes?(likable_object)\n Like::LIKABLES.any? do |likable_type|\n self.send( \"liked_#{ likable_type }\" ).include?( likable_object )\n end\n end",
"title": ""
},
{
"docid": "ed769a7a6c0c26831ac6edd810f08d54",
"score": "0.6510917",
"text": "def liked?(snapspot)\n self.likes.find_by(snapspot_id: snapspot.id) ? true : false\n end",
"title": ""
},
{
"docid": "5174ccfc0a21c80453c117d957d3a448",
"score": "0.6449613",
"text": "def liked?(job)\n liked_jobs.include?(job)\n end",
"title": ""
},
{
"docid": "37f9380510687eecb1a9f3c32b1bfddb",
"score": "0.6429652",
"text": "def likes?(model)\n self.likes_assoc.find(:all, conditions: {like_id: model.id}).limit(1).count > 0\n end",
"title": ""
},
{
"docid": "adbbbeb2d80ce83e773f0fc73b4d4cac",
"score": "0.64011633",
"text": "def like\n @micropost = Micropost.find(params[:postid])\n if current_user.nil?\n render text: \"no_login\"\n else\n @micropost.like(current_user.id,@micropost.user.id)\n render text: \"liked\"\n end\n \n end",
"title": ""
},
{
"docid": "82cbc21d77669d23586377f95393ca33",
"score": "0.63899714",
"text": "def liked_post(post)\n if current_user.voted_for? post\n return link_to '', unlike_post_path(post), remote: true, id: \"like_#{post.id}\", \n class: \"glyphicon glyphicon-heart liked_post_heart\"\n else\n link_to '', like_post_path(post), remote: true, id: \"like_#{post.id}\", \n class: \"glyphicon glyphicon-heart-empty\" \n end\n end",
"title": ""
},
{
"docid": "9e7cc7eaaef2b446a66b7509d4b3053f",
"score": "0.63541114",
"text": "def user_has_voted(post)\n if (current_user)\n if (post.voted_by?(current_user))\n 1\n else\n 0\n end\n else\n 2\n end\nend",
"title": ""
},
{
"docid": "a94bebe180fae123b7adacee1258ffec",
"score": "0.6327839",
"text": "def show\n @user = User.where(id: @post.user_id)[0]\n @likes = UserLike.where(post_id: @post.id)\n end",
"title": ""
},
{
"docid": "95211b976342ce3e674298c7c87174a1",
"score": "0.63265336",
"text": "def is_the_author_of_the_post(post)\n post.author_id == current_author.id\n end",
"title": ""
},
{
"docid": "cc756355487e19dee0b77e3e490ef1d5",
"score": "0.63218087",
"text": "def already_voted_by_user?(the_user)\n post_vote_array(the_user).present?\n end",
"title": ""
},
{
"docid": "0d077edff40f54fbf1b0e481cdd4b168",
"score": "0.63103163",
"text": "def likes?(object)\n verbs_of_interest = %w[like unlike]\n\n query = Activity.joins(:verb)\n .with_activity_object_id(id: object.id)\n .with_actor_id(id: guid)\n .merge(Verb.with_display_name(name: verbs_of_interest))\n\n query.count.odd?\n end",
"title": ""
},
{
"docid": "e482cf6c72764b1d51fa3c8724a6f58a",
"score": "0.6296042",
"text": "def create\n\t\tif already_liked?\n\t\t\tflash[:notice] = \"you can't like more than once\"\n\t\telse\n\t\t\t\n\t\t\t@like = @post.likes.create(:user_id => current_user.id)\n\t\tend\n\t\tredirect_to post_path(@post)\n\t\t\n\tend",
"title": ""
},
{
"docid": "4d4746d8d634c66d8a9badb9a043ca70",
"score": "0.6289799",
"text": "def like\n @postcomment.liked_by current_user\n redirect_to @urltoredirect\n end",
"title": ""
},
{
"docid": "5580043081185de637eceb43f8a25206",
"score": "0.6284205",
"text": "def liking?(song)\n likes.include?(song)\n end",
"title": ""
},
{
"docid": "1753d8e27abaee874bbf36be9e927606",
"score": "0.628049",
"text": "def like(params,userid)\r\n db = connect_non_hash()\r\n likedposts=db.execute(\"SELECT likes.postid FROM likes WHERE userid=(?)\", userid)\r\n likedposts = likedposts.flatten\r\n if likedposts.include? params[\"postid\"].to_i\r\n redirect('/cantliketwice')\r\n else\r\n db.execute(\"INSERT INTO likes(userid, postid) VALUES (?, ?)\", userid, params[\"postid\"])\r\n redirect('/posts')\r\n end\r\n end",
"title": ""
},
{
"docid": "b6e48ce8607acd25ca0970f6141a198f",
"score": "0.6277119",
"text": "def is_my_post?(userid)\n #if someone is logged in\n if @current_user\n #if the user id of the post is the user id of the person logged in => it is my post\n if @current_user.id == userid\n return true\n # it isn't my post\n else\n return false\n end\n #It isn't my post because I'm not logged in\n else\n return false\n end\n end",
"title": ""
},
{
"docid": "88b0ad1e0cd59eb4ce79dd6575527233",
"score": "0.6262808",
"text": "def has_rated? post\n # post.pos_voter_ids.include?(self.id)||post.neg_voter_ids.include?(self.id)\n ratings.where(:post_id => post.id.to_s).select('score').first.try(:score)\n end",
"title": ""
},
{
"docid": "2868e7029dfc03a003e538c22763c849",
"score": "0.6262318",
"text": "def post( message = nil, tweet = false, facebook = false)\n begin\n user = User.find(user_id)\n message = Like.default_like_post_message( self.subject_id, self.subject_type ) unless message\n\n if ( tweet || ( !user.preferences.asktopost_likes && user.preferences.tweet_likes ) ) && user.identity_for_twitter.has_credentials?\n user.identity_for_twitter.post_like( self, message )\n end\n if (facebook || ( !user.preferences.asktopost_likes && user.preferences.facebook_likes )) && user.identity_for_facebook.has_credentials?\n user.identity_for_facebook.post_like( self, message)\n end\n rescue ActiveRecord::RecordNotFound\n #user was not found, nothing to post\n end\n end",
"title": ""
},
{
"docid": "b77e3e7911329bad84f94c4cc7cda3a9",
"score": "0.6257707",
"text": "def set_postlike\n @likes = Like.where(post_id: params[:post_id])\n end",
"title": ""
},
{
"docid": "2c0a2391b2873910b3d66ee96f8fcd29",
"score": "0.6246546",
"text": "def like_post!(post)\n likes.create!(epost_id: post.id, like: 1)\n end",
"title": ""
},
{
"docid": "1b322e27544d370d00e6aabb75b2ca78",
"score": "0.62393206",
"text": "def has_post_access(board_id, post_id)\n post = Unsakini::Post.where(id: post_id, board_id: board_id)\n .joins(\"LEFT JOIN #{UserBoard.table_name} ON #{UserBoard.table_name}.board_id = #{Post.table_name}.board_id\")\n .where(\"#{UserBoard.table_name}.user_id = ?\", @user.id)\n .first\n if post.nil?\n return {status: :forbidden}\n else\n return {status: :ok, post: post}\n end\n end",
"title": ""
},
{
"docid": "e7caec0fb452de1775dee2ef8d200a32",
"score": "0.62267935",
"text": "def like_status(user)\n if !liking?(user)\n return \"like\"\n else\n return \"unlike\"\n end\n end",
"title": ""
},
{
"docid": "f7e05fe22abb462231ddcb7b8cc5e8f3",
"score": "0.6210118",
"text": "def set_post\n @post = Post.find(params[:id])\n @likes = @post.likes\n @liked_by = @likes.find { |like| like.user_id == current_user.id }\n end",
"title": ""
},
{
"docid": "239efe4e0985c00369ff60692fe79cbc",
"score": "0.62021095",
"text": "def share_to_tumblr?\n self.tumblr_post_id == TumblrSharing::Underway\n end",
"title": ""
},
{
"docid": "48ea1d85dc277f1ecf9c8855f99e87aa",
"score": "0.6194937",
"text": "def sender_can_bill?\n !posts.detect { |post| post.can_bill? user }.nil?\n end",
"title": ""
},
{
"docid": "433c6627d252d27f18830ae564b2ab09",
"score": "0.6193924",
"text": "def can_bill? usr\n !posts.detect { |post| post.can_bill? usr }.nil?\n end",
"title": ""
},
{
"docid": "9be24ebbc1c77c7bbb7850de7a7008d4",
"score": "0.61914027",
"text": "def canManagePost(user)\n\t \t\t\t\n\t \t\t\tif user.nil? \n\t \t\t\t\treturn false\n\t \t\t\tend\n\n\t \t\t\tif user.has_role?(:admin)\n\t \t\t\t\treturn true\n\t \t\t\telse\n\t \t\t\t\treturn false\n\t \t\t\tend\n\t \t\tend",
"title": ""
},
{
"docid": "8dcd8e77f5a50695be34874b398beca1",
"score": "0.6190044",
"text": "def voted_for?(post)\n evaluations.where(target_type: post.class, target_id: post.id).present?\n end",
"title": ""
},
{
"docid": "8dcd8e77f5a50695be34874b398beca1",
"score": "0.6190044",
"text": "def voted_for?(post)\n evaluations.where(target_type: post.class, target_id: post.id).present?\n end",
"title": ""
},
{
"docid": "cb8478741673c4c472491e262b2821f4",
"score": "0.6178301",
"text": "def is_bookmarked user\n Bookmark.find_by(user_id: user_id, post_id: id)\n end",
"title": ""
},
{
"docid": "514fe56e157c0d951bcfd9fa9fa231cf",
"score": "0.61423373",
"text": "def likes\n likers(User).count\n end",
"title": ""
},
{
"docid": "817f1c55038861359237e3ed2f94e49c",
"score": "0.61282086",
"text": "def goodcomments\n User.isliked(self)\n end",
"title": ""
},
{
"docid": "e04fb9fe20c422addebf539eea5368c5",
"score": "0.6117272",
"text": "def set_user_post_like\n @user_post_like = UserPostLike.find(params[:id])\n end",
"title": ""
},
{
"docid": "7af2163807b4f46c12174b8c5f662041",
"score": "0.60811615",
"text": "def is_post_exist?\n @post = current_user.posts.where(:id => params[:id]).first\n unless @post.present?\n redirect_to user_posts_path, notice: 'You dont have access to requested post'\n end\n end",
"title": ""
},
{
"docid": "f14072492e54182315bddcbc2f0db1c9",
"score": "0.6072176",
"text": "def like\n @eventpostcomment.liked_by current_user\n redirect_to @urltoredirect\n end",
"title": ""
},
{
"docid": "085402b815fc27727f66a765c7a91832",
"score": "0.60498923",
"text": "def like(model)\n if self.id != model.id && !self.likes?(model)\n\n model.before_liked_by(self) if model.respond_to?('before_liked_by')\n model.likers_assoc.create!(:like_type => self.class.name, :like_id => self.id)\n model.inc(:liked_count_field, 1)\n model.after_liked_by(self) if model.respond_to?('after_liked_by')\n\n self.before_like(model) if self.respond_to?('before_like')\n self.likes_assoc.create!(:like_type => model.class.name, :like_id => model.id)\n self.inc(:likes_count_field, 1)\n self.after_like(model) if self.respond_to?('after_like')\n\n return true\n else\n return false\n end\n end",
"title": ""
},
{
"docid": "0ee6affeebec5d923ff98da35e4908ff",
"score": "0.60454935",
"text": "def posted?\n post.present?\n end",
"title": ""
},
{
"docid": "48df14061bcb5a4e2e5438bf9310b9bb",
"score": "0.6024319",
"text": "def require_user_like\n if !logged_in?\n flash[:danger] = \"You have to be logged in to perform this action\"\n redirect_to :back\n end\n end",
"title": ""
},
{
"docid": "71a91831173481336b75230e4c1e945e",
"score": "0.6014429",
"text": "def voted_on?(user)\n return !self.ratings.find_by_user_id(user.id).nil?\n end",
"title": ""
},
{
"docid": "37fb4c1605c1181260e347ee75f5eae2",
"score": "0.600762",
"text": "def like_video_track?(track)\n LikedVideoTrack.where(user_id: id, video_track_id: track.id).any?\n end",
"title": ""
},
{
"docid": "7799bd423fc3b0ca0e7d0e6641207b10",
"score": "0.6006953",
"text": "def add_like(uid)\n # get the list of users who have liked this fillin\n doc = get_document(@docs[:liked_by])\n \n # unless this has already been liked by this person (liking_uid)\n unless doc[:users].include?(uid)\n # add to list\n doc[:users].unshift(uid)\n \n # store the new list\n replace_document(@docs[:liked_by], doc)\n\n # increase the count of likes for the fillin\n increase_atomic_count(@docs[:num_likes])\n\n return true\n end\n\n false\n end",
"title": ""
},
{
"docid": "f61621ecb35f53669dd7b185a147c06f",
"score": "0.59884316",
"text": "def likes?(single_event)\n event_tags = single_event.tag_list + single_event.event.tag_list\n\n (event_tags & self.like_list).size > (event_tags & self.hate_list).size\n end",
"title": ""
},
{
"docid": "1b5ca3990f489c8d36aa99255f645f5e",
"score": "0.5987571",
"text": "def likes(options={})\n likes = post(\"/v2/user/likes\", options)\n\n likes.body[\"response\"][\"liked_posts\"].map do |post|\n TumblrV2Api::Post.new(post)\n end\n end",
"title": ""
},
{
"docid": "0d38cc5a4987887177fcb120b5d9b81e",
"score": "0.59867847",
"text": "def user_voted?(user)\n !!users_vote(user)\n end",
"title": ""
},
{
"docid": "d35a0df7b6caed6263ffb3b4da540641",
"score": "0.5983994",
"text": "def like\n @comment.liked_by current_user\n end",
"title": ""
},
{
"docid": "eb005ab78a1bfea12f48f6779efe54e6",
"score": "0.5975807",
"text": "def is_fav?(user)\n user.favs.find_by(post_id: self.id)\n end",
"title": ""
},
{
"docid": "447ae7fb7d4380b70f3fd5ee8b4daa96",
"score": "0.5956782",
"text": "def likes\n UserReaction.where(note_id: self.id, like: 1).count\n end",
"title": ""
},
{
"docid": "9fcb3c9cf8ddb5459dcc4fcafa9f626a",
"score": "0.5946159",
"text": "def like!\n connection.post(\"/photos/#{id}/like\")\n true\n end",
"title": ""
},
{
"docid": "ba76e371b98a022ce2778a8ea981c7d9",
"score": "0.5944301",
"text": "def request_like_fan_page?\n Rails.logger.info(\"TOKEN : #{self.f_token}\")\n oauth = Koala::Facebook::OAuth.new(ENV['FACEBOOK_APP_ID'], ENV['FACEBOOK_APP_SECRET'])\n graph = Koala::Facebook::API.new(self.f_token)\n data = graph.get_connections(self.f_id, \"likes/#{ENV['FACEBOOK_PAGE_ID']}\")\n\n found = false\n data.each do |like|\n found = true if like['id'] == \"#{ENV['FACEBOOK_PAGE_ID']}\"\n end\n return found\n end",
"title": ""
},
{
"docid": "8d300d913385ed8d4dc796c11ab361b7",
"score": "0.5942742",
"text": "def index\n @user_post_likes = UserPostLike.all\n end",
"title": ""
},
{
"docid": "1b4c3a3691305ac087bf07effa04e454",
"score": "0.59284663",
"text": "def is_liked(comment)\n if Like.where(:likeable => comment ,:user_id => self.id).present?\n Like.where(:likeable => comment ,:user_id => self.id).last.like==true\n end\n end",
"title": ""
},
{
"docid": "d123aa90021f6a099196ae180eb2d518",
"score": "0.59278363",
"text": "def user_has_content(user)\n return (user.posts.count > 0 || user.comments.count > 0)\nend",
"title": ""
},
{
"docid": "a742027a648ab12e52f9601fc4de9888",
"score": "0.59150386",
"text": "def show\n @favorite_exists = Favorite.where(post: @post, user: current_user) == [] ? false : true\n\n end",
"title": ""
},
{
"docid": "bee8e33efbe9b15fa9fbd2762d47eba4",
"score": "0.5911909",
"text": "def find_like\n @like = @post.likes.find(params[:id])\n end",
"title": ""
},
{
"docid": "be24db0eb2bc4454ffdfb9930fe204bd",
"score": "0.5909172",
"text": "def mentioned?(user)\n @mentions.include?(user)\n end",
"title": ""
},
{
"docid": "28267b48f5eaa59aeb9df4f2fdcf98c4",
"score": "0.5908753",
"text": "def like\n @post = Post.find(params[:post_id])\n @comment = @post.comments.find(params[:id])\n\n if current_user.already_dislikes?(@comment,'Comment')\n like = current_user.likes.where(likeble_id: @comment.id ,\n user_id: current_user.id ,likeble_type: 'Comment').first\n like.like_status = true\n like.save\n redirect_to new_post_comment_path(@post)\n else\n if current_user.already_likes?(@comment ,'Comment')\n redirect_to new_post_comment_path(@post)\n else\n like = @comment.likes.create()\n like.user_id = current_user.id\n like.like_status = true\n like.save\n redirect_to new_post_comment_path(@post) \n end\n end\n end",
"title": ""
},
{
"docid": "fcfd6310028a5e2a65dbba12c1f05e33",
"score": "0.59082055",
"text": "def can_request?(post)\n post[:post_id] != posts\n end",
"title": ""
}
] |
c38091e9a4aebaee35130627791d6826
|
Set the value of the OrderBy input for this Choreo.
|
[
{
"docid": "e68285446c934687bb12544f154fd68a",
"score": "0.60150206",
"text": "def set_OrderBy(value)\n set_input(\"OrderBy\", value)\n end",
"title": ""
}
] |
[
{
"docid": "ac29ffa31c2dbfe1d4876f1e29f20d89",
"score": "0.64372575",
"text": "def order_by(*props)\n @query[:order_by] = props.join(',')\n self\n end",
"title": ""
},
{
"docid": "fb8014da43ee4742141a757a6f43d338",
"score": "0.6408833",
"text": "def order_by(order_by)\n @order_bys << CGI.escape(order_by)\n self\n end",
"title": ""
},
{
"docid": "2027508e626abfcbf33aefd76e139ef7",
"score": "0.63658",
"text": "def set_order\n unless params[:order_by]\n @order = @model.typus_order_by\n else\n @order = \"#{params[:order_by]} #{params[:sort_order]}\"\n end\n end",
"title": ""
},
{
"docid": "dbf761e361a24d7a17d75a7274c268a1",
"score": "0.6363989",
"text": "def order_by(val)\n raise \"order_by requires a String.\" unless val.is_a? String\n @orderby = val\n self\n end",
"title": ""
},
{
"docid": "226ecca94da51d02f7919f95881870d3",
"score": "0.62774223",
"text": "def set_OrderBy(value)\n set_input(\"OrderBy\", value)\n end",
"title": ""
},
{
"docid": "226ecca94da51d02f7919f95881870d3",
"score": "0.62774223",
"text": "def set_OrderBy(value)\n set_input(\"OrderBy\", value)\n end",
"title": ""
},
{
"docid": "226ecca94da51d02f7919f95881870d3",
"score": "0.62774223",
"text": "def set_OrderBy(value)\n set_input(\"OrderBy\", value)\n end",
"title": ""
},
{
"docid": "226ecca94da51d02f7919f95881870d3",
"score": "0.62774223",
"text": "def set_OrderBy(value)\n set_input(\"OrderBy\", value)\n end",
"title": ""
},
{
"docid": "f5560a0f05cdba699ce9c13652f61e04",
"score": "0.61639386",
"text": "def sort_by(options)\n self.sort = options\n end",
"title": ""
},
{
"docid": "b7dbea687f1c0a4a3e2da57045034841",
"score": "0.6081899",
"text": "def order_by\n ActiveSupport::StringInquirer.new(@params[:order_by]) unless @params[:order_by].nil?\n end",
"title": ""
},
{
"docid": "db3cdde7df96c9891c254ca1e2518c65",
"score": "0.607782",
"text": "def order_by( &block )\n @order_by = block\n order\n self\n end",
"title": ""
},
{
"docid": "7b39519f63faebce1b7fe530353936d4",
"score": "0.59858614",
"text": "def order_by=( val )\n @order_by = val.blank? ? \"#{table_name}.created_at DESC\" : val\n end",
"title": ""
},
{
"docid": "7e91e02611441c6e3528a6805e96606c",
"score": "0.59355074",
"text": "def order_by(opt)\n raise ArgumentError, \"invalid order by value\" unless %w(sld tld nsstatus expdate renew).include?(opt)\n @options['orderby'] = opt\n self\n end",
"title": ""
},
{
"docid": "5a1907183c46d57cad174634abfde3a8",
"score": "0.5898992",
"text": "def ordered_by(statement)\n @expected_options[:order] = statement\n self\n end",
"title": ""
},
{
"docid": "c50f69361651bd2020f11370ea22245e",
"score": "0.5896361",
"text": "def asc\n if @order_by.nil?\n raise Exceptions::IllegalStateException, 'You must call order_by method before call this method'\n end\n\n @order_by.asc = true\n\n self\n end",
"title": ""
},
{
"docid": "e4e9c68cf18f8b351d2201976df30039",
"score": "0.58166337",
"text": "def order_by_expression(order_by)\n return false unless order_by && order_by.presence.present?\n\n to_ordered_table_path(order_by)\n .tap { |order_args| process_ordering_arguments!(order_args) }\n .tap { |order_args| scope_preprocess_order_args(order_args) }\n end",
"title": ""
},
{
"docid": "3bf4c228559f8ccd185703ce04df853a",
"score": "0.5760935",
"text": "def order_by(field)\n ensure_valid_parameter('sorting order', field, %w(price age))\n @request[:order_by] = field.to_s \n self\n end",
"title": ""
},
{
"docid": "5ce8461b03b587a8cf0e0cab8d3052d5",
"score": "0.56976444",
"text": "def order(order)\n attribute, order_type = order.gsub(/\\s+/, ' ').split(' ')\n raise 'Invalid attribute in order clause' unless (model.attributes.keys + ['id', 'created_at']).include?(attribute)\n\n attribute = model.map_to_syncano_attribute(attribute)\n order_type = order_type.to_s.downcase == 'desc' ? 'DESC' : 'ASC'\n\n self.parameters.merge!({ order_by: attribute, order: order_type })\n\n self\n end",
"title": ""
},
{
"docid": "c0913a6dbf06842633fab494c4ae43ad",
"score": "0.56581414",
"text": "def order=(value)\n @order = value\n end",
"title": ""
},
{
"docid": "73330ec2114db85d059c4119a6590338",
"score": "0.56124115",
"text": "def get_order_by\n @order_by\n end",
"title": ""
},
{
"docid": "10daf37ef873cede2f80ad25f9681e77",
"score": "0.5575582",
"text": "def set_order\n sort = params[:sort].present? ? params[:sort] : 'id'\n # FIXME cambiar puntos por guiones para tener automagia\n if sort == 'terceros_nombre'\n sort = 'terceros.nombre'\n end\n ord = params[:order].present? ? params[:order].upcase() : 'ASC'\n @order = sort + ' ' + ord\n end",
"title": ""
},
{
"docid": "762ccbdb50995f4c1fa854cffb6ab8e2",
"score": "0.5532227",
"text": "def order(ordering=nil)\n @options[:order] = ordering if ordering.kind_of?(String)\n end",
"title": ""
},
{
"docid": "492de8412c9a46d1a6f5f135ac5f61de",
"score": "0.5495719",
"text": "def ordering(order)\n ensure_valid_parameter('ordering', order, %w(ascending descending))\n @request[:ordering] = order.to_s\n self\n end",
"title": ""
},
{
"docid": "666f1480b05878c61fe2d69c1acf9d3a",
"score": "0.5479164",
"text": "def set_SortOn(value)\n set_input(\"SortOn\", value)\n end",
"title": ""
},
{
"docid": "666f1480b05878c61fe2d69c1acf9d3a",
"score": "0.5479164",
"text": "def set_SortOn(value)\n set_input(\"SortOn\", value)\n end",
"title": ""
},
{
"docid": "666f1480b05878c61fe2d69c1acf9d3a",
"score": "0.5479164",
"text": "def set_SortOn(value)\n set_input(\"SortOn\", value)\n end",
"title": ""
},
{
"docid": "666f1480b05878c61fe2d69c1acf9d3a",
"score": "0.5479164",
"text": "def set_SortOn(value)\n set_input(\"SortOn\", value)\n end",
"title": ""
},
{
"docid": "666f1480b05878c61fe2d69c1acf9d3a",
"score": "0.5479164",
"text": "def set_SortOn(value)\n set_input(\"SortOn\", value)\n end",
"title": ""
},
{
"docid": "1280f2cba4b50cf5c0f66408d2cbdd6a",
"score": "0.5470574",
"text": "def order(order_str:)\n @order_by = \"ORDER BY #{order_str}\"\n end",
"title": ""
},
{
"docid": "ad9de5118db43aab5b79d2201041c21c",
"score": "0.5459646",
"text": "def order_by(attribute)\n @order_by = Dynamicloud::API::Criteria::OrderByClause.asc(attribute)\n self\n end",
"title": ""
},
{
"docid": "5728e70ed9b05798c0747aa99c101794",
"score": "0.5433791",
"text": "def set_sort_order(order)\n @part_sort_order = order\n end",
"title": ""
},
{
"docid": "f61587c7d233cd58e570f287ddef6a32",
"score": "0.54258865",
"text": "def ordering_by\n order && order.to_s.gsub(/^(ascend|descend)_by_/, '')\n end",
"title": ""
},
{
"docid": "134de4287e09697df5a41a1ca2d44c77",
"score": "0.53885686",
"text": "def order_by *columns\n @order += [columns].flatten\n end",
"title": ""
},
{
"docid": "bfa78a0502b0652a74f53342eb3951df",
"score": "0.5369674",
"text": "def add_sort_order_to_title\n return unless params[:by]\n\n self.title_tag = :query_title_all_by\n title_args[:order] = :\"sort_by_#{params[:by].sub(/^reverse_/, \"\")}\"\n end",
"title": ""
},
{
"docid": "2949e19a11b26776d2018e48735be4f8",
"score": "0.5367368",
"text": "def order=( o )\n\t\torig = @order\n\t\t@order = o\n\t\traise_on_invalid_column if o\n\t\torig\n\tend",
"title": ""
},
{
"docid": "61ff5cc986e09ff656b743fbc7369799",
"score": "0.5347329",
"text": "def order=(order)\n @order = order\n return if order.blank?\n if is_sphinx_scope?(order) # We first check for scopes since they might be named ascend_by_scopename.\n scopes[order.to_sym] = true\n elsif order.to_s =~ /^(ascend|descend)_by_(\\w+)$/\n @order_direction = ($1 == 'ascend') ? :asc : :desc\n if is_sphinx_attribute?($2)\n @order_attribute = $2.to_sym\n elsif [:weight, :relevance, :rank, :id, :random, :geodist].include?($2.to_sym)\n @order_attribute = \"@#{$2} #{@order_direction}\"\n end\n end\n end",
"title": ""
},
{
"docid": "1fce1f4accf3da9352d0d10112411fea",
"score": "0.53363895",
"text": "def order_by(column, &block)\n config.ordering[column] = block\n end",
"title": ""
},
{
"docid": "9ddab8952fe4730378a95c219880b369",
"score": "0.5325545",
"text": "def SetSortMode(mode, sortby = '')\n assert { mode == SPH_SORT_RELEVANCE \\\n || mode == SPH_SORT_ATTR_DESC \\\n || mode == SPH_SORT_ATTR_ASC \\\n || mode == SPH_SORT_TIME_SEGMENTS \\\n || mode == SPH_SORT_EXTENDED \\\n || mode == SPH_SORT_EXPR }\n assert { sortby.instance_of? String }\n assert { mode == SPH_SORT_RELEVANCE || !sortby.empty? }\n\n @sort = mode\n @sortby = sortby\n end",
"title": ""
},
{
"docid": "1f7a9596fbba89780a71582ad9685964",
"score": "0.5307272",
"text": "def set_SortBy(value)\n set_input(\"SortBy\", value)\n end",
"title": ""
},
{
"docid": "1f7a9596fbba89780a71582ad9685964",
"score": "0.5307272",
"text": "def set_SortBy(value)\n set_input(\"SortBy\", value)\n end",
"title": ""
},
{
"docid": "d52560d48641a54b84087a51ffc1b5bb",
"score": "0.52919275",
"text": "def default_sort=(field)\n @order_by.unshift(field)\n end",
"title": ""
},
{
"docid": "6186835d596a00b60c29bdc668f9e6a3",
"score": "0.52684164",
"text": "def order_by\n if params[:order_by]\n if params[:order_by] == 'created_at'\n # If created at, get newest first\n params[:order_by] + ' DESC'\n else\n # Otherwise, get closest to now\n params[:order_by] + ' ASC'\n end\n else\n # Default to start date, ascending\n 'starts_at ASC'\n end\n end",
"title": ""
},
{
"docid": "d7cfa79c4f6e321ee812a069a7cf99b8",
"score": "0.52277786",
"text": "def set_sort_order(opts)\n opts = check_params(opts,[:orders])\n super(opts)\n end",
"title": ""
},
{
"docid": "8c68c12e1dad0998b9e2abf1e0626e00",
"score": "0.51599985",
"text": "def column_to_order_by(column)\n @@column_order_by = column || \"updated_at\"\n\n define_method(:column_order_by) do\n @@column_order_by\n end\n end",
"title": ""
},
{
"docid": "3260352ef52838d0a9f14e20d5200c3e",
"score": "0.5145517",
"text": "def set_Sort(value)\n set_input(\"Sort\", value)\n end",
"title": ""
},
{
"docid": "d897f767487120dc8b75b27390eb4af1",
"score": "0.51408195",
"text": "def order(order)\n params[:sort] = if order.is_a?(Hash) then\n order.reduce([]) do |memo, obj|\n key, value = obj\n\n if (value.to_s != \"asc\" && value.to_s != \"desc\") then\n raise ArgumentError, \"Order must be either :asc or :desc\"\n end\n\n key = \"-#{key}\" if value.to_s == \"desc\"\n memo.push(key)\n end.join(\",\")\n elsif order.is_a?(String) then\n order\n end\n\n self\n end",
"title": ""
},
{
"docid": "61788993b4ef05a58be626cd3540bc74",
"score": "0.5138397",
"text": "def order(*value)\n @keys_order = value\n end",
"title": ""
},
{
"docid": "b3eb994712a9ca86af3880355304a9fd",
"score": "0.5135999",
"text": "def set_sortorder(order)\n puts \"RFilter.set_sortorder is DEPRECATED - use RFilter.set_sort_by_and_order instead\"\n self.sql_sortorder = order\n end",
"title": ""
},
{
"docid": "c402269c2f3825eb2b1d14318c284d3a",
"score": "0.51163644",
"text": "def get_orders\n if params['order_by'].nil?\n return nil\n else\n @orderer = {params['order_by'] => params['asc']}\n orders = params['order_by']\n if !params['asc']\n orders = orders + \" desc\"\n end\n return orders\n end\n end",
"title": ""
},
{
"docid": "2cea62198cd3962bacf55cafc7627253",
"score": "0.5099813",
"text": "def set_SortBy(value)\n set_input(\"SortBy\", value)\n end",
"title": ""
},
{
"docid": "2cea62198cd3962bacf55cafc7627253",
"score": "0.5099813",
"text": "def set_SortBy(value)\n set_input(\"SortBy\", value)\n end",
"title": ""
},
{
"docid": "2cea62198cd3962bacf55cafc7627253",
"score": "0.5099813",
"text": "def set_SortBy(value)\n set_input(\"SortBy\", value)\n end",
"title": ""
},
{
"docid": "2cea62198cd3962bacf55cafc7627253",
"score": "0.5099813",
"text": "def set_SortBy(value)\n set_input(\"SortBy\", value)\n end",
"title": ""
},
{
"docid": "2cea62198cd3962bacf55cafc7627253",
"score": "0.5099813",
"text": "def set_SortBy(value)\n set_input(\"SortBy\", value)\n end",
"title": ""
},
{
"docid": "2cea62198cd3962bacf55cafc7627253",
"score": "0.5099813",
"text": "def set_SortBy(value)\n set_input(\"SortBy\", value)\n end",
"title": ""
},
{
"docid": "2cea62198cd3962bacf55cafc7627253",
"score": "0.5099813",
"text": "def set_SortBy(value)\n set_input(\"SortBy\", value)\n end",
"title": ""
},
{
"docid": "2cea62198cd3962bacf55cafc7627253",
"score": "0.5099813",
"text": "def set_SortBy(value)\n set_input(\"SortBy\", value)\n end",
"title": ""
},
{
"docid": "2cea62198cd3962bacf55cafc7627253",
"score": "0.5099813",
"text": "def set_SortBy(value)\n set_input(\"SortBy\", value)\n end",
"title": ""
},
{
"docid": "2cea62198cd3962bacf55cafc7627253",
"score": "0.5099813",
"text": "def set_SortBy(value)\n set_input(\"SortBy\", value)\n end",
"title": ""
},
{
"docid": "2cea62198cd3962bacf55cafc7627253",
"score": "0.5099813",
"text": "def set_SortBy(value)\n set_input(\"SortBy\", value)\n end",
"title": ""
},
{
"docid": "65e2ea7b7b43d3fca2ff18c9d63b9235",
"score": "0.50829214",
"text": "def set_order( params )\n return 'desc' if (params[:order]=='asc')\n return 'asc'\n end",
"title": ""
},
{
"docid": "ff86809659878d7d922f978f981b78d1",
"score": "0.50665313",
"text": "def set_SortOrder(value)\n set_input(\"SortOrder\", value)\n end",
"title": ""
},
{
"docid": "ff86809659878d7d922f978f981b78d1",
"score": "0.50665313",
"text": "def set_SortOrder(value)\n set_input(\"SortOrder\", value)\n end",
"title": ""
},
{
"docid": "ff86809659878d7d922f978f981b78d1",
"score": "0.50665313",
"text": "def set_SortOrder(value)\n set_input(\"SortOrder\", value)\n end",
"title": ""
},
{
"docid": "ff86809659878d7d922f978f981b78d1",
"score": "0.50665313",
"text": "def set_SortOrder(value)\n set_input(\"SortOrder\", value)\n end",
"title": ""
},
{
"docid": "ff86809659878d7d922f978f981b78d1",
"score": "0.50665313",
"text": "def set_SortOrder(value)\n set_input(\"SortOrder\", value)\n end",
"title": ""
},
{
"docid": "ff86809659878d7d922f978f981b78d1",
"score": "0.50665313",
"text": "def set_SortOrder(value)\n set_input(\"SortOrder\", value)\n end",
"title": ""
},
{
"docid": "ff86809659878d7d922f978f981b78d1",
"score": "0.50665313",
"text": "def set_SortOrder(value)\n set_input(\"SortOrder\", value)\n end",
"title": ""
},
{
"docid": "ff86809659878d7d922f978f981b78d1",
"score": "0.50665313",
"text": "def set_SortOrder(value)\n set_input(\"SortOrder\", value)\n end",
"title": ""
},
{
"docid": "ff86809659878d7d922f978f981b78d1",
"score": "0.50665313",
"text": "def set_SortOrder(value)\n set_input(\"SortOrder\", value)\n end",
"title": ""
},
{
"docid": "ff86809659878d7d922f978f981b78d1",
"score": "0.50665313",
"text": "def set_SortOrder(value)\n set_input(\"SortOrder\", value)\n end",
"title": ""
},
{
"docid": "ff86809659878d7d922f978f981b78d1",
"score": "0.50665313",
"text": "def set_SortOrder(value)\n set_input(\"SortOrder\", value)\n end",
"title": ""
},
{
"docid": "ff86809659878d7d922f978f981b78d1",
"score": "0.50665313",
"text": "def set_SortOrder(value)\n set_input(\"SortOrder\", value)\n end",
"title": ""
},
{
"docid": "ff86809659878d7d922f978f981b78d1",
"score": "0.50665313",
"text": "def set_SortOrder(value)\n set_input(\"SortOrder\", value)\n end",
"title": ""
},
{
"docid": "ff86809659878d7d922f978f981b78d1",
"score": "0.50665313",
"text": "def set_SortOrder(value)\n set_input(\"SortOrder\", value)\n end",
"title": ""
},
{
"docid": "ff86809659878d7d922f978f981b78d1",
"score": "0.50665313",
"text": "def set_SortOrder(value)\n set_input(\"SortOrder\", value)\n end",
"title": ""
},
{
"docid": "ff86809659878d7d922f978f981b78d1",
"score": "0.50665313",
"text": "def set_SortOrder(value)\n set_input(\"SortOrder\", value)\n end",
"title": ""
},
{
"docid": "ff86809659878d7d922f978f981b78d1",
"score": "0.50665313",
"text": "def set_SortOrder(value)\n set_input(\"SortOrder\", value)\n end",
"title": ""
},
{
"docid": "cdbf3e8d24b5d0fec0b2da091afcca9c",
"score": "0.5062428",
"text": "def order_params\n if params[:order_by]\n order_from_params\n else\n { created_at: Sortable::DIRECTION_DESC }\n end\n end",
"title": ""
},
{
"docid": "38af6b001a3933f1d17f6e031df277ae",
"score": "0.5057139",
"text": "def desc\n if @order_by.nil?\n raise Exceptions::IllegalStateException, 'You must call order_by method before call this method'\n end\n\n @order_by.asc = false\n\n self\n end",
"title": ""
},
{
"docid": "ccfcd8328e03d23b542ffde380a58466",
"score": "0.50479746",
"text": "def order(*columns)\n Lotus::Utils::Kernel.Array(columns).each do |column|\n conditions.push(Proc.new{ sort_by{|r| r.fetch(column)} })\n end\n\n self\n end",
"title": ""
},
{
"docid": "5e46cf54e7eecdb555b6608f1b897585",
"score": "0.5041873",
"text": "def sort(order_column, order_method = 'asc')\n check_parameter('order_column', order_column, String)\n check_parameter('order_method', order_method, String)\n order_method_array = %w[asc desc]\n raise \"order_method parameter must be 'asc' or 'desc'\" unless order_method_array.include? order_method\n\n @request_url_base += \"&order_by=#{order_column}_#{order_method}\"\n\n self\n end",
"title": ""
},
{
"docid": "41617d20d42b7a1f27dc9af5734ec0af",
"score": "0.50332165",
"text": "def order_by(column, order)\n return resource().order(column.to_s + \" \" + order)\n end",
"title": ""
},
{
"docid": "7bd0549d7ee0e1cbeffcac7b7e067ad6",
"score": "0.50143516",
"text": "def order_by(*args)\n clone.tap do |crit|\n arguments = args.size == 1 ? args.first : args\n setup_sort_options(crit.options) unless args.first.nil?\n if arguments.is_a?(Array)\n #[:name, :asc]\n if arguments.size == 2 && (arguments.first.is_a?(Symbol) || arguments.first.is_a?(String))\n build_order_options(arguments, crit)\n else\n arguments.each { |argument| build_order_options(argument, crit) }\n end\n else\n build_order_options(arguments, crit)\n end\n end\n end",
"title": ""
},
{
"docid": "bab694ca0f74301fda8cce93b1b3bdf9",
"score": "0.50129044",
"text": "def sort=(value)\n @sort = value\n end",
"title": ""
},
{
"docid": "32f733a9ef483a4ab0cc6c76981fb420",
"score": "0.5002817",
"text": "def order(sort_column, sort_asc)\n @sort_column = sort_column\n @sort_asc = sort_asc\n @scope = @scope.reorder(\"#{sort_column} #{sort_asc ? 'ASC' : 'DESC'}\")\n end",
"title": ""
},
{
"docid": "117495d5d28904e465dd36f3f71c2e9b",
"score": "0.4987399",
"text": "def set_order(ordering)\n\t\to = \"\"\n\t\tordering.each do |obj_place|\n\t\t\to << (obj_place.model + \"_\" + obj_place.id.to_s + \"///,\")\n\t\tend\n\t\tself.update_attribute :order, o\n\tend",
"title": ""
},
{
"docid": "b1bcf88183b04fceab8cf1aa4d387afa",
"score": "0.49608505",
"text": "def set_Sort(value)\n set_input(\"Sort\", value)\n end",
"title": ""
},
{
"docid": "b1bcf88183b04fceab8cf1aa4d387afa",
"score": "0.49608505",
"text": "def set_Sort(value)\n set_input(\"Sort\", value)\n end",
"title": ""
},
{
"docid": "b1bcf88183b04fceab8cf1aa4d387afa",
"score": "0.49608505",
"text": "def set_Sort(value)\n set_input(\"Sort\", value)\n end",
"title": ""
},
{
"docid": "b1bcf88183b04fceab8cf1aa4d387afa",
"score": "0.49608505",
"text": "def set_Sort(value)\n set_input(\"Sort\", value)\n end",
"title": ""
},
{
"docid": "b1bcf88183b04fceab8cf1aa4d387afa",
"score": "0.49608505",
"text": "def set_Sort(value)\n set_input(\"Sort\", value)\n end",
"title": ""
},
{
"docid": "b1bcf88183b04fceab8cf1aa4d387afa",
"score": "0.49608505",
"text": "def set_Sort(value)\n set_input(\"Sort\", value)\n end",
"title": ""
}
] |
893964d19ff7f4bfae9971064307fd6a
|
Splits PowerPoint presentation slides from the specified range into separate files and exports them in the specified file format. If the range is not provided all slides will be processed.
|
[
{
"docid": "b26bf2ea1ac94df36fc40f1e86e70e5f",
"score": "0.438122",
"text": "def split_and_save_online(document, format, dest_folder = nil, width = nil, height = nil, from = nil, to = nil, password = nil, storage = nil, fonts_folder = nil, options = nil)\n data, _status_code, _headers = split_and_save_online_with_http_info(document, format, dest_folder, width, height, from, to, password, storage, fonts_folder, options)\n data\n end",
"title": ""
}
] |
[
{
"docid": "e92ee2cc25cf550376cf4a17f9cdb30a",
"score": "0.5509363",
"text": "def export\n date = current_date\n if params['excel_layout'] == 'scoring_sheet'\n file_name = 'scoring_sheet.xls'\n elsif params['include'] == 'print_cards'\n file_name = 'print_cards.xls'\n elsif params['format'] == 'ppl'\n file_name = 'lynx.ppl'\n else\n file_name = \"people_#{date.year}_#{date.month}_#{date.day}.#{params['format']}\"\n end\n headers['Content-Disposition'] = \"filename=\\\"#{file_name}\\\"\"\n\n @people = Person.find_all_for_export(date, params['include'])\n \n respond_to do |format|\n format.html\n format.ppl\n format.xls {\n if params['excel_layout'] == 'scoring_sheet'\n render :template => 'admin/people/scoring_sheet' \n elsif params['excel_layout'] == 'endicia'\n render :template => 'admin/people/endicia' \n end\n }\n end\n end",
"title": ""
},
{
"docid": "355539f40e2c0b2f4b1cd185b29b3488",
"score": "0.5440592",
"text": "def save_slide_as slide_number,output_path,output_format\n begin\n \n if @filename == ''\n raise('input file not specified')\n end \n \n if output_path == ''\n raise('output path not specified')\n end\n \n if slide_number == ''\n raise('slide number not specified')\n end\n \n if output_format == ''\n raise('output format not specified')\n end\n \n # if not File.exist?(inputFile)\n # raise('input file doesn't exist.')\n # end\n \n \n \n str_uri = $product_uri + '/slides/'+@filename+'/slides/'+slide_number.to_s+'?format=' + output_format\n str_signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n response_stream = RestClient.get(str_signed_uri,{:accept=>'application/json'})\n \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) + '_' + slide_number.to_s + '.' + output_format\n Aspose::Cloud::Common::Utils.save_file(response_stream,output_path)\n return ''\n else\n return valid_output\n end\n \n rescue Exception=>e\n print e \n end \n end",
"title": ""
},
{
"docid": "26860a43201d25173f62ef8385468b25",
"score": "0.5386454",
"text": "def split_document_pptx(input_file, opts = {})\n data, _status_code, _headers = split_document_pptx_with_http_info(input_file, opts)\n data\n end",
"title": ""
},
{
"docid": "221a1c754eed9fda21eeeb6ee9b4a4e5",
"score": "0.5323013",
"text": "def convert!\n merged_contents = []\n @files.each do |file|\n markup = Markup.new file, @remove_front_matter\n html = convert_image_urls markup.render, file.filename\n if @merge\n html = \"<div class=\\\"page-break\\\"></div>#{html}\" unless merged_contents.empty?\n merged_contents << html\n else\n output_pdf(html, file)\n end\n end\n\n unless merged_contents.empty?\n html = merged_contents.join\n output_pdf(html, nil)\n end\n end",
"title": ""
},
{
"docid": "18999279d926a44a6fe8ac34dbc2eaf6",
"score": "0.52315104",
"text": "def split(input: nil, output: nil, range: nil)\n output = input.gsub(/\\.pdf$/, \"_#{range}.pdf\") if output.nil?\n\n options = [\n input.shellescape,\n \"cat #{range}\",\n \"output #{output.shellescape}\"\n ]\n command = \"pdftk #{options.join(' ')}\"\n\n success = command_success?(command)\n return output if success\n end",
"title": ""
},
{
"docid": "53f80e3e286ff3d3c4364ce1120634c9",
"score": "0.52051175",
"text": "def slides\n @slides = Array.new\n @files.each do |f|\n if f.name.include? 'ppt/slides/slide'\n @slides.push Slide.new(self, f.name)\n end\n end\n @slides.sort{|a,b| a.slide_num <=> b.slide_num}\n end",
"title": ""
},
{
"docid": "fded9c281cc9bdd78643d99dfca39f33",
"score": "0.5174196",
"text": "def post_processing_slides( content )\n \n # 1) add slide breaks\n \n if config.slide? # only allow !SLIDE directives fo slide breaks?\n # do nothing (no extra automagic slide breaks wanted)\n else \n if (@markup_type == :markdown && Markdown.lib == 'pandoc-ruby') || @markup_type == :rest\n content = add_slide_directive_before_div_h1( content )\n else\n if config.header_level == 2\n content = add_slide_directive_before_h2( content )\n else # assume level 1\n content = add_slide_directive_before_h1( content )\n end\n end\n end\n\n\n dump_content_to_file_debug_html( content )\n\n # 2) use generic slide break processing instruction to\n # split content into slides\n\n slide_counter = 0\n\n slides = []\n slide_buf = \"\"\n \n content.each_line do |line|\n if line.include?( '<!-- _S9SLIDE_' )\n if slide_counter > 0 # found start of new slide (and, thus, end of last slide)\n slides << slide_buf # add slide to slide stack\n slide_buf = \"\" # reset slide source buffer\n else # slide_counter == 0\n # check for first slide with missing leading SLIDE directive (possible/allowed in takahashi, for example)\n ## remove html comments and whitspaces (still any content?)\n ### more than just whitespace? assume its a slide\n if slide_buf.gsub(/<!--.*?-->/m, '').gsub( /[\\n\\r\\t ]/, '').length > 0\n logger.debug \"add slide with missing leading slide directive >#{slide_buf}< with slide_counter == 0\"\n slides << slide_buf\n slide_buf = \"\"\n else\n logger.debug \"skipping slide_buf >#{slide_buf}< with slide_counter == 0\"\n end\n end\n slide_counter += 1\n end\n slide_buf << line\n end\n \n if slide_counter > 0\n slides << slide_buf # add slide to slide stack\n slide_buf = \"\" # reset slide source buffer \n end\n\n\n slides2 = []\n slides.each do |source|\n slides2 << Slide.new( source, config )\n end\n\n\n puts \"#{slides2.size} slides found:\"\n \n slides2.each_with_index do |slide,i|\n print \" [#{i+1}] \"\n if slide.header.present?\n print slide.header\n else\n # remove html comments\n print \"-- no header -- | #{slide.content.gsub(/<!--.*?-->/m, '').gsub(/\\n/,'$')[0..40]}\"\n end\n puts\n end\n \n \n # make content2 and slide2 available to erb template\n # -- todo: cleanup variable names and use attr_readers for content and slide\n\n ### fix: use class SlideDeck or Deck?? for slides array?\n \n content2 = \"\"\n slides2.each do |slide|\n content2 << slide.to_classic_html\n end\n \n @content = content2\n @slides = slides2 # strutured content\n end",
"title": ""
},
{
"docid": "009010c0289a325d46a219ea198ff1fc",
"score": "0.5145945",
"text": "def post_processing_slides( content )\r\n \r\n # 1) add slide break \r\n \r\n if (@markup_type == :markdown && @markdown_libs.first == 'pandoc-ruby') || @markup_type == :rest\r\n content = add_slide_directive_before_div_h1( content )\r\n else\r\n content = add_slide_directive_before_h1( content )\r\n end\r\n\r\n dump_content_to_file_debug_html( content )\r\n\r\n # 2) use generic slide break processing instruction to\r\n # split content into slides\r\n\r\n slide_counter = 0\r\n\r\n slides = []\r\n slide_source = \"\"\r\n \r\n content.each_line do |line|\r\n if line.include?( '<!-- _S9SLIDE_' ) or\r\n line.include?( '<!-- _S9TRANSITION_' ) then\r\n if slide_counter > 0 then # found start of new slide (and, thus, end of last slide)\r\n slides << slide_source # add slide to slide stack\r\n slide_source = \"\" # reset slide source buffer\r\n end\r\n slide_counter += 1\r\n end\r\n slide_source << line\r\n end\r\n \r\n if slide_counter > 0 then\r\n slides << slide_source # add slide to slide stack\r\n slide_source = \"\" # reset slide source buffer \r\n end\r\n\r\n ## split slide source into header (optional) and content/body\r\n ## plus check for (css style) classes\r\n\r\n slides2 = []\r\n transition = nil\r\n transitioncount = 0\r\n slides.each do |slide_source|\r\n slide = Slide.new\r\n\r\n ## check for css style classes \r\n from = 0\r\n while (pos = slide_source.index( /<!-- _S9(SLIDE|STYLE|TRANSITION)_(.*?)-->/m, from ))\r\n type = $1.downcase\r\n klass = $2.strip\r\n if $1 == 'TRANSITION'\r\n transition = klass\r\n transitioncount = 0\r\n klass = 'middle'\r\n logger.debug \\\r\n\" adding css classes (plus middle for #{transition}) from pi #{type}: #{klass}\"\r\n slide.transition = transition + '-title'\r\n else\r\n if transition\r\n transitioncount += 1\r\n slide.transition = \"#{transition}[#{transitioncount}]\"\r\n logger.debug \\\r\n\" adding css classes (plus #{transition}) from pi #{type}: #{klass}\"\r\n else\r\n logger.debug \" adding css classes from pi #{type}: #{klass}\"\r\n end\r\n end\r\n\r\n if slide.classes.nil?\r\n slide.classes = klass\r\n else\r\n slide.classes << \" #{klass}\"\r\n end\r\n \r\n from = Regexp.last_match.end(0)\r\n end\r\n \r\n # try to cut off header using non-greedy .+? pattern; tip test regex online at rubular.com\r\n # note/fix: needs to get improved to also handle case for h1 wrapped into div\r\n # (e.g. extract h1 - do not assume it starts slide source)\r\n if slide_source =~ /^\\s*(<h1.*?>.*?<\\/h\\d>)\\s*(.*)/m \r\n slide.header = $1\r\n slide.content = ($2 ? $2 : \"\")\r\n logger.debug \" adding slide with header:\\n#{slide.header}\"\r\n else\r\n slide.content = slide_source\r\n logger.debug \" adding slide with *no* header:\\n#{slide.content}\"\r\n end\r\n slides2 << slide\r\n end\r\n\r\n # for convenience create a string w/ all in-one-html\r\n # no need to wrap slides in divs etc.\r\n \r\n content2 = \"\"\r\n slides2.each do |slide| \r\n content2 << slide.to_classic_html\r\n end\r\n \r\n # make content2 and slide2 available to erb template\r\n # -- todo: cleanup variable names and use attr_readers for content and slide\r\n \r\n @slides = slides2 # strutured content \r\n @content = content2 # content all-in-one \r\n end",
"title": ""
},
{
"docid": "d8422d0067239d46e9e34e9153000577",
"score": "0.5133789",
"text": "def slides\n @file_manager.slide_files\n end",
"title": ""
},
{
"docid": "9cfc0f53b01742c2ffbfe40dc1301771",
"score": "0.5125503",
"text": "def generate_pdf(filename)\n @destination_path = \"#{Rails.root}/public/files/\"+filename.remove('pptx')+'pdf'\n Libreconv.convert( @files.to_s, @destination_path, nil, 'pdf:writer_pdf_Export')\n # Docsplit.extract_pdf(@files.to_s)\n\n # Creates the manipulated pptx file physically\n FileUtils.mv @files.to_s, \"#{Rails.root}/public/files/\"+filename\n @destination_path\n end",
"title": ""
},
{
"docid": "4e9f5d34e8bd412803fabced89c09f92",
"score": "0.5090343",
"text": "def libreoffice( format: )\n suffixes = {\n 'pdf' => {\n '.*' => 'pdf',\n },\n 'msoffice' => {\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'docx',\n 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'xlsx',\n 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'pptx',\n 'application/vnd.oasis.opendocument.text' => 'docx',\n 'application/vnd.oasis.opendocument.spreadsheet' => 'xlsx',\n 'application/vnd.oasis.opendocument.presentation' => 'pptx',\n 'application/zip' => 'docx',\n },\n 'ooffice' => {\n 'application/msword' => 'odt',\n 'application/vnd.ms-word' => 'odt',\n 'application/vnd.ms-excel' => 'ods',\n 'application/vnd.ms-office' => 'odt',\n 'application/vnd.ms-powerpoint' => 'odp',\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => 'odt',\n 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => 'ods',\n 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => 'odp',\n },\n 'txt' => {\n '.*' => 'txt'\n }\n }\n\n raise InvalidParameterInStep.new('format', format) unless suffixes[format.to_s]\n to_suffix = nil\n suffixes[format.to_s].each do |k,v|\n to_suffix = v if job.mime_type =~ /#{k}/\n end\n raise InvalidMimeTypeInStep.new('(various document formats)', job.mime_type) unless to_suffix\n\n output = nil\n\n if to_suffix == 'txt'\n executioner.execute(\n Colore::C_.tika_path,\n '--text',\n job.content_file,\n binary: true\n )\n\n output = executioner.stdout\n else\n target_file = \"#{job.content_file}.#{to_suffix}\"\n\n execute_sandboxed_libreoffice(\n '--convert-to', to_suffix,\n '--outdir', sandbox_dir,\n job.content_file,\n '--headless',\n )\n\n unless File.exist? target_file\n raise ConversionFailed.new(\"Cannot find converted file (looking for #{File.basename(target_file)})\" )\n end\n\n output = File.read(target_file)\n File.unlink(target_file)\n end\n\n raise ConversionFailed.new(executioner.last_messages) if executioner.last_exit_status != 0\n\n job.content = output\n end",
"title": ""
},
{
"docid": "a9d5ebb2ed36360edbd5d050bc37f653",
"score": "0.5034037",
"text": "def rebuild_pptx\n Zip::File.open(@files.to_s, Zip::File::CREATE) { |zipfile|\n @slides.each do |f|\n if f.changed\n # Temporary file to store the manipulated xml\n temp_file = Tempfile.new(f.slide_file_name)\n # Store the manipulated xml inside the file\n temp_file.write(f.raw_xml)\n temp_file.close\n # Collect temporary files to unlink them later\n @temp_files << temp_file\n # Replace the original slide with the new one\n zipfile.replace(f.slide_xml_path, temp_file.path)\n end\n end\n }\n end",
"title": ""
},
{
"docid": "10eae67191f727afc1ae4832f881b21d",
"score": "0.50005996",
"text": "def split_with_http_info(name, options = nil, format = nil, width = nil, height = nil, from = nil, to = nil, dest_folder = nil, password = nil, folder = nil, storage = nil, fonts_folder = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.split ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.split\"\n end\n if @api_client.config.client_side_validation && format && !['Jpeg', 'Png', 'Gif', 'Bmp', 'Tiff', 'Html', 'Pdf', 'Xps', 'Pptx', 'Odp', 'Otp', 'Ppt', 'Pps', 'Ppsx', 'Pptm', 'Ppsm', 'Potx', 'Pot', 'Potm', 'Svg', 'Fodp', 'Xaml', 'Html5'].any?{ |s| s.casecmp(format)==0 }\n fail ArgumentError, \"Invalid value for parameter format: \" + format + \". Must be one of Jpeg, Png, Gif, Bmp, Tiff, Html, Pdf, Xps, Pptx, Odp, Otp, Ppt, Pps, Ppsx, Pptm, Ppsm, Potx, Pot, Potm, Svg, Fodp, Xaml, Html5\"\n end\n # resource path\n local_var_path = '/slides/{name}/split'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n\n # query parameters\n query_params = {}\n query_params[:'format'] = @api_client.prepare_for_query(format) unless format.nil?\n query_params[:'width'] = @api_client.prepare_for_query(width) unless width.nil?\n query_params[:'height'] = @api_client.prepare_for_query(height) unless height.nil?\n query_params[:'from'] = @api_client.prepare_for_query(from) unless from.nil?\n query_params[:'to'] = @api_client.prepare_for_query(to) unless to.nil?\n query_params[:'destFolder'] = @api_client.prepare_for_query(dest_folder) unless dest_folder.nil?\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n query_params[:'fontsFolder'] = @api_client.prepare_for_query(fonts_folder) unless fonts_folder.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = @api_client.object_to_http_body(options)\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'SplitDocumentResult')\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "0631e0f3ffad68eedafd42cc69a96be2",
"score": "0.49759665",
"text": "def split_and_save_online_with_http_info(document, format, dest_folder = nil, width = nil, height = nil, from = nil, to = nil, password = nil, storage = nil, fonts_folder = nil, options = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.split_and_save_online ...'\n end\n\n # verify the required parameter 'document' is set\n if @api_client.config.client_side_validation && document.nil?\n fail ArgumentError, \"Missing the required parameter 'document' when calling SlidesApi.split_and_save_online\"\n end\n # verify the required parameter 'format' is set\n if @api_client.config.client_side_validation && format.nil?\n fail ArgumentError, \"Missing the required parameter 'format' when calling SlidesApi.split_and_save_online\"\n end\n # verify enum value\n if @api_client.config.client_side_validation && !['Jpeg', 'Png', 'Gif', 'Bmp', 'Tiff', 'Html', 'Pdf', 'Xps', 'Pptx', 'Odp', 'Otp', 'Ppt', 'Pps', 'Ppsx', 'Pptm', 'Ppsm', 'Potx', 'Pot', 'Potm', 'Svg', 'Fodp', 'Xaml', 'Html5'].any?{ |s| s.casecmp(format)==0 }\n fail ArgumentError, \"Invalid value for parameter format: \" + format + \". Must be one of Jpeg, Png, Gif, Bmp, Tiff, Html, Pdf, Xps, Pptx, Odp, Otp, Ppt, Pps, Ppsx, Pptm, Ppsm, Potx, Pot, Potm, Svg, Fodp, Xaml, Html5\"\n end\n # resource path\n local_var_path = '/slides/split/{format}'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'format', format)\n\n # query parameters\n query_params = {}\n query_params[:'destFolder'] = @api_client.prepare_for_query(dest_folder) unless dest_folder.nil?\n query_params[:'width'] = @api_client.prepare_for_query(width) unless width.nil?\n query_params[:'height'] = @api_client.prepare_for_query(height) unless height.nil?\n query_params[:'from'] = @api_client.prepare_for_query(from) unless from.nil?\n query_params[:'to'] = @api_client.prepare_for_query(to) unless to.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n query_params[:'fontsFolder'] = @api_client.prepare_for_query(fonts_folder) unless fonts_folder.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = @api_client.object_to_http_body(options)\n\n # form parameters\n post_files = []\n if document\n post_files = post_files.push(document)\n end\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'SplitDocumentResult')\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "4e5513028387021135e634001c1b1956",
"score": "0.493932",
"text": "def split_document_pptx_with_http_info(input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SplitDocumentApi.split_document_pptx ...'\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling SplitDocumentApi.split_document_pptx\"\n end\n # resource path\n local_var_path = '/convert/split/pptx'\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', 'text/json', 'application/xml', 'text/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n header_params[:'returnDocumentContents'] = opts[:'return_document_contents'] if !opts[:'return_document_contents'].nil?\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SplitPptxPresentationResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SplitDocumentApi#split_document_pptx\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "20a1f91bf00ee8436283cc29f1ab999f",
"score": "0.49220517",
"text": "def split_pdf(filename, density=300, format=:jpg)\n\n #If this isn't a PDF, return the unmodified filename.\n return filename unless File.extname(filename) == '.pdf'\n\n #Get the length of the PDF...\n length = Docsplit.extract_length(filename)\n\n #If we don't have a multi-page document, abort.\n return filename unless length > 1\n\n #Otherwise, split the document\n Docsplit.extract_pages(filename)\n\n # Determine the base name of the file, and the file's length, in pages.\n # We have to use these two parameters to figure out the files generated by docsplit,\n # which doesn't return a list of created files.\n basename = File.basename(filename, '.pdf')\n\n #... and add the resultant PDFs to the new argument list.\n (1..length).collect { |x| \"#{basename}_#{x}.pdf\" }\n\nend",
"title": ""
},
{
"docid": "dd754c72d3e7b5c2481d989ff4f15907",
"score": "0.491812",
"text": "def open_narration(slide_no)\n if @type == 'm4a'\n @files.extract(\"ppt/media/media#{slide_no}.m4a\", \"#{Rails.root}/public/audios/#{$filename}media#{slide_no}.m4a\") rescue\n $filename+'media'+slide_no.to_s+'.m4a'\n end\n if @type == 'wav'\n\n @files.extract(\"ppt/media/media#{slide_no}.wav\", \"#{Rails.root}/public/audios/#{$filename}media#{slide_no}.wav\") rescue\n $filename+'media'+slide_no.to_s+'.wav'\n\n end\n end",
"title": ""
},
{
"docid": "5851762f1ce353d5cf6db6c453282103",
"score": "0.48836112",
"text": "def export!(destination:)\n files.each do |file|\n File.open(File.join(destination, file.file_name.first), 'wb') do |io|\n file.stream.each { |chunk| io.write(chunk) }\n end\n end\n end",
"title": ""
},
{
"docid": "dcc1fefb810bd83fafaf318545f92441",
"score": "0.4873341",
"text": "def generateDocument(input, outdir, outname, format, vars, editions=nil, snippetfiles=nil) \r\n \r\n \r\n # combine the input files\r\n \r\n temp_filename = \"#{@tempdir}/x.md\".to_osPath\r\n collect_document(input, temp_filename)\r\n \r\n # process the snippets\r\n \r\n if not snippetfiles.nil?\r\n snippets={}\r\n snippetfiles.each{|f|\r\n if File.exists?(f)\r\n type=File.extname(f)\r\n case type\r\n when \".yaml\" \r\n x=YAML.load(File.new(f))\r\n when \".xlsx\"\r\n x=load_snippets_from_xlsx(f)\r\n else\r\n @log.error(\"Unsupported File format for snipptets: #{type}\")\r\n x={}\r\n end\r\n snippets.merge!(x)\r\n else\r\n @log.error(\"Snippet file not found: #{f}\")\r\n end\r\n }\r\n \r\n replace_snippets_in_file(temp_filename, snippets) \r\n end\r\n \r\n \r\n if editions.nil?\r\n # there are no editions\r\n render_document(temp_filename, outdir, outname, format, vars)\r\n else\r\n # process the editions\r\n editions.each{|edition_name, properties|\r\n edition_out_filename = \"#{outname}_#{properties[:filepart]}\"\r\n edition_temp_filename = \"#{@tempdir}/#{edition_out_filename}.md\"\r\n vars[:title] = properties[:title]\r\n\r\n if properties[:debug]\r\n process_debug_info(temp_filename, edition_temp_filename, edition_name.to_s)\r\n lvars=vars.clone \r\n lvars[:linenumbers] = \"true\"\r\n render_document(edition_temp_filename, outdir, edition_out_filename, [\"pdf\", \"latex\"], lvars) \r\n else \r\n filter_document_variant(temp_filename, edition_temp_filename, edition_name.to_s) \r\n render_document(edition_temp_filename, outdir, edition_out_filename, format, vars) \r\n end\r\n }\r\n end\r\n end",
"title": ""
},
{
"docid": "92061d8883e2ba7d3de9438b81e80ab6",
"score": "0.48627734",
"text": "def create\n @lecture = Lecture.new(lecture_params)\n @lecture.my_file = params[:file]\n if @lecture.save\n @f = @lecture.my_file.to_s.downcase\n @pdf = Grim.reap(@lecture.my_file.to_s)\n @count = @pdf.count\n @filename = @lecture.my_file.to_s.split('/').last\n @counter = 0\n @pdf.each do |page|\n page.save(\"./#{@filename}page_#{ @counter }.png\")\n @lecture.slides.create(:urlpage => \"#{@filename}page_#{ @counter }.png\")\n @counter +=1\n end\n redirect_to 'index'\n\n\n\n end\n \n end",
"title": ""
},
{
"docid": "0edc5aa38574844911683de148d963d2",
"score": "0.48601374",
"text": "def write_pages\n pages = Dir[\"#{source_path}/*.html\"].each do |p_name|\n page = Page.new(source_path, File.basename(p_name))\n # TODO allow user to specify which layouts a page should use \n page.render(site_payload, layouts.select{|x| x.name == \"application.html\"})\n page.write(destination_path)\n end\n end",
"title": ""
},
{
"docid": "77d231c30729b38ec028f0ed54729f0b",
"score": "0.4857328",
"text": "def loadSlides(filename)\n return unless filename.end_with? '.md'\n\n content = File.read(File.join(Showoff::Locale.contentPath, filename))\n\n # if there are no !SLIDE markers, then make every H1 define a new slide\n unless content =~ /^\\<?!SLIDE/m\n content = content.gsub(/^# /m, \"<!SLIDE>\\n# \")\n end\n\n slides = content.split(/^<?!SLIDE\\s?([^>]*)>?/)\n slides.shift # has an extra empty string because the regex matches the entire source string.\n\n # this is a counter keeping track of how many slides came from the file.\n # It kicks in at 2 because at this point, slides are a tuple of (options, content)\n seq = slides.size > 2 ? 1 : nil\n\n # iterate each slide tuple and add slide objects to the array\n slides.each_slice(2) do |data|\n options, content = data\n @slides << Showoff::Presentation::Slide.new(options, content, :section => @name, :name => filename, :seq => seq)\n seq +=1 if seq\n end\n\n end",
"title": ""
},
{
"docid": "97b03064983eb93b238c8be238d087a5",
"score": "0.4832072",
"text": "def convert_file(content,user,filename,format)\n name = name_cleaner(filename)\n Dir.glob(\"public/docs/#{user.id.to_s}_*\") do |my_file|\n File.delete(my_file)\n end\n new_file_name = \"#{user.id.to_s}_#{name}.#{format}\"\n Tempfile.open(['pandoc','.html'], Rails.root.join('public/docs') ) do |f|\n f.print(content)\n f.flush\n system(\"pandoc -s -S #{f.path} -o public/docs/#{new_file_name}\")\n f.unlink\n end\n return {filename: new_file_name, filepath: \"public/docs/#{new_file_name}\" } \n end",
"title": ""
},
{
"docid": "e3ae6bc435958d8e8e769da9eb19f75b",
"score": "0.4817559",
"text": "def split_pdfs!(list, density=300, format=:jpg)\n\n #Process each of the command-line arguments;\n #potentially transforming them into lists of split files.\n list.map! { |pdf| split_pdf(pdf, density, format) }\n\n #Flatten the list of files.\n list.flatten!\n\nend",
"title": ""
},
{
"docid": "4962945e8a68af919d1f5ce305063778",
"score": "0.47894362",
"text": "def powerpoint(options={\n :title => '',\n :author => '',\n :images => [],\n :titles => [],\n :notes => [],\n })\n args = {\n :title => options[:report_title],\n :author => options[:author],\n }\n\n images_and_titles = options[:images].zip(options[:titles], options[:notes])\n images_and_titles.each_with_index do |value, i|\n \n filename = value[0]\n title = value[1]\n notes = value[2]\n\n image_data = File.read(filename)\n encoded_image = Base64.encode64(image_data)\n args[\"slide_#{i}_image\"] = encoded_image\n args[\"slide_#{i}_title\"] = title\n args[\"slide_#{i}_notes\"] = notes\n end\n\n call_api('powerpoint', args)\n end",
"title": ""
},
{
"docid": "f2a2941ab137fbd66bb84200488f7885",
"score": "0.47853082",
"text": "def export\n export_file_name = \"#{@export_dir}/#{pptx_file_name}\"\n f = File.new(export_file_name, 'w').close\n\n # Open a bi-directional connection to a Java process that\n # will generate the powerpoint file. Send data to the Java\n # process and receive back either the name of the file that\n # was created or an error message.\n #\n Open3.popen2(java_command) do |stdin, stdout, wait_thr|\n # Send the name of the file we want to create\n\n PptExportWriter.new(@collection, stdin, export_file_name).write\n # Read back the name of the output file from the Java ppt generator\n output_file = stdout.read\n\n # TODO: Error handling\n # We expect output_file == export_file_name.\n # If it's not, something is wrong.\n # If the output_file contains the error_flag instead of\n # the output file name, something went wrong in the Java\n # code.\n # error_flag = /\\AERROR:/\n end\n \n File.chmod(0777,export_file_name)\n export_file_name\n end",
"title": ""
},
{
"docid": "1e573666984b5a01db233f152f95c1b7",
"score": "0.475036",
"text": "def save_as output_path,output_format , storage_type='Aspose',folder_name='',storage_name=''\n begin\n \n if @filename == ''\n raise('input file not specified')\n end \n \n if output_path == ''\n raise('output path not specified')\n end\n \n if output_format == ''\n raise('output format not specified')\n end\n \n # if not File.exist?(inputFile)\n # raise('input file doesn't exist.')\n # end\n \n \n \n str_uri = $product_uri + '/slides/'+@filename+'?format=' + output_format\n if !folder_name.empty?\n str_uri += '?folder=' + folder_name\n end\n if !storage_name.empty?\n str_uri += '&storage=' + storage_name\n end\n str_signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n response_stream = RestClient.get(str_signed_uri,{:accept=>'application/json'})\n valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)\n if valid_output == '' \n output_path = output_path + Aspose::Cloud::Common::Utils.get_filename(@filename) + '.' + output_format\n Aspose::Cloud::Common::Utils.save_file(response_stream,output_path)\n return ''\n else\n return valid_output\n end\n \n rescue Exception=>e\n print e \n end \n end",
"title": ""
},
{
"docid": "695115c6fe5c1b165b61843f28114cea",
"score": "0.4732934",
"text": "def render_epub_layouts\n FileList.new(\"#{@LAYOUT_DIR}/epub/**/*.erb\").each do |layout|\n filename = layout.pathmap(\"%{^#{@LAYOUT_DIR},#{@BUILD_DIR}}X\")\n path = filename.pathmap('%d')\n\n FileUtils.mkpath(path) unless File.exists? path\n\n template = ERB.new(File.read(layout), nil, '-')\n File.open(filename, 'w+') do |handle|\n handle.write template.result(binding)\n end\n end\n\n FileList.new(\"#{@LAYOUT_DIR}/html/**/*.erb\").each do |layout|\n filename = layout.pathmap(\"%{^#{@LAYOUT_DIR},#{@BUILD_DIR}}X\")\n path = filename.pathmap('%d')\n\n FileUtils.mkpath(path) unless File.exists? path\n\n template = ERB.new(File.read(layout), nil, '-')\n File.open(filename, 'w+') do |handle|\n handle.write template.result(binding)\n end\n end\n end",
"title": ""
},
{
"docid": "10b2641b7e97433f30ab9c4337043e74",
"score": "0.4677911",
"text": "def export(fileName, format)\n raise \"Not implemented\"\n end",
"title": ""
},
{
"docid": "23b22dc4577e45bd075586b2a1cf1039",
"score": "0.46420553",
"text": "def pdf_split(input, from, to, output)\n if from == to\n range = from\n else\n range = \"#{from}-#{to}\"\n end\n\n options = [\n input.shellescape,\n 'cat',\n range,\n 'output',\n output.shellescape\n ]\n `pdftk #{options.join(' ')}`\n end",
"title": ""
},
{
"docid": "8bf81db9b0f613dbc134605135d02a99",
"score": "0.4610782",
"text": "def write_articles\r\n puts \"Converting articles to EPUB:\"\r\n STDOUT.flush\r\n progress = ProgressBar.new(\"Converting\", @issue.articles.length)\r\n @issue.articles.each do |article|\r\n if !article.content\r\n next\r\n end\r\n template = ERB.new(File.new(File.join(@dirs[:templates], \"article.html.erb\")).read, nil, \"%\")\r\n output_file = File.new(File.join(@dirs[:content], article_path(article)), \"w+\")\r\n output_file.write(template.result(binding))\r\n output_file.close\r\n progress.inc\r\n end\r\n progress.finish\r\n puts ''\r\n end",
"title": ""
},
{
"docid": "d7daaf10a53ee942083a1db0de1ae537",
"score": "0.46070173",
"text": "def export_filenames(min_id, max_id)\n export_filenames = []\n (min_id..max_id).in_chunks(@chunks) do |min, max|\n export_filenames << export_file_path(min, max)\n end\n\n export_filenames\n end",
"title": ""
},
{
"docid": "45feebef70665c1c663298f1afa552a7",
"score": "0.46023262",
"text": "def figlist_to_file(filepath)\n File.open(filepath, \"w\") do |file|\n file << self.generate_figlist\n end\n end",
"title": ""
},
{
"docid": "1a7e816fdc717cb907af65b270e0e63c",
"score": "0.4599829",
"text": "def split(name, options = nil, format = nil, width = nil, height = nil, from = nil, to = nil, dest_folder = nil, password = nil, folder = nil, storage = nil, fonts_folder = nil)\n data, _status_code, _headers = split_with_http_info(name, options, format, width, height, from, to, dest_folder, password, folder, storage, fonts_folder)\n data\n end",
"title": ""
},
{
"docid": "32bd757bedac6b23a65f6cbc2d701c78",
"score": "0.4597143",
"text": "def slides(folder = \"slides\")\n results = []\n Dir[\"./source/#{folder}/_*.{html,md}.*\"].each do |slide_path|\n slide_path = slide_path.gsub(\"./source/\", \"\").gsub(\"/_\", \"/\").gsub(/$_/, \"\")\n results << slide_path\n end\n results\n end",
"title": ""
},
{
"docid": "dd00495c0886e673268a3dd0af5b47fb",
"score": "0.45894006",
"text": "def extract_first_page_images\n #######\n # Docsplit.extract_images(document.file.file, :size => %w{200x 700x 1000x}, :format => :jpg, :pages => %w{1}, output: output_path)\n Docsplit.extract_images(file.path, :size => %w{200x 700x 1000x}, :format => :jpg, :pages => %w{1}, output: \"public/#{self.docsplit_dir}\" )\n \n # def store_path(for_file=filename)\n # # File.join([store_dir, full_filename(for_file)].compact)\n # \"#{self.model.class.to_s.underscore}\" + \"/\" + \"#{mounted_as}\" + \"/\" + \"#{self.model.user.uuid.to_s}\" + \"/\" + \"#{self.model.slug}\" + \"/\" + \"#{(version_name || :original).to_s}\" + \"_\" + \"#{self.file.basename}\" + \".jpg\"\n # end\n # if Rails.env.production?\n # document.store!(new_file=\"#{output_path}/200x/#{document.model.file_name.chomp(document.model.document.file.extension)[0..-2]}_1.jpg}\")\n # document.store!(new_file=\"#{output_path}/700x/#{document.model.file_name.chomp(document.model.document.file.extension)[0..-2]}_1.jpg}\")\n # document.store!(new_file=\"#{output_path}/1000x/#{document.model.file_name.chomp(document.model.document.file.extension)[0..-2]}_1.jpg}\")\n # end\n # Docsplit.extract_images(document.file.file, :size => %w{200x 700x 1000x}, :format => :jpg, :pages => %w{1}, output: \"/tmp/uploads/docsplit/#{model.class.to_s.underscore}/#{model.slug}\")\n\n\n # ::Docsplit.extract_images(self.pdf, :size => %w{200x 700x 1000x}, :format => :jpg, :pages => %w{1}, output: output_path)\n # if Rails.env.production?\n # # Rename file folders. \n # FileUtils.mv local_output_path + \"160x\", s3_output_path + \"160x\"\n # FileUtils.mv local_output_path + \"700x\", s3_output_path + \"700x\"\n # FileUtils.mv local_output_path + \"1000x\", s3_output_path + \"1000x\"\n # end\n \n true\n # self\n end",
"title": ""
},
{
"docid": "6cbd273cebeb5a37088b14bd73ccfd91",
"score": "0.4574436",
"text": "def convert_to_image page_number, image_format\n begin\n \n if page_number == ''\n raise('page number not specified')\n end\n \n if image_format == ''\n raise 'image format not specified'\n end\n \n str_uri = $product_uri + '/pdf/' + @filename + '/pages/' + page_number.to_s + '?format=' + image_format\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) + '_' + page_number.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 rescue Exception=>e\n print e \n end \n end",
"title": ""
},
{
"docid": "60cb6be42ab317813d5155616655a8ab",
"score": "0.45683345",
"text": "def index\n #@deck = Powerpoint::Presentation.new\n # Creating an introduction slide:\n # title = 'Bicycle Of the Mind'\n # subtitle = 'created by Steve Jobs'\n # @deck.add_intro title, subtitle\n\n # Creating a text-only slide:\n # Title must be a string.\n # Content must be an array of strings that will be displayed as bullet items.\n # title = 'Why Mac?'\n # content = ['Its cool!', 'Its light.']\n # @deck.add_textual_slide title, content\n\n # Creating an image Slide:\n # It will contain a title as string.\n # and an embeded image\n #title = 'Everyone loves Macs:'\n #subtitle = 'created by Steve Jobs'\n #content = ['Its cool!', 'Its light.']\n #image_path = ActionController::Base.helpers.asset_path('/app/assets/images/ss.png').to_s\n #image = view_context.image_path 'ss.png'\n #url = 'http://localhost:3000' + image\n #image = view_context.image_path 'https://res.cloudinary.com/indoexchanger/image/upload/v1501168483/qxbvro2yhvibid0ra5rp.jpg'\n #puts image\n #@deck.add_pictorial_slide title, url\n #@deck.add_textual_slide title, subtitle\n #\n\n # Specifying coordinates and image size for an embeded image.\n # x and y values define the position of the image on the slide.\n # cx and cy define the width and height of the image.\n # x, y, cx, cy are in points. Each pixel is 12700 points.\n # coordinates parameter is optional.\n # coords = {x: 124200, y: 3356451, cx: 2895600, cy: 1013460}\n # @deck.add_pictorial_slide title, image_path, coords\n\n # Saving the pptx file to the current directory.\n #@deck.save('mps.pptx')\n # @products = Product.all\n # \n \n @presentation = RubySlides::Presentation.new\n \n chart_title = \"Chart Slide exported from ruby\"\n chart_series = [\n {\n column: \"Col1\",\n rows: [\"Lorem\", \"Ipsum\", \"Dolar\", \"Ismet\"],\n values: [\"1\", \"3\", \"5\", \"7\"]\n },\n {\n column: \"Col2\",\n color: 'FF9800',\n rows: [\"A\", \"B\", \"C\", \"D\"],\n values: [\"2\", \"4\", \"6\", \"8\"]\n }\n ]\n @presentation.chart_slide chart_title, chart_series\n\n @presentation.save('mps.pptx')\n\n @products = Product.order('created_at DESC')\n respond_to do |format|\n format.html\n format.xlsx {\n response.headers['Content-Disposition'] = 'attachment; filename=\"all_products.xlsx\"'\n }\n end\n end",
"title": ""
},
{
"docid": "237e4692dd32b79d6c6e242d1c0911fa",
"score": "0.45434657",
"text": "def split_input filename, pieces\n input = {}\n name = nil\n seq=\"\"\n sequences=0\n output_files=[]\n if pieces > 1\n File.open(filename).each_line do |line|\n if line =~ /^>(.*)$/\n sequences+=1\n if name\n input[name]=seq\n seq=\"\"\n end\n name = $1\n else\n seq << line.chomp\n end\n end\n input[name]=seq\n # construct list of output file handles\n outputs=[]\n pieces = [pieces, sequences].min\n pieces.times do |n|\n outfile = \"#{filename}_chunk_#{n}.fasta\"\n outfile = File.expand_path(outfile)\n outputs[n] = File.open(\"#{outfile}\", \"w\")\n output_files[n] = \"#{outfile}\"\n end\n # write sequences\n count=0\n input.each_pair do |name, seq|\n outputs[count].write(\">#{name}\\n\")\n outputs[count].write(\"#{seq}\\n\")\n count += 1\n count %= pieces\n end\n outputs.each do |out|\n out.close\n end\n else\n output_files << filename\n end\n output_files\n end",
"title": ""
},
{
"docid": "a82f766185d860228e72d76beef55c86",
"score": "0.45357013",
"text": "def save_slide(name, slide_index, format, out_path, options = nil, width = nil, height = nil, password = nil, folder = nil, storage = nil, fonts_folder = nil)\n save_slide_with_http_info(name, slide_index, format, out_path, options, width, height, password, folder, storage, fonts_folder)\n nil\n end",
"title": ""
},
{
"docid": "c66a9a9ff3ba66d48c79a6ad8204fbd5",
"score": "0.4534953",
"text": "def additional_export_formats(document, format)\n document.export_formats.each_key do |format_name|\n format.send(format_name.to_sym) { render body: document.export_as(format_name), layout: false }\n end\n end",
"title": ""
},
{
"docid": "b951028d7d19bdd0b099bf8679808dd7",
"score": "0.45133203",
"text": "def transform(file, format:); end",
"title": ""
},
{
"docid": "e4866b48adcc05ba21ce81596eb3a16c",
"score": "0.45070085",
"text": "def convert_to_image_by_size(page_number, image_format, width=0, height=0)\n \n begin\n \n if @filename == ''\n raise('filename not specified')\n end\n \n if page_number == ''\n raise('page number not specified')\n end\n \n if image_format == ''\n raise('image format not specified')\n end\n \n \n str_uri = $product_uri + '/pdf/' + @filename + '/pages/' + page_number.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) + '_' + page_number.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 rescue Exception=>e\n print e\n end\n \n end",
"title": ""
},
{
"docid": "42c8b126f4b7ba4d95a5ae55bb2033a2",
"score": "0.449877",
"text": "def convertSlidesToVideo(presentationSlidesStart)\n presentationSlidesStart.each do |item|\n # Path to original svg\n originalLocation = File.join(item[\"filepath\"], item[\"filename\"])\n # Save conversion with similar path in tmp\n dirname = File.join(TMP_PATH, item[\"presentationName\"], \"svgs\")\n finalLocation = File.join(dirname, changeFileExtensionTo(item[\"filename\"], \"mp4\"))\n\n if (!File.exists?(finalLocation))\n # Create path to save conversion to\n unless File.directory?(dirname)\n FileUtils.mkdir_p(dirname)\n end\n\n # Convert to png\n image = MiniMagick::Image.open(originalLocation)\n image.format 'png'\n pathToImage = File.join(dirname, changeFileExtensionTo(item[\"filename\"], \"png\"))\n image.write pathToImage\n\n # Convert to video\n # Scales the output to be divisible by 2\n system \"ffmpeg -loglevel quiet -nostdin -nostats -y -r 30 -i #{pathToImage} -vf crop='trunc(iw/2)*2:trunc(ih/2)*2' #{finalLocation}\"\n end\n\n item[\"filepath\"] = dirname\n item[\"filename\"] = finalLocation.split('/').last\n end\n\n return presentationSlidesStart\nend",
"title": ""
},
{
"docid": "4722fb61eb0ee9d99c479a967b332fb2",
"score": "0.4472526",
"text": "def process\n self.read_layouts\n self.transform_pages\n if options['also_copy']\n self.transform_pages('', options['also_copy'])\n end\n self.write_posts\n end",
"title": ""
},
{
"docid": "8fa64c889c2bc339e84938d8d72828d8",
"score": "0.44695765",
"text": "def splitpdf\n require 'pashua'\n include Pashua\n docu = Document.path.get[0]\n dname = Document.name.get[0][0..-5]\n page = Document.get[0].current_page.get.index.get\n\n # configuring Pashua dialogue\n config = \"\n *.title = researchr\n fb.type = textfield\n fb.default = 1\n fb.label = Starting on page #{page}, how many pages to extract?\\n\n xb.type = checkbox\n xb.label = last page number, instead of number of pages\n db.type = cancelbutton\n db.label = Cancel\n db.tooltip = Closes this window without taking action\\n\"\n\n pagetmp = pashua_run config\n exit if pagetmp['cancel'] == 1\n\n startpage = page.to_i\n tmppage = pagetmp['fb'].to_i\n if pagetmp['xb'] == \"1\"\n endpage = tmppage\n else\n endpage = pagetmp['fb'].to_i + startpage - 1\n end\n\n outfile = \"#{Downloads_path}/#{dname[0..-5]}-split.pdf\"\n\n `pdfmanipulate split \"#{docu}\" #{startpage}-#{endpage} -o \"#{outfile}\"`\n puts \"pdfmanipulate split \\\"#{docu}\\\" #{startpage}-#{endpage} -o \\\"#{outfile}\\\"\"\n growl(\"File extracted and put in Downloads directory\")\nend",
"title": ""
},
{
"docid": "08df798eaf050f1ddf98427039c743bf",
"score": "0.44628292",
"text": "def split_in_paragraphs(mode)\n paragraphs.each(&:destroy) # delete paragraphs (should delete associated opinions)\n pattern = case mode\n when \"br\" then /<br \\/>|<br\\/>|<br>/\n when \"p_br\" then /<br \\/>|<br\\/>|<br>|<p>|<\\/p>/\n when \"p\" then /<p>|<\\/p>/\n end\n if pattern\n content.split(pattern).each_with_index do |paragraph_content, counter|\n paragraph_content = cleanup_paragraphs(paragraph_content)\n if paragraph_content != \"\"\n self.paragraphs.create(:ranking_number => counter, :content => paragraph_content, :review_id => self.id)\n end\n end\n else\n # 1 paragraph == whole content\n self.paragraphs.create(:ranking_number => 0, :content => cleanup_paragraphs(content))\n end \n end",
"title": ""
},
{
"docid": "787470079e74216f3cdc09212b643463",
"score": "0.44576186",
"text": "def imagepipeline\n # delete non-image files\n images = Dir.entries(@from_dir).delete_if do |file|\n (file =~ /\\w+\\.(jpg|jpeg)/) == nil\n end\n images.each do |file|\n yield File.join(@from_dir,file), File.join(@to_dir,file)\n end\n end",
"title": ""
},
{
"docid": "dfd19f6c692427c32a9e2f822b1512e6",
"score": "0.44552246",
"text": "def render_document_export_format format_name\n render\n rescue ActionView::MissingTemplate\n render plain: @response.documents.map { |x| x.export_as(format_name) if x.exports_as? format_name }.compact.join(\"\\n\"), layout: false\n end",
"title": ""
},
{
"docid": "d1fb33f58a45813ec94240ef6136d9ca",
"score": "0.44384313",
"text": "def document_export_formats(format)\n format.any do\n format_name = params.fetch(:format, '').to_sym\n if @response.export_formats.include? format_name\n render_document_export_format format_name\n else\n raise ActionController::UnknownFormat\n end\n end\n end",
"title": ""
},
{
"docid": "79c5afd56e69e8479186408844a4f591",
"score": "0.4434325",
"text": "def slides\n @id = params[:id]\n @item = Item.find(@id)\n begin\n @slides = @item.images.where(['publish=?', true]).order('position')\n rescue => error\n flash[:error] = error.message\n ensure\n # no slides found so create some\n if @slides.empty?\n @slides = @item.create_images\n end\n end\n unless @id.nil? || @slides.nil? || @slides.empty?\n respond_to do |format|\n format.xml\n end\n else\n flash[:error] = 'Unable to locate process slides for id number ' + params[:id].to_s + '.'\n end\n end",
"title": ""
},
{
"docid": "c3d8d4eb05ce6de7afe084d7db77b5fa",
"score": "0.44217345",
"text": "def generate_images\n Docsplit.extract_images(@files.to_s)\n end",
"title": ""
},
{
"docid": "4ac923eefe06221e48516ce4f2124c09",
"score": "0.4416728",
"text": "def split_online_with_http_info(document, format, width = nil, height = nil, from = nil, to = nil, password = nil, storage = nil, fonts_folder = nil, options = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.split_online ...'\n end\n\n # verify the required parameter 'document' is set\n if @api_client.config.client_side_validation && document.nil?\n fail ArgumentError, \"Missing the required parameter 'document' when calling SlidesApi.split_online\"\n end\n # verify the required parameter 'format' is set\n if @api_client.config.client_side_validation && format.nil?\n fail ArgumentError, \"Missing the required parameter 'format' when calling SlidesApi.split_online\"\n end\n # verify enum value\n if @api_client.config.client_side_validation && !['Jpeg', 'Png', 'Gif', 'Bmp', 'Tiff', 'Html', 'Pdf', 'Xps', 'Pptx', 'Odp', 'Otp', 'Ppt', 'Pps', 'Ppsx', 'Pptm', 'Ppsm', 'Potx', 'Pot', 'Potm', 'Svg', 'Fodp', 'Xaml', 'Html5'].any?{ |s| s.casecmp(format)==0 }\n fail ArgumentError, \"Invalid value for parameter format: \" + format + \". Must be one of Jpeg, Png, Gif, Bmp, Tiff, Html, Pdf, Xps, Pptx, Odp, Otp, Ppt, Pps, Ppsx, Pptm, Ppsm, Potx, Pot, Potm, Svg, Fodp, Xaml, Html5\"\n end\n # resource path\n local_var_path = '/slides/split/{format}'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'format', format)\n\n # query parameters\n query_params = {}\n query_params[:'width'] = @api_client.prepare_for_query(width) unless width.nil?\n query_params[:'height'] = @api_client.prepare_for_query(height) unless height.nil?\n query_params[:'from'] = @api_client.prepare_for_query(from) unless from.nil?\n query_params[:'to'] = @api_client.prepare_for_query(to) unless to.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n query_params[:'fontsFolder'] = @api_client.prepare_for_query(fonts_folder) unless fonts_folder.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['multipart/form-data'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = @api_client.object_to_http_body(options)\n\n # form parameters\n post_files = []\n if document\n post_files = post_files.push(document)\n end\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'File')\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "d02ce437ae416e6f4ffa9dfa07737726",
"score": "0.44159764",
"text": "def write_posts\n posts.each do |p|\n # TODO allow user to specify which layouts a post should use \n p.render(layouts)\n p.write(File.join(destination_path, \"posts\"))\n end\n end",
"title": ""
},
{
"docid": "d5ec11b0dd885da1b73ffe10fcaef155",
"score": "0.44028553",
"text": "def export articles\n # Check if we need to print a header and if so, print it\n if @formatter.header?\n @file.puts @formatter.header(articles.first)\n end\n\n # Fail if any article is not an instance of News::Article\n fail Exception, \"passed in articles array including non article objects\" if articles.any? { |e| !e.is_a?(Article) }\n\n # Iterate through each article, write the output for that article from the formatter\n articles.each do |article|\n @file.puts @formatter.article_representation(article)\n end\n\n # Print footer if required\n if @formatter.footer?\n @file.puts @formatter.footer(articles.first) \n end\n\n end",
"title": ""
},
{
"docid": "add186abc5f0dc0c0347439aba701acd",
"score": "0.43808734",
"text": "def split_document_xlsx(input_file, opts = {})\n data, _status_code, _headers = split_document_xlsx_with_http_info(input_file, opts)\n data\n end",
"title": ""
},
{
"docid": "a1ad5ee0798fdee7a255c8f91e3c0e1f",
"score": "0.4372351",
"text": "def split_input filename, pieces\n input = {}\n name = nil\n seq=\"\"\n sequences=0\n File.open(filename).each_line do |line|\n if line =~ /^>(.*)$/\n sequences+=1\n if name\n input[name]=seq\n seq=\"\"\n end\n name = $1\n else\n seq << line.chomp\n end\n end\n input[name]=seq\n # construct list of output file handles\n outputs=[]\n output_files=[]\n pieces = [pieces, sequences].min\n pieces.times do |n|\n outfile = File.basename(\"#{filename}_chunk_#{n}.fasta\")\n outfile = \"#{@working_dir}/#{outfile}\"\n outputs[n] = File.open(\"#{outfile}\", \"w\")\n output_files[n] = \"#{outfile}\"\n end\n # write sequences\n count=0\n input.each_pair do |name, seq|\n outputs[count].write(\">#{name}\\n\")\n outputs[count].write(\"#{seq}\\n\")\n count += 1\n count %= pieces\n end\n outputs.each do |out|\n out.close\n end\n output_files\n end",
"title": ""
},
{
"docid": "d16391c38c6e5b4530123d852effc088",
"score": "0.4354574",
"text": "def files_to_page\n insert_to_page('div', html)\n insert_to_page('script', js, false)\n insert_to_page('style', style, false)\n end",
"title": ""
},
{
"docid": "868aa1b2443d9aa1d7fbf248b35c59f4",
"score": "0.4352261",
"text": "def generate_splitted_timeline\n\n if @sheet_orientation == \"portrait\" then\n orientation = \"\"\n paperwidth = 21 - 2 * @cut_margins\n paperheight = 29.7\n else\n orientation = \"landscape,\"\n paperwidth = 29.7 - 2 * @cut_margins\n paperheight = 21\n end\n\n p = \"\\\\documentclass[#{orientation}oneside,a4paper]{article}\"\n p << '\\usepackage{pdfpages}'\n p << '\\usepackage{tikz}'\n p << '\\usepackage{geometry}'\n p << '\\usepackage[center,cross,a4,pdflatex]{crop}'\n p << \"\\\\geometry{paperwidth=#{paperwidth}cm,paperheight=#{paperheight}cm,left=0cm,top=0cm,bottom=0cm,right=0cm,nohead}\"\n\n p << '\\newcommand*\\topline{'\n p << '\\begin{picture}(0,0)'\n p << ' \\thinlines\\unitlength1cm'\n p << ' \\put(0,-2){\\line(0,1){4}}'\n p << '\\end{picture}}'\n\n p << '\\newcommand*\\bottomline{'\n p << '\\begin{picture}(0,0)'\n p << ' \\thinlines\\unitlength1cm'\n p << ' \\put(0,-2){\\line(0,1){4}}'\n p << '\\end{picture}}'\n p << '\\cropdef\\relax\\topline\\relax\\bottomline{first}'\n p << '\\cropdef\\topline\\relax\\bottomline\\relax{last}'\n p << '\\cropdef\\topline\\topline\\bottomline\\bottomline{lines}'\n\n p << '\\begin{document}'\n p << '\\pagestyle{empty}'\n p << '\\thispagestyle{empty}'\n p << '\\crop[first]'\n\n xoffset = 0\n (1..@nb_sheets).each do |n|\n p << \"\\\\includepdf[viewport= #{xoffset}cm 0cm #{xoffset + paperwidth}cm #{paperheight}cm, offset=0 0, delta=0 0, noautoscale=true, clip=true]{#{@output_filename}.pdf}\"\n p << (n == (@nb_sheets - 1) ? '\\crop[last]' : '\\crop[lines]')\n xoffset += paperwidth - 2 * @overlapping\n end\n\n p << '\\end{document}'\n\n return p\n\nend",
"title": ""
},
{
"docid": "2a35f82d1bb2aebd44d64eac2dfd2f33",
"score": "0.43496147",
"text": "def document_export_formats(format, response)\n format.any do\n format_name = params.fetch(:format, '').to_sym\n\n if response.export_formats.include? format_name\n render_document_export_format format_name, response\n else\n raise ActionController::UnknownFormat.new\n end\n end\n end",
"title": ""
},
{
"docid": "d46a20463be52121d01d7cbe4108a36e",
"score": "0.4340437",
"text": "def format_file\n archiveFormat = @archive.to_s.split('\\n')\n archiveFormat.shift()\n archiveFormat.shift()\n archiveFormat.shift()\n archiveFormat.shift()\n archiveFormat.pop()\n archiveFormat.pop()\n archiveFormat\n end",
"title": ""
},
{
"docid": "8dd3e2491eb32ad795bade887b786e58",
"score": "0.43402132",
"text": "def extract(start_page, end_page, output_suffix: '', input_path: 'budget-pdf', output_path: 'lib/budget-html')\n proj_root_path, pdf_dir = gen_dirs(input_path, output_path)\n\n Dir.foreach(pdf_dir) do |filename|\n next if filename == '.' or filename == '..'\n filename_without_extension = filename.split('.').first\n output_filename = gen_output_filename(filename_without_extension, output_suffix)\n\n puts \"converting #{filename} to #{output_filename}\"\n \n system extract_cmd(start_page, end_page, proj_root_path, File.join(input_path, filename), File.join(output_path, output_filename))\n end\n\n puts 'done'\n end",
"title": ""
},
{
"docid": "6055f76a3676fc4ee693ae497d02f2e3",
"score": "0.43373594",
"text": "def to_xls\n\n doc = Spreadsheet::Workbook.new # start the excel document\n\n # create the project information worksheet\n tab1 = doc.create_worksheet :name => \"Project Information\"\n\n # write a few lines to the sheet\n tab1.row(1).concat ['This','is','file','1','row','1']\n tab1.row(2).concat ['This','is','file','1','row','2']\n tab1.row(3).concat ['This','is','file','1','row','3']\n\n doc2 = Spreadsheet::Workbook.new\n d2t1 = doc2.create_worksheet :name=>'P1'\n d2t1.row(0).concat [\"a little somethin somethin for doc 2\"]\n files = [\"#{user}_ef_1.xls\",\"#{user}_ef_2.xls\" ]\n doc.write \"exports/#{files[0]}\"\n doc2.write \"exports/#{files[1]}\"\n return files\n end",
"title": ""
},
{
"docid": "b81a20cca6d5b25497afc922d9f21693",
"score": "0.43347728",
"text": "def example_markdown_targets()\n target_files = []\n\n example_dir = File.join(K4_ROOT, 'example')\n ext = 'md'\n filelist = FileList[File.join(example_dir, \"*.#{ext}\")]\n filelist.each do |source_path|\n source_basename = File.basename(source_path)\n next if source_basename =~ /^_/\n\n source_basename = source_basename.gsub(/#{ext}$/, 'html')\n target_path = File.join(example_dir, source_basename)\n # File.delete(target_path) if File.exists?(target_path)\n\n file(target_path) do |t, args|\n puts t.name\n src = File.read(source_path)\n compiler_ = MarkdownCompiler.new(@compiler)\n html_source = compiler_.to_slide(src)\n File.open(target_path, 'w') do |io|\n io.write(html_source)\n end\n end\n target_files << target_path\n end\n return target_files\n end",
"title": ""
},
{
"docid": "bda72e88859329d0d78eb5e94b43b9ae",
"score": "0.43146",
"text": "def folding_ranges(filename); end",
"title": ""
},
{
"docid": "ca78045dad8b834c7ec29cd6e01aab33",
"score": "0.4308394",
"text": "def splitByFile\n outfile = nil\n stream = open(@filename)\n until (stream.eof?)\n line = stream.readline\n\n # we need to create a new file\n if (line =~ /--- .*/) == 0\n if (outfile) \n outfile.close_write\n end\n #find filename\n tokens = line.split(\" \")\n tokens = tokens[1].split(\":\")\n tokens = tokens[0].split(\"/\")\n filename = tokens[-1]\n filename << \".patch\"\n if File.exists?(filename)\n puts \"File #{filename} already exists. Renaming patch.\"\n appendix = 0\n while File.exists?(\"#{filename}.#{appendix}\")\n appendix += 1\n end\n filename << \".#{appendix}\"\n end\n outfile = open(filename, \"w\")\n outfile.write(line)\n else\n if outfile\n outfile.write(line)\n end\n end\n end\n end",
"title": ""
},
{
"docid": "47b3ebcc46a9cc474b7ed5dca4c409a2",
"score": "0.43057162",
"text": "def convert images_directory , pdfs_directory\n\n # Get all files from that directory\n all_images = Dir.entries(images_directory)\n\n #Segregate only the required the question paper images , just in case the directory contains other files\n all_images.keep_if { |a| ((a.start_with? \"mid-\") || (a.start_with? \"end-\")) && ((a.end_with? \".jpg\") || (a.end_with? \".png\") || (a.end_with? \".tif\") || (a.end_with? \".gif\") || (a.end_with? \".svg\") || (a.end_with? \".bmp\"))}\n\n #Store number of images as a variable to show % finished\n number_of_images = all_images.count\n\n # Initialisation of variables like Array of names of papers , eg. mid-spring-2016-MA20104\n Dir.chdir(images_directory)\n papernames_array = []\n i = 0\n all_images = all_images.sort\n stack = Magick::ImageList.new\n\n #Loop through all paper images & batch merge them into PDFs , even if a paper has 3 pages / images\n all_images.each do |file|\n papernames_array[i] = file[0..22]\n if i == 0\n Dir.chdir(images_directory)\n stack = Magick::ImageList.new\n incoming = Magick::ImageList.new file\n stack.concat(incoming)\n else\n if papernames_array[i].eql? papernames_array[i-1]\n Dir.chdir(images_directory)\n incoming = Magick::ImageList.new file\n stack.concat(incoming)\n else\n Dir.chdir(pdfs_directory)\n stack.write(papernames_array[i-1]+\".pdf\")\n Dir.chdir(images_directory)\n stack = Magick::ImageList.new\n incoming = Magick::ImageList.new file\n stack.concat(incoming)\n end\n if i == number_of_images-1\n Dir.chdir(pdfs_directory)\n stack.write(papernames_array[i]+\".pdf\")\n end\n end\n i = i + 1\n percentage = (i.to_f/number_of_images.to_f) * 100\n puts \"Processing #{i}/#{number_of_images} images , #{percentage}% done\"\n end\nend",
"title": ""
},
{
"docid": "9bae8c9cf98183410532e26c62797402",
"score": "0.43006912",
"text": "def append_document append_docs, import_format_modes, source_folder\n begin\n\n if append_docs.length != import_format_modes.length\n raise 'Please specify complete documents and import format modes.'\n end\n\n str_uri = $product_uri + '/words/' + @filename + '/appendDocument'\n signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n\n objs = []\n\n i = 0\n append_docs.each do |val|\n objs << {\"Href\" => source_folder.empty? ? val : source_folder + \"\\\\\" + val, \"ImportFormatMode\" => import_format_modes[i]}\n i = i+1\n end\n\n json_data = JSON.generate({'DocumentEntries' => objs})\n\n response_stream = RestClient.post(signed_str_uri, json_data, {:content_type => :json})\n\n valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)\n\n return valid_output unless valid_output.empty?\n folder = Aspose::Cloud::AsposeStorage::Folder.new\n\n output_stream = folder.get_file(source_folder.empty? ? @filename : (source_folder + '/' + @filename))\n output_path = $out_put_location + @filename\n Aspose::Cloud::Common::Utils.save_file(output_stream, output_path)\n ''\n rescue Exception => e\n print e\n end\n end",
"title": ""
},
{
"docid": "9b21386e8f6960dc66fd240c305b1717",
"score": "0.43006724",
"text": "def index\n @contents = @slide.contents\n redirect_to new_presentation_slide_content_path(@presentation, @slide) unless @contents.any?\n end",
"title": ""
},
{
"docid": "918dde8c0dc4d6c7e99d40ed4aef0f65",
"score": "0.42954147",
"text": "def export\n @pages.each_with_index do |page, i|\n puts \"Export:\"\n=begin\n #page.load_original\n ScanEnhancer::profile(\"fill_invert\") {\n page.content.fill_invert\n }\n ScanEnhancer::profile(\"Deskew\") {\n page.deskew!\n }\n ScanEnhancer::profile(\"threshold\") {\n page.threshold!\n }\n=end\n ScanEnhancer::profile(\"export\") {\n page.export(\"page-%04d.tif\" % [@page_number_start + @page_number_step*i])\n #page.export_data(\"page-%04d.tif\" % [@page_number_start + @page_number_step*i])\n }\n page.free_data!\n puts \"\"\n end\n end",
"title": ""
},
{
"docid": "b030def83d39918212434efd281cfec5",
"score": "0.4291497",
"text": "def parse(filenames)\n filenames = [filenames] unless filenames.is_a?(Enumerable)\n\n return guess_template(filenames.first) if filenames.length < 2\n\n # Sometimes the name of the last episode is '42 END something.mp4'\n # Change this to '42 something.mp4' (remove the \" END\" part)\n pat = /(\\d+)\\s*\\b(?:#{IGNORE_WORDS.join('|')})\\b/\n has_end_in_template = filenames.any? { |fn| fn =~ pat }\n filenames.map! { |fn| fn.sub(pat, '\\1') } if has_end_in_template\n\n (fn1, fn2) = similar_two(filenames, 2)\n\n if fn1.length != fn2.length\n raise \"Filenames have different lengths (#{fn1.length}, #{fn2.length})\"\n end\n\n template = ''\n placeholder_idx = nil\n flag = true\n # fn1 and fn2 have same lengths\n 0.upto(fn1.length - 1).each do |i|\n if fn1[i] == fn2[i]\n template << fn1[i]\n elsif flag\n flag = false\n template << PLACEHOLDER\n placeholder_idx = i\n\n # Make the template foobar{}{*}baz.mp4 where {*} is for the 'END'\n template << PLACEHOLDER_GLOB if has_end_in_template\n end\n end\n\n # Assume that the correct template was obtained and find the first and\n # last episode numbers\n sorted_episode_numbers = filenames \\\n .select { |fn| fn.size == fn1.size } \\\n # Ignore everything up to the placeholder\n .map { |fn| fn[placeholder_idx..-1] } \\\n # Filenames should now begin with episode numbers (or nil)\n .map { |fn| fn.match(/^\\d+/) && Regexp.last_match(0) } \\\n # Remove nil elements\n .compact \\\n .map(&:to_i) \\\n .sort\n\n first_ep = sorted_episode_numbers.first\n last_ep = sorted_episode_numbers.last\n\n [template, first_ep, last_ep]\n end",
"title": ""
},
{
"docid": "88846a87276fe6f5deebd7f140ad4838",
"score": "0.42911625",
"text": "def save_presentation(name, format, out_path, options = nil, password = nil, folder = nil, storage = nil, fonts_folder = nil, slides = nil)\n save_presentation_with_http_info(name, format, out_path, options, password, folder, storage, fonts_folder, slides)\n nil\n end",
"title": ""
},
{
"docid": "1067d6113cf487c7f7ecef7fcf046f1c",
"score": "0.42762423",
"text": "def compute_parts(source, default_part_size)\n size = File.size(source)\n offset, part_number, parts = 0, 1, []\n while offset < size\n parts << {\n part_number: part_number,\n body: FilePart.new(source: source, offset: offset, size: part_size(size, default_part_size, offset))\n }\n\n part_number += 1\n offset += default_part_size\n end\n parts\n end",
"title": ""
},
{
"docid": "afb46c16328b6a25495ba05531b5c1b2",
"score": "0.42650282",
"text": "def parts( format )\n @parts[format.to_s] ||= file ? @storage.find_page_parts( file, @lang, format.to_s ) : {}\n end",
"title": ""
},
{
"docid": "24e8e6bf033a84b5e6e6932bc5ee1540",
"score": "0.4264843",
"text": "def write_presenter_definitions!\n presenter_definitions = presenters\n .formatted(format)\n .inject({}) do |definitions, object_with_definition|\n\n definitions.merge(object_with_definition)\n end\n\n inject_objects_under_key!(:definitions, presenter_definitions, true)\n end",
"title": ""
},
{
"docid": "bda149f4b3eda19614f66972d7425bbb",
"score": "0.42609793",
"text": "def htmls_to_pdfs(opts)\n base_dir = base_dir(opts[:base_dir])\n Html2Pdf::CLI.start [\n \"export\",\n \"--base-dir\",\n base_dir,\n \"--recursive\"]\n end",
"title": ""
},
{
"docid": "f1043d7e339d56f167beaa500fad4fec",
"score": "0.42585284",
"text": "def push(slide)\n n = to_a.size + 1\n # Paths within the zip file of new files we have to write.\n slide_path = Pathname.new(\"/ppt/slides/slide#{n}.xml\")\n slide_rels_path = Pathname.new(\"/ppt/slides/_rels/slide#{n}.xml.rels\")\n slide_notes_path = Pathname.new(\"/ppt/notesSlides/notesSlide#{n}.xml\")\n slide_notes_rels_path = Pathname.new(\"/ppt/notesSlides/_rels/notesSlide#{n}.xml.rels\")\n\n # Update ./ppt\n # !!! CREATE !!!\n # ./slides\n # Create new files\n # ./slide(\\d+).xml file\n @doc.copy slide_path, slide.path\n # ./_rels/slide(\\d+).xml.rels\n @doc.copy slide_rels_path, slide.rels.path\n # ./notesSlides\n # Create new files\n # ./notesSlide(\\d+).xml file\n @doc.copy slide_notes_path, slide.notes.path\n # ./_rels/notesSlide(\\d+).xml.rels\n @doc.copy slide_notes_rels_path, slide.notes.rels.path\n \n # !!! UPDATES !!!\n # Update the notes in the new slide to point at the new notes\n @doc.edit_xml slide_rels_path do |xml|\n # TODO - Move this rel logic into the parts so that we don't have to repeat ourselves when calculating this stuff out.\n xml.at_xpath(\"//xmlns:Relationship[@Type='#{Notes::REL_TYPE}']\")['Target'] = slide_notes_path.relative_path_from(slide_path.dirname)\n end\n\n # Update teh slideNotes reference to point at the new slide\n @doc.edit_xml slide_notes_rels_path do |xml|\n xml.at_xpath(\"//xmlns:Relationship[@Type='#{Slide::REL_TYPE}']\")['Target'] = slide_path.relative_path_from(slide_notes_path.dirname)\n end\n\n # ./_rels/presentation.xml.rels\n # Update Relationship ids\n # Insert a new one slideRef\n @doc.edit_xml @doc.presentation.rels.path do |xml|\n # Calucate the next id\n next_id = xml.xpath('//xmlns:Relationship[@Id]').map{ |n| n['Id'] }.sort.last.succ\n # TODO - Figure out how to make this more MS idiomatic up 9->10 instead of incrementing\n # the character....\n # Insert that into the slide and crakc open the presentation.xml file\n types = xml.at_xpath('/xmlns:Relationships')\n types << Nokogiri::XML::Node.new(\"Relationship\", xml).tap do |n|\n n['Id'] = next_id\n n['Type'] = Slide::REL_TYPE\n n['Target'] = slide_path.relative_path_from(@doc.presentation.path.dirname)\n end\n # ./presentation.xml\n # Update attr\n # p:notesMasterId\n # Insert attr\n # p:sldId, increment, etc.\n @doc.edit_xml '/ppt/presentation.xml' do |xml|\n slides = xml.at_xpath('/p:presentation/p:sldIdLst')\n next_slide_id = slides.xpath('//p:sldId[@id]').map{ |n| n['id'] }.sort.last.succ\n slides << Nokogiri::XML::Node.new(\"p:sldId\", xml).tap do |n|\n # TODO - Fix the ID that's jacked up.\n n['id'] = next_slide_id\n n['r:id'] = next_id\n end\n end\n end\n\n # Update ./[Content-Types].xml with new slide link and slideNotes link\n @doc.edit_xml @doc.content_types.path do |xml|\n types = xml.at_xpath('/xmlns:Types')\n types << Nokogiri::XML::Node.new(\"Override\", xml).tap do |n|\n n['PartName'] = slide_path\n n['ContentType'] = Slide::CONTENT_TYPE\n end\n types << Nokogiri::XML::Node.new(\"Override\", xml).tap do |n|\n n['PartName'] = slide_notes_path\n n['ContentType'] = Notes::CONTENT_TYPE\n end\n end\n\n # Great, that's all done, so lets return the slide eh?\n slide slide_path\n end",
"title": ""
},
{
"docid": "fb5c2cc65191b08e7412e879e19e4896",
"score": "0.42562124",
"text": "def go\n\nlines = 3 # cut it at line 3\n\nbasename = 'file_to_split.txt'\nextname = \"part\"\n\npart = 1\nline = 0\n\nfline = 0\nfor i in ifp = open(basename)\n fline = fline + 1\nend\nifp.close\n\nparts = fline / lines + 1\n\nfor i in ifp = open(basename)\n if line == 0\n ofp = open(sprintf(\"%s.%s%02d\", basename, extname, part), \"w\")\n printf(ofp, \"%s part%02d/%02d\\n\", basename, part, parts)\n ofp.write(\"BEGIN--cut here--cut here\\n\")\n end\n ofp.write(i)\n line = line + 1\n if line >= lines and !ifp.eof?\n ofp.write(\"END--cut here--cut here\\n\")\n ofp.close\n part = part + 1\n line = 0\n end\nend\nofp.write(\"END--cut here--cut here\\n\")\nofp.close\n\nifp.close\n\nend",
"title": ""
},
{
"docid": "7b8c42eb5942182705d70c523f7a1ad3",
"score": "0.42517304",
"text": "def output(format = :pls)\n format = format.to_sym\n raise ArgumentError.new(\"Format must be one of #{FORMATS.join(', ')}\") unless FORMATS.include? format\n\n case format\n when :text\n create_text\n when :m3u\n create_m3u\n else\n create_pls\n end\n end",
"title": ""
},
{
"docid": "ed541363952f33649c357083b578d855",
"score": "0.42205575",
"text": "def slice_by_pages(filename)\n pdftk_cmd = `which pdftk`.strip\n \n pdftk_cmd.empty? and raise \"There is no 'pdftk' utility on this worker\"\n \n out = `#{pdftk_cmd} #{filename} burst output \"#{filename}-page-%06d.pdf\" 2>&1`\n \n if !out.empty?\n @convert_errors.push(\"pdftk error:\\n\" + out)\n end\n end",
"title": ""
},
{
"docid": "fde28df4b1f263d03027b2be30e3d7c8",
"score": "0.42204604",
"text": "def index\n @image_to_parts = ImageToPart.all\n end",
"title": ""
},
{
"docid": "368c77f2b2ba854e1b5e46074ea7474c",
"score": "0.42045972",
"text": "def transform_pages(dir = '')\n base = File.join(self.source, dir)\n entries = Dir.entries(base)\n entries = entries.reject { |e| ['.', '_'].include?(e[0..0]) }\n\n entries.each do |f|\n if File.directory?(File.join(base, f))\n next if self.dest.sub(/\\/$/, '') == File.join(base, f)\n transform_pages(File.join(dir, f))\n else\n first3 = File.open(File.join(self.source, dir, f)) { |fd| fd.read(3) }\n \n # if the file appears to have a YAML header then process it as a page\n if first3 == \"---\"\n page = Page.new(self.source, dir, f)\n page.add_layout(self.layouts, site_payload)\n page.write(self.dest)\n # otherwise copy the file without transforming it\n else\n FileUtils.mkdir_p(File.join(self.dest, dir))\n FileUtils.cp(File.join(self.source, dir, f), File.join(self.dest, dir, f))\n end\n end\n end\n end",
"title": ""
},
{
"docid": "7e3e65a805970a30baf9713ed5efe18b",
"score": "0.42038327",
"text": "def convert_local_file input_file,output_filename,output_format\n begin\n \n if input_file == ''\n raise('input file not specified')\n end \n \n if output_filename == ''\n raise('output file not specified')\n end\n \n if output_format == ''\n raise('output format not specified')\n end\n \n if not File.exist?(input_file)\n raise(\"input file doesn't exist.\")\n end\n \n \n \n str_uri = $product_uri + '/pdf/convert?format=' + output_format\n str_signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n \n response_stream = Aspose::Cloud::Common::Utils.upload_file_binary(input_file, str_signed_uri) \n \n valid_output = Aspose::Cloud::Common::Utils.validate_output(response_stream)\n \n if valid_output == ''\n \n if output_format == 'html'\n save_format = 'zip'\n else\n save_format = output_format\n end\n \n if output_filename == ''\n output_filename = Utils::get_filename(input_file) + '.' + save_format\n end\n \n output_path = $out_put_location + output_filename\n Aspose::Cloud::Common::Utils.save_file(response_stream,output_path)\n return ''\n else\n return valid_output\n end\n \n rescue Exception=>e\n print e \n end \n end",
"title": ""
},
{
"docid": "ed2f835131ae438d4f9baaa045fc9465",
"score": "0.41930595",
"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": "3ebc0b22698f70506000c5963ecac122",
"score": "0.41893592",
"text": "def generate(destination)\n destination = Pathname(destination).expand_path\n # First, we find all of the renderable files in the project and iterate over that list.\n #\n # Next, we create a [Page](./soundwave/page.html) object for each file and write it to\n # the destination path.\n find_paths.each do |path|\n page = Page.new(self, path)\n page.write(destination.join(page.output_path))\n end\n end",
"title": ""
},
{
"docid": "d225a55109b89c1c0a6a3dd8a60501d8",
"score": "0.41884482",
"text": "def convert_image_multipage_image_format_convert(format1, format2, input_file, opts = {})\n data, _status_code, _headers = convert_image_multipage_image_format_convert_with_http_info(format1, format2, input_file, opts)\n data\n end",
"title": ""
},
{
"docid": "a9196433f4643f9b82cf8ce2f41d9b01",
"score": "0.41850773",
"text": "def convert(from_file, to_file = {})\n FFMpegCommand.clear\n FFMpegCommand << \"-i #{from_file}\"\n yield if block_given?\n \n build_output_file_name(from_file, to_file[:to]) do |file_name|\n FFMpegCommand << file_name\n end\n end",
"title": ""
},
{
"docid": "32368c7564dc8e9c9f9a5c5aabcc632d",
"score": "0.41816384",
"text": "def index\n # @current_exhibitions = Exhibition.where(\"? BETWEEN start_date AND end_date\", Date.today).order('end_date ASC')\n @exhibitions = Exhibition.all\n @current_upcoming_exhibitions = Exhibition.where(\"end_date >= ?\", Date.today).order('end_date ASC')\n @upcoming_exhibitions = Exhibition.where(\"start_date > ?\", Date.today).order('end_date ASC')\n @ongoing_exhibitions = Exhibition.where(\"end_date > ?\", Date.today + 4.months).order('end_date ASC')\n @past_exhibitions = Exhibition.where(\"end_date < ?\", Date.today).order('end_date DESC')\n\n if params[:gallery_id]\n @exhibitions = Gallery.find(params[:gallery_id]).exhibitions\n elsif params[:current_exhibitions]\n @exhibitions = Exhibition.current_exhibitions.order('end_date ASC')\n elsif params[:upcoming_exhibitions]\n @exhibitions = Exhibition.upcoming_exhibitions\n elsif params[:past_exhibitions]\n @exhibitions = Exhibition.past_exhibitions.order('end_date DESC')\n else\n @exhibitions = Exhibition.where(\"? BETWEEN start_date AND end_date\", Date.today).order('end_date ASC')\n end\n \n @exhibitions = Exhibition.all\n\n respond_to do |format|\n format.html\n format.csv { render text: @exhibitions.to_csv }\n\n end\n end",
"title": ""
},
{
"docid": "d0058405ed5cec9585e8e14bd6d28f0a",
"score": "0.41803595",
"text": "def paragraphs(range = nil)\n if range\n truncated = split(\"\\n\")[range].join(\"\\n\")\n truncated += '...' if truncated.length < length\n truncated\n else\n split(\"\\n\")\n end\n end",
"title": ""
},
{
"docid": "18a18f3f9e95028f324506db4f9a4c9b",
"score": "0.41800794",
"text": "def grouped(files); end",
"title": ""
},
{
"docid": "a321efad4acb1ebcca5acedb51fc81d6",
"score": "0.4178987",
"text": "def split_document_xlsx_with_http_info(input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SplitDocumentApi.split_document_xlsx ...'\n end\n # verify the required parameter 'input_file' is set\n if @api_client.config.client_side_validation && input_file.nil?\n fail ArgumentError, \"Missing the required parameter 'input_file' when calling SplitDocumentApi.split_document_xlsx\"\n end\n # resource path\n local_var_path = '/convert/split/xlsx'\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', 'text/json', 'application/xml', 'text/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n header_params[:'returnDocumentContents'] = opts[:'return_document_contents'] if !opts[:'return_document_contents'].nil?\n\n # form parameters\n form_params = {}\n form_params['inputFile'] = input_file\n\n # http body (model)\n post_body = nil\n auth_names = ['Apikey']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SplitXlsxWorksheetResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SplitDocumentApi#split_document_xlsx\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "3476190d59ca497e8f68d964297e0dc4",
"score": "0.41775885",
"text": "def stage_attached_files(publication)\n uploaded_files = []\n publication.publication_files.each do |f|\n temp_file_path = File.join(Rails.root, 'tmp/publishing_staged_uploads', f.key, f.filename.to_s)\n temp_file_directory = File.dirname(temp_file_path)\n FileUtils.mkdir_p(temp_file_directory) unless File.directory?(temp_file_directory)\n File.open(temp_file_path, 'wb') do |file|\n file.write(f.download)\n end\n uploaded_files << { path: temp_file_path, content_type: f.content_type }\n end\n uploaded_files\n end",
"title": ""
},
{
"docid": "a79ea5e0840763bed7cb01241eed7472",
"score": "0.41771737",
"text": "def transform_pages(dir = '', source = self.source)\n base = File.join(source, dir)\n entries = filter_entries(Dir.entries(base))\n directories = entries.select { |e| File.directory?(File.join(base, e)) }\n files = entries.reject { |e| File.directory?(File.join(base, e)) }\n\n [directories, files].each do |entries|\n # we need to make sure to process _posts *first* otherwise they \n # might not be available yet to other templates as {{ site.posts }}\n if entries.include?('_posts')\n entries.delete('_posts')\n read_posts(dir)\n end\n entries.each do |f|\n if File.symlink?(File.join(base, f))\n # preserve symlinks\n FileUtils.mkdir_p(File.join(self.dest, dir))\n File.symlink(File.readlink(File.join(base, f)),\n File.join(self.dest, dir, f))\n elsif File.directory?(File.join(base, f))\n next if self.dest.sub(/\\/$/, '') == File.join(base, f)\n transform_pages(File.join(dir, f), source)\n else\n first3 = File.open(File.join(source, dir, f)) { |fd| fd.read(3) }\n \n # if the file appears to have a YAML header then process it as a page\n if first3 == \"---\"\n # file appears to have a YAML header so process it as a page\n page = Page.new(source, dir, f)\n page.add_layout(self.layouts, site_payload)\n page.write(self.dest)\n else\n # otherwise copy the file without transforming it\n FileUtils.mkdir_p(File.join(self.dest, dir))\n FileUtils.cp(File.join(source, dir, f), File.join(self.dest, dir, f))\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "1b24fd9831141087479b49fda8fef3a6",
"score": "0.4172529",
"text": "def transform_pages(dir = '')\n base = File.join(self.source, dir)\n entries = Dir.entries(base)\n entries = entries.reject { |e| ['.', '_'].include?(e[0..0]) }\n \n entries.each do |f|\n if File.directory?(File.join(base, f))\n transform_pages(File.join(dir, f))\n else\n first3 = File.open(File.join(self.source, dir, f)) { |fd| fd.read(3) }\n \n if first3 == \"---\"\n page = Page.new(self.source, dir, f)\n page.add_layout(self.layouts, site_payload)\n page.write(self.dest)\n else\n FileUtils.mkdir_p(File.join(self.dest, dir))\n FileUtils.cp(File.join(self.source, dir, f), File.join(self.dest, dir, f))\n end\n end\n end\n end",
"title": ""
},
{
"docid": "703d5a8d1d433dd91f51a9f13e8191c8",
"score": "0.41722962",
"text": "def output_lilypond(format)\n filename = File.join(Rails.root, 'downloads', SecureRandom.uuid)\n lilypond_path = Rails.application.config.lilypond_path\n chartup = Chartup::Chart.new(self.chartup)\n case format\n when :pdf\n Open3.capture2(\"#{lilypond_path} --output=#{filename} -\", :stdin_data => chartup.to_ly)\n when :png\n Open3.capture2(\"#{lilypond_path} --output=#{filename} -dbackend=eps -dno-gs-load-fonts -dinclude-eps-fonts -ddelete-intermediate-files --png -\", :stdin_data => chartup.to_ly)\n end\n \"#{filename}.#{format.to_s}\"\n rescue Chartup::Error\n raise\n end",
"title": ""
},
{
"docid": "7342b8304808a20cd477eaf1eee87476",
"score": "0.41721633",
"text": "def render_document_export_format format_name, response\n begin\n render\n rescue ActionView::MissingTemplate\n render text: response.documents.map { |x| x.export_as(format_name) if x.exports_as? format_name }.compact.join(\"\\n\"), layout: false\n end\n end",
"title": ""
},
{
"docid": "cd8ad7195ff8efb87e4385c945a000c8",
"score": "0.41688395",
"text": "def process_files files=[]\n files.each do |file|\n process_file file\n end\n end",
"title": ""
},
{
"docid": "b7dfe1d6f622731523e233d84cd01620",
"score": "0.4164286",
"text": "def export_range(range = Iterable::Export::TODAY)\n params = { range: range }\n Iterable.request(conf, base_path, request_params(params)).get\n end",
"title": ""
},
{
"docid": "670e645a1e11717378eb44463cf04438",
"score": "0.4159921",
"text": "def append_document append_docs, import_format_modes, source_folder\n begin\n \n if @filename == \"\"\n raise \"Base file not specified.\"\n end\n \n if append_docs.length != import_format_modes.length\n raise \"Please specify complete documents and import format modes.\"\n end\n \n str_uri = $productURI + \"/words/\" + @filename + \"/appendDocument\"\n signed_str_uri = Common::Utils.sign(str_uri)\n \n post_hash = Hash[\"DocumentEntries\",append_docs]; \n json_data = post_hash.to_json\n \n response_stream = RestClient.post(signed_str_uri,json_data,{:accept=>\"application/json\"})\n \n valid_output = Common::Utils.validate_output(response_stream)\n \n if valid_output == \"\" \n folder = SaasposeStorage::Folder.new\n if source_folder == \"\"\n output_stream = folder.getfile(@filename)\n else\n output_stream = folder.getfile( source_folder + \"/\" + @filename)\n end\n output_path = $OutPutLocation + @filename\n Common::Utils.saveFile(output_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": "a63e2830c9f34eab63a598c8e38d5885",
"score": "0.41571802",
"text": "def process_and_create_zip_file\n @project = Project.find(params[:format].to_i)\n compressed_filestream = Zip::OutputStream.write_buffer do |zos|\n @project.testcases.each do |p|\n zos.put_next_entry p.testfile_file_name\n zos.print(Paperclip.io_adapters.for(p.testfile).read)\n\n\n zos.put_next_entry p.output_file_name\n zos.print(Paperclip.io_adapters.for(p.output).read)\n\n end\n end\n compressed_filestream.rewind\n send_data compressed_filestream.read, filename: \"testcases.zip\"\n end",
"title": ""
}
] |
b8f6415457117766bac342140a8fbff3
|
methode qui inflige des degats : damage
|
[
{
"docid": "a8a74c1a736cc2d946e27d3bb91d3529",
"score": "0.7694113",
"text": "def get_damage(damage)\n @life_points = @life_points - damage\n #on verife si le joueur est mort \n #initialise la vie a 0 pour ne pas avoir de nombre negatif\n if @life_points <= 0\n @life_points = 0\n puts \"le joueur #{@name} a ete tue\"\n puts \"\"\n end\n end",
"title": ""
}
] |
[
{
"docid": "30b4a16b761fd2c9a20bb168fe230c09",
"score": "0.7818884",
"text": "def gets_damage(damage) \n @life_points -= damage\n\n if @life_points <= 0 \n puts \"Déso #{@name} t'es mort !\"\n end\n end",
"title": ""
},
{
"docid": "36c02f729e80b3abac70a0f0730d24b5",
"score": "0.7787477",
"text": "def gets_damage(damage)\n \t@life_points = @life_points - damage\n \t#puts \"#{name} subit #{damage} points de dommage\"\n \tif life_points <= 0 \n \t\tputs \"Le joueur #{@name} a été tué !\"\n \tend\n end",
"title": ""
},
{
"docid": "cb1942b045fe6f6a62cc5f2807a147ad",
"score": "0.77748406",
"text": "def gets_damage(damage)\n @life_points = @life_points - damage\n\n # If the user has 0 life point it show a message that he loose\n if @life_points <= 0\n puts \"\\n\"\n puts \"----- La partie est finie #{self.name} a perdu ! -----\"\n end\n end",
"title": ""
},
{
"docid": "2b28148821fc3c68c03784ee79ecf2bb",
"score": "0.7767711",
"text": "def gets_damage(damage)\n @life_points = @life_points - damage\n# point de vie est = point de vie - les dommages saisi\n if @life_points <= 0\n# si les points de vie inférieur ou égal à 0 le joueur est mort \n puts \"le joueur #{@name} a été tué!!\"\n end\n end",
"title": ""
},
{
"docid": "014b52e7283cee741531b817f4819393",
"score": "0.7728816",
"text": "def gets_damage(damage)\n @life_points = @life_points - damage.to_i\n if @life_points <= 0\n puts \"Le joueur #{@name} a ete tue !\"\n end\n end",
"title": ""
},
{
"docid": "cb641750298ce2eea3fb5dfbb03b63c5",
"score": "0.7715926",
"text": "def gets_damage(damage)\n damage = damage.to_i\n @life_points = @life_points - damage\n if @life_points <= 0\n @life_points = 0\n puts \"le joueur #{names} a été tué\"\n end\n end",
"title": ""
},
{
"docid": "9f9d4d627f45b59d6ab303eea3e5bf95",
"score": "0.7669617",
"text": "def gets_damage(damage)\n\n # On soustrait aux points de vie\n @life_points = @life_points - damage\n \n\n # le joueur est mort s'il n'a plus de vie\n if @life_points <= 0\n puts \"#{@name} is down and dead.I'm soooo very sorry!\"\n puts\"*********************************************************************************************\"\n puts\"*********************************GAME***OVER*********************************************************\"\n puts\"*********************************************************************************************\"\n \n #sinon on l'informe qu'il ne va pas mal!\n else \n puts \"#{@name} still has #{@life_points} points left\"\n puts \"#{@name} is still all right\"\n end\n end",
"title": ""
},
{
"docid": "890d83d0f111910441fd21d033609496",
"score": "0.7539567",
"text": "def gets_damage(damage)\n @life_points = @life_points - damage\n if @life_points > 0 \n then puts \"#{@name} est encore dans le game, il a encore #{@life_points} points de vie !\"\n else puts \"sorry but #{@name} tu es muerto, tu as #{@life_points} points de vie!\"\n end\n\n end",
"title": ""
},
{
"docid": "69751a8d2e4df01f3d9b7c54c4f505cd",
"score": "0.7468851",
"text": "def attack_effect_damage\r\n self.hp -= self.damage\r\n end",
"title": ""
},
{
"docid": "8feb21154c6ec59d125bb8f69ae3d154",
"score": "0.7441196",
"text": "def get_damage(damage_points)\n \t# On soustraie les points de dommage aux points de vie\n \t@life_points = @life_points - damage_points\n\n \t# On vérifie s'il reste des points de vie au joueur\n \tif @life_points <= 0\n \t\tputs \"Le joueur #{@name} a été tué !\"\n \tend\n end",
"title": ""
},
{
"docid": "ea6344c9a8f057d2c9917ba91a42e502",
"score": "0.73211735",
"text": "def gets_damage(damages)\n @life_points -= damages\n if life_points > 0\n puts \"#{name} a perdu #{damages}, il lui reste #{life_points} points de vie\"\n else\n puts \"#{name} a perdu #{damages}, #{name} a été tué\"\n end\n end",
"title": ""
},
{
"docid": "ebedb1504a7ad9797d51aa2fdd039541",
"score": "0.73113495",
"text": "def compute_damage\n super * @weapon_level\n end",
"title": ""
},
{
"docid": "805d1f99e7bd1d3b97f915890d3fbbdd",
"score": "0.7203362",
"text": "def gets_damage(damage_onplayer)\n @life_points = @life_points - damage_onplayer\n\n if @life_points <= 0\n puts \"#{self.name} is dead\"\n else @life_points > 0\n puts \"#{self.name} à #{life_points} points de vie\"\n end\n end",
"title": ""
},
{
"docid": "a61e7d92bd75b060605cb2d62058cb5c",
"score": "0.7135123",
"text": "def slip_damage_effect\r\n # Set damage\r\n slip_damage_effect_base_damage\r\n # Dispersion\r\n slip_damage_effect_dispersion\r\n # Subtract damage from HP\r\n slip_damage_effect_damage\r\n # End Method\r\n return true\r\n end",
"title": ""
},
{
"docid": "93a29ebdb14d9767bf1dc0ce64a70b67",
"score": "0.7106491",
"text": "def gets_damage(attack_value)\n\t\t@life_points -= attack_value\n\t\tif @life_points <= 0 \n\t\t\t@life_points = 0 \n\t\t\treturn \" Le joueur #{self.name} a été tué !\"\n\t\tend\n\tend",
"title": ""
},
{
"docid": "15c429315fc3b5fe999cb093ff6f8950",
"score": "0.7096451",
"text": "def health_damage damage, check\n if check\n @health -= damage\n end\n end",
"title": ""
},
{
"docid": "daeae87995ef10e6bdc4a7d42f79b476",
"score": "0.7082974",
"text": "def takeDamage (damage)\n\t\t@health = @health - damage\n\tend",
"title": ""
},
{
"docid": "20f3e94264dafbc1a82ae7a137d6f3bf",
"score": "0.70742655",
"text": "def damage\n @damage ||= [(@power * (rand + 0.5)).to_i - @defender.toughness, 0].max\n end",
"title": ""
},
{
"docid": "67448581f4a91c0ea71f1c50ec095a20",
"score": "0.70692235",
"text": "def attacks(player)\n \tputs \"Le joueur #{@name} attaque le joueur #{player.name}.\"\n # On récupère le nombre de points de dommage correspondant au lancer de dé via la méthode compute_damage\n damage_points = compute_damage\n puts \"Il lui inflige #{damage_points} points de dommage.\"\n # Ces points de dommage sont infligés à player. Si player n'a plus de points de vie, le programme affiche qu'il est mort.\n player.get_damage(damage_points)\n end",
"title": ""
},
{
"docid": "84d9afa70004a3b661215ffdba513555",
"score": "0.705731",
"text": "def slip_damage_effect_base_damage\r\n self.damage = self.maxhp / 10\r\n end",
"title": ""
},
{
"docid": "8920f91aa557e174b776c0a5f2f9a520",
"score": "0.70531356",
"text": "def deal_damage!(damage)\n\t\t\[email protected] = @entity.hp - damage\n\t\t\treturn damage\n\t\tend",
"title": ""
},
{
"docid": "35c6261bae4356569c31de8d279f7a31",
"score": "0.7044802",
"text": "def attack_effect_base_damage(attacker)\r\n atk = [attacker.atk - self.pdef / 2, 0].max\r\n self.damage = atk * (20 + attacker.str) / 20\r\n end",
"title": ""
},
{
"docid": "987fd123e9c9ce9f7df1afa5fe9d8a7a",
"score": "0.69632494",
"text": "def weaponDamage \n damage = self.weapon.damage\n if( self.weapon.type == :versatile && @shield.value == 0 )\n damage += 2\n end\n damage\n end",
"title": ""
},
{
"docid": "baa238c832b2ebcf74388ea69e80af51",
"score": "0.69503814",
"text": "def does_damage\n puts \"You encounter the dreadful #{@name}!\"\n puts \"The #{@name} takes away #{@damage} health points.\"\n return @damage\n end",
"title": ""
},
{
"docid": "a8b332afa98a7f9bf34ffa9b7a413f79",
"score": "0.692637",
"text": "def damage(ap)\n @health_points -= ap\n end",
"title": ""
},
{
"docid": "f1642b089e53cfe213c6015c707c1dbf",
"score": "0.6911973",
"text": "def get_damage_string\n \"1d3\"\n end",
"title": ""
},
{
"docid": "06bb7578b0598f9ab3c36a12653b9943",
"score": "0.6906475",
"text": "def dmg( d_type, dmg, ap, srpe_att, char_att )\n d = dmg\n\n # surprise attacks do more damage\n if srpe_att\n d = d * 1.5\n end\n\n # when you see it coming, there is a chance that you get to evade part of the damage\n if !srpe_att && (rand(100) + 1 < @c_evade)\n d = d / 1.25; # consider redesigning this feature, the original value was way to strong, temp reducing the divider\n end\n\n # modify damage based on your resistances to the different types\n case d_type\n when :standard\n d -= @c_class == 'Knight' ? 10 : 0 # Warriors get a special resistance to standard damage\n when :magic\n d -= @c_class == 'Wizard' ? 10 : 1 # Magi get a special resistance to magic damage\n when :earth\n d -= 1\n when :fire\n d -= 1\n when :water\n d -= 1\n when :wind\n d -= 1\n when :shadow\n d -= @c_class == 'Shinobi' ? 10 : 1 # Rogue get a special resistance to shadow damage\n when :ice\n d -= 1\n when :lightning\n d -= 1\n when :dark\n d -= 1\n when :light\n d -= 1\n when :psionic\n d -= 1\n else\n d -= 0\n end\n\n # modify damage based on armor worn\n if @armor == 'Leather'\n unless srpe_att # characters don't get to use armor values when surprise attacked\n d -= (2 - ap)\n end\n elsif @armor == 'Chain mail'\n unless srpe_att # characters don't get to use armor values when surprise attacked\n d -= (6 - ap)\n end\n elsif @armor == 'Full Plate'\n unless srpe_att # characters don't get to use armor values when surprise attacked\n d -= (12 - ap)\n end\n end\n\n # make sure we don't give them hp when they block it\n if d < 0\n d = 0;\n end\n\n # apply the damage\n @c_hp = @c_hp - d\n\n # display results\n if d == 0\n puts 'You suffered no damage from the attack, way to go!'\n elsif @c_hp <= 0\n @c_lvl -= 1\n puts \"You #{ @c_name } have perished. You respawn back at town square but have suffered loss in level. You are now level #{ @c_lvl }\"\n else\n puts \"You have suffered #{ d } wounds and now have #{ @c_hp } health left\"\n end\n\n # NOTE: this is becoming to painful, removing until we figure out\n # how to handle all the different combos for the counter attack\n # if @c_hp > 0 && !srpe_att && (rand(100) + 1 < @c_counter)\n # if @c_class == 'Knight' && @weapon == 'Short Sword'\n # char_att.dmg(:physical, rand(10) + 2, 0, false)\n # end\n # if @c_class == 'Knight' && @weapon == 'Longsword'\n # char_att.dmg(:physical, rand(20) + 2, 0, false)\n # end\n # if @c_class == 'Knight' && @weapon == 'Battle Axe'\n # char_att.dmg(:physical, rand(11) + 10, 0, false)\n # end\n # if @c_class == 'Wizard' && @weapon == 'Fireball'\n # char_att.dmg(:fire, rand(10) + 6, 0, false)\n # end\n # if @c_class == 'Wizard' && @weapon == 'Ice Spikes'\n # char_att.dmg(:ice, rand(10) + 6, 0, false)\n # end\n # if @c_class == 'Wizard' && @weapon == 'Crushing Grasp'\n # char_att.dmg(:magic, rand(10) + 6, 0, false)\n # end\n # if @c_class == 'Shinobi' && @weapon == 'Tanto'\n # char_att.dmg(:magic, rand(6) + 6, 6, false)\n # end\n # if @c_class == 'Shinobi' && @weapon == 'Ninjato'\n # char_att.dmg(:magic, rand(12) + 6, 3, false)\n # end\n # end\n end",
"title": ""
},
{
"docid": "af381c93d8e2bcec9f5519d28bc74a9d",
"score": "0.6899224",
"text": "def damage(attack_power)\n @health_points -= attack_power\n end",
"title": ""
},
{
"docid": "8067b4b8929a12877cfb32720d337a0f",
"score": "0.6886251",
"text": "def take_damage(damage)\n damage_taken = 0\n dodge_roll = rand((self.agility + ((self.dodgeFlag && 1 || 0) * DODGE_ACTIVATE_VALUE)) .. DODGE_RANGE_UPPER)\n if !dodge_roll.between?(DODGE_RANGE_LOWER, DODGE_RANGE_UPPER)\n damage_taken = damage - (damage * (self.defense / 100.0)).to_i\n self.health -= damage_taken\n self.dodgeFlag = false;\n self.save\n end\n damage_taken\n end",
"title": ""
},
{
"docid": "b7d6cb0842eccb189cfdd0177df11657",
"score": "0.68801117",
"text": "def roll_damage\n\t\tGurpsUtils.d(6) * 8 # Relative velocity 2 mps\n\tend",
"title": ""
},
{
"docid": "f3b5aa47d471a8c891f4e1684e1524c4",
"score": "0.68613476",
"text": "def collision(damage)\n end",
"title": ""
},
{
"docid": "1b5c3f4db7be17cf6d4997d3a3324ed0",
"score": "0.6835424",
"text": "def attacks (player)\n damage = compute_damage\n\n puts \">>> Le joueur #{self.name} attaque le joueur #{player.name}\"\n\n puts \">>> Il lui inflige #{damage} points de dommages\"\n\n # Give damages to the \"player\" in argument\n player.gets_damage(damage)\n end",
"title": ""
},
{
"docid": "84fed349bbfbef7f5c255ba777a389b1",
"score": "0.682605",
"text": "def gets_damage(less_points)\n @life_points = @life_points - less_points \n if @life_points <= 0\n puts \"le fantôme #{@name} a été capturé\"\n end\n end",
"title": ""
},
{
"docid": "51d8da94432d3b800b66a1548576b081",
"score": "0.6820073",
"text": "def slip_damage_effect_damage\r\n self.hp -= self.damage\r\n end",
"title": ""
},
{
"docid": "4813c9967dc1bf8791facfa8b4b86561",
"score": "0.6813035",
"text": "def skill_effect_base_damage(power, rate)\r\n self.damage = power * rate / 20\r\n end",
"title": ""
},
{
"docid": "337bf8217258a183270b90fdf322d5a5",
"score": "0.6811252",
"text": "def perform_damage_effect\n end",
"title": ""
},
{
"docid": "337bf8217258a183270b90fdf322d5a5",
"score": "0.6811252",
"text": "def perform_damage_effect\n end",
"title": ""
},
{
"docid": "e8585a28c6635d572105721c4ed918a4",
"score": "0.68068576",
"text": "def take_damage(damage)\n self.health -= damage\n # or @health -= damage\n shout(\"Ouch! #{name} took #{damage} and has #{self.health} left\")\n die if self.health <= 0\n end",
"title": ""
},
{
"docid": "f4e0371e2e90b33fb49109c007286612",
"score": "0.68043935",
"text": "def attacks(enemy)\n puts \"#{@name} attaque #{enemy.name}\"\n damage = compute_damage\n puts \"il lui inflige #{damage} points de dommages\"\n enemy.gets_damage(damage)\n end",
"title": ""
},
{
"docid": "f65e8b3714c7d17af7a1e0daf30ad9a6",
"score": "0.6790231",
"text": "def take_damage(damage)\n if (@health - damage <= 0)\n @is_alive = false\n @health = 0\n else\n @health -= damage\n end\n end",
"title": ""
},
{
"docid": "5cfceefa75d09134c7763041b21128bc",
"score": "0.6783835",
"text": "def rest\n @total_damage = @total_damage - 0.1 * strength\n end",
"title": ""
},
{
"docid": "b54b6c44cd22fbbe5efa4606d7678a75",
"score": "0.6781014",
"text": "def take_damage(damage)\n @hp -= damage\n @alive = (@hp > 0) ### false if hp is o or smaller\n $game_map.events[@id].animation_id = 7 ### sword animation -> change to dynamic\n @damage_num.set_visible\n @damage_num.set_damage_text(damage)\n @damage_num.update_now\n \n ### if dead, change switches so that enemy events corpse is shown\n if !@alive then\n $game_switches[21+@index] = false\n $game_switches[61+@index] = true\n end\n end",
"title": ""
},
{
"docid": "fe3e0b8b5ab1ad156937f5382673a4cf",
"score": "0.6771926",
"text": "def evaluate_damage_power(user, obj, patk, matk, pdef, mdef)\n p_damage = (patk - pdef/2) * obj.atk_f / 100\n m_damage = (matk - mdef/2) * obj.spi_f / 200\n damage = (p_damage + m_damage)\n damage = (damage * XRXSV44::DamageValueRate).to_i\n damage += obj.base_damage.abs\n return damage\n end",
"title": ""
},
{
"docid": "3a86d6368fbcfae4745ceb268b19630b",
"score": "0.67714256",
"text": "def damaged\n @hp = @hp - 1\n end",
"title": ""
},
{
"docid": "e8f607fb6269c2e44d85d3917be99687",
"score": "0.67713046",
"text": "def attacks(victim)\n #AFFICHE LE JOUEUR ATTAQUANT SA VICTIME\n puts \"le joueur #{self.names} attaque le joueur #{victim.names}\"\n\n #DAMAGE_COMPUTED PREND LA VALEUR DU NOMBRE OBTENU ALEATOIREMENT\n damage_computed = compute_damage\n\n #AFFICHE LE NOMBRE DE DOMMAGES INFLIGES\n puts \"il lui inflige #{damage_computed} points de dommages\"\n\n #VICTIM RECOIS LES DOMMAGES\n victim.gets_damage(damage_computed)\n end",
"title": ""
},
{
"docid": "44a85753f4d038c00d43102e4769be7d",
"score": "0.6768725",
"text": "def damage\n @points -= [10, 20, 30].sample\n end",
"title": ""
},
{
"docid": "d8ffd7b6e6ec4e8c642f3bcb3ba9df4a",
"score": "0.67653245",
"text": "def gotAttack(damage)\r\n @hitpoint -= damage\r\n end",
"title": ""
},
{
"docid": "a0bd91cf56e58e89793f7f207dc03dd4",
"score": "0.67137045",
"text": "def hit( damage )\n p_up = rand( charisma )\n if p_up % 9 == 7\n @life += p_up / 4\n puts \"[#{ self.class } magick powers up #{ p_up }!]\"\n end\n @life -= damage\n puts \"[#{ self.class } has died.]\" if @life <= 0\n end",
"title": ""
},
{
"docid": "5dfb50e64153a0d021e73980f29cadf5",
"score": "0.6708836",
"text": "def hit(damage)\n @hp -= damage\n end",
"title": ""
},
{
"docid": "9db7da192bf94983c1cf9681e90fd95a",
"score": "0.6700986",
"text": "def slip_damage_effect\n # Set damage\n self.damage = self.maxhp / 10\n # Dispersion\n if self.damage.abs > 0\n amp = [self.damage.abs * 15 / 100, 1].max\n self.damage += rand(amp+1) + rand(amp+1) - amp\n end\n # Subtract damage from HP\n self.hp -= self.damage\n # End Method\n return true\n end",
"title": ""
},
{
"docid": "7e483976a814e1b1bbdc23ce82f16bef",
"score": "0.6679131",
"text": "def receive_damage\n @hit_points-= 10\n end",
"title": ""
},
{
"docid": "f25887d949b9f30d807cc05fb47ea28e",
"score": "0.66568935",
"text": "def take_damage(damage)\n @hitpoint -= damage\n end",
"title": ""
},
{
"docid": "e13af11744a6a8791f255d5060f74173",
"score": "0.6652591",
"text": "def receive_damage\n @hit_points -= @damage\n end",
"title": ""
},
{
"docid": "209f7de5029b2969468b517b9c47e716",
"score": "0.6635427",
"text": "def attack_effect_dispersion\r\n if self.damage.abs > 0\r\n amp = [self.damage.abs * 15 / 100, 1].max\r\n self.damage += rand(amp+1) + rand(amp+1) - amp\r\n end\r\n end",
"title": ""
},
{
"docid": "24c89c49b8b4364f684043dcf8d4ac80",
"score": "0.6634777",
"text": "def attacks(player)\n\t\tputs \"#{@name} attaque #{player.name} !\"\n\t\tdamage = compute_damage\n player.gets_damage(damage)\n \n\t\tif player.life_points > 0\n\t\tputs \"#{@name} lui inflige #{damage} points de dommage.\\n\\n\"\n\t\telse \n\t\t\tputs \"Oups, #{player.name} c'est fait décapité...\\n\\n\"\n end\n\n end",
"title": ""
},
{
"docid": "ee121ec1a8fb2cf2ef254b9e8ec7b95a",
"score": "0.6634501",
"text": "def wound(damage)\n if (@shield >= damage)\n @shield -= damage\n else \n remaining_damage = damage - @shield\n @shield = 0\n if (@health - remaining_damage) > 0 \n @health -= remaining_damage\n else\n @health = 0\n end\n end\nend",
"title": ""
},
{
"docid": "6d9812d0f20293ce95c04df5b2826723",
"score": "0.6606532",
"text": "def gets_damage (number)\n @life_points = @life_points - number.to_i\n if @life_points <= 0\n puts \"#{@name} a mangé ses morts !\"\n else return show_state\n end\n end",
"title": ""
},
{
"docid": "bc4e4786ab02cb4d7f4da3d00c633a39",
"score": "0.6586314",
"text": "def set_damage\n @damage = Damage.find(params[:id])\n end",
"title": ""
},
{
"docid": "10c31a5602e4c5cb90129c000b924517",
"score": "0.6571047",
"text": "def takeDamage (dmg)\n\t\t@currentHealth -= dmg\n\tend",
"title": ""
},
{
"docid": "c130d14536008e4bad12b31f4ac50485",
"score": "0.6569535",
"text": "def gets_damage(point)\n @life_points -= point\n if @life_points <= 0\n puts \"Player #{@name} has been died!\"\n end\n end",
"title": ""
},
{
"docid": "c12ff3979f3c1ea225e967b8cb5e635c",
"score": "0.6569034",
"text": "def hit(damage)\n @health -= damage\n if @health <= 0\n @health = 0\n end\n end",
"title": ""
},
{
"docid": "f30602f5b69de2bc1c8daf00245cc6e2",
"score": "0.6543269",
"text": "def hit\n self.damage = damage + 1\n check_boat\n end",
"title": ""
},
{
"docid": "d76beeecc0b44c3e36b1d11910f8c0ff",
"score": "0.6542377",
"text": "def attacks(player)\n \tputs \"Le joueur #{@name} attaque le joueur #{player.name}\"\n \tdamage = compute_damage\n \tputs \"Il lui inflige #{damage} points de dommage\"\n \tplayer.gets_damage(damage)\n end",
"title": ""
},
{
"docid": "af17086ba4efc044f3d6d569aab0bccd",
"score": "0.6541274",
"text": "def attacks(player)\n puts \"#{@name} attaque #{player.name}\"\n damage = compute_damage\n puts \" il lui inflige #{damage} points dommages\"\n player.gets_damage(damage)\n end",
"title": ""
},
{
"docid": "f2a993413c5018d4e75df1d3781c84ba",
"score": "0.653489",
"text": "def attacks(player)\r\n puts \"#{@name} attaque le joueur #{player.name}\"\r\n player.gets_damage(compute_damage)\r\n end",
"title": ""
},
{
"docid": "6513876947f8739bedf0a76dcc5f1638",
"score": "0.6518513",
"text": "def damage(value, critical)\n dispose_damage\n if value.is_a?(Numeric)\n damage_string = value.abs.to_s\n else\n damage_string = value.to_s\n end\n bitmap = Bitmap.new(160, 48)\n bitmap.font.name = \"Arial Black\"\n bitmap.font.size = 32\n bitmap.font.color.set(0, 0, 0)\n bitmap.draw_text(-1, 12-1, 160, 36, damage_string, 1)\n bitmap.draw_text(+1, 12-1, 160, 36, damage_string, 1)\n bitmap.draw_text(-1, 12+1, 160, 36, damage_string, 1)\n bitmap.draw_text(+1, 12+1, 160, 36, damage_string, 1)\n if value.is_a?(Numeric) and value < 0\n bitmap.font.color.set(176, 255, 144)\n else\n bitmap.font.color.set(255, 255, 255)\n end\n bitmap.draw_text(0, 12, 160, 36, damage_string, 1)\n if critical\n bitmap.font.size = 20\n bitmap.font.color.set(0, 0, 0)\n bitmap.draw_text(-1, -1, 160, 20, \"CRITICAL\", 1)\n bitmap.draw_text(+1, -1, 160, 20, \"CRITICAL\", 1)\n bitmap.draw_text(-1, +1, 160, 20, \"CRITICAL\", 1)\n bitmap.draw_text(+1, +1, 160, 20, \"CRITICAL\", 1)\n bitmap.font.color.set(255, 255, 255)\n bitmap.draw_text(0, 0, 160, 20, \"CRITICAL\", 1)\n end\n @_damage_sprite = ::Sprite.new(self.viewport)\n @_damage_sprite.bitmap = bitmap\n @_damage_sprite.ox = 80\n @_damage_sprite.oy = 20\n @_damage_sprite.x = self.x\n @_damage_sprite.y = self.y - self.oy / 2\n @_damage_sprite.z = 3000\n @_damage_duration = 40\n end",
"title": ""
},
{
"docid": "0b4e9773451d2f44e2d6e1cce937aff9",
"score": "0.65179145",
"text": "def determine_damage\n if Random.rand(100) < critical_rate\n [fighter_attack * 2, FightEvent.attack_types['critical']]\n else\n [fighter_attack, FightEvent.attack_types['normal']]\n end\n end",
"title": ""
},
{
"docid": "1fd16dda7560512ddb6c596128f2c899",
"score": "0.6517139",
"text": "def attacks(player_to_attack)\n puts \"#{@name} attaque #{player_to_attack.name}\"\n damage = compute_damage\n puts \"infligue #{damage} point de degat\"\n puts \"\"\n player_to_attack.get_damage(damage)\n end",
"title": ""
},
{
"docid": "40ac129c3d50907f3c843e956ab8066b",
"score": "0.65049905",
"text": "def allowDamage _obj, _args\n \"_obj allowDamage _args;\" \n end",
"title": ""
},
{
"docid": "071e26d2bee12e4e076488b3d224afad",
"score": "0.65011823",
"text": "def taking_damage_action\n if @warrior.feel(:backward).empty? && @health < 10\n @warrior.walk!(:backward)\n elsif @warrior.feel.empty?\n @warrior.walk!\n elsif @warrior.feel.enemy?\n @warrior.attack!\n end\n end",
"title": ""
},
{
"docid": "10639987c6c01d22059254a7f1a914db",
"score": "0.6491433",
"text": "def calc_defender_damage(initial_damage, hp_damage)\n dmg = initial_damage - hp_damage\n if guarding?\n dmg /= (super_guard ? 4 : 2)\n end\n dmg\n end",
"title": ""
},
{
"docid": "b34bde20fd27a23df45dba8eaf1734c4",
"score": "0.64851266",
"text": "def skill_effect_damage\r\n # Substract damage from HP\r\n last_hp = self.hp\r\n self.hp -= self.damage\r\n return self.hp != last_hp\r\n end",
"title": ""
},
{
"docid": "7fffec8a33dcbaa15b26ba5a90a78744",
"score": "0.64843607",
"text": "def attacks(other_player) \n puts \"Le joueur #{@name} attaque le joueur #{other_player.name}.\"\n other_player_damage = compute_damage\n\n puts \"Il lui inflige #{other_player_damage} points de dommages.\"\n other_player.gets_damage(other_player_damage)\n end",
"title": ""
},
{
"docid": "d1b7a22843fb01c7f695abca1948352b",
"score": "0.64731604",
"text": "def damage(power)\n @health_points -= power\n end",
"title": ""
},
{
"docid": "6092d7679e760dcc11c058ac2332a257",
"score": "0.64724046",
"text": "def damage(item_damaged) #allow the item class to be use through the parameter\n until @current_time == @time || item_damaged.item_health == 0 || @tool_health == 0\n item_damaged.item_health -= 5\n @tool_health -= 10\n @current_time += 1\n end\n end",
"title": ""
},
{
"docid": "d0f432abc5496e22634900bd8c6d1ce5",
"score": "0.6461268",
"text": "def hit damage\n out = ''\n p_up = rand charisma\n if p_up % 9 == 7\n @life += p_up / 4\n out << \"[#{self.name} magick powers up #{p_up}!]\\n\"\n end\n @life -= damage\n out << \"[#{self.name} has died.]\\n\" if @life <= 0\n out\n end",
"title": ""
},
{
"docid": "0281419e3ca00447bef4407f25dde35d",
"score": "0.64480627",
"text": "def dps\n self.total_damage.to_f / self.encounter.duration_in_seconds\n end",
"title": ""
},
{
"docid": "46e6ade2579b26b999a9ecbcb4dc196a",
"score": "0.6429603",
"text": "def gotAttack(damage)\r\n @@probsDeflects = Array['deflect', 'deflect', 'deflect', 'deflect', 'deflect',\r\n 'deflect', 'deflect', 'deflect', 'got hit', 'got hit' ]\r\n\r\n @@probs = @@probsDeflects[rand(0..9)]\r\n if @role.upcase == \"HERO\"\r\n if @@probs == 'deflect'\r\n puts \"#{@name} deflects the attack.\"\r\n @hitpoint += damage\r\n end\r\n end\r\n @hitpoint -= damage\r\n end",
"title": ""
},
{
"docid": "d02f3d8872f91c7efcea543e9df8b130",
"score": "0.64265543",
"text": "def item_effect_damage(recover_hp, recover_sp, effective)\r\n # Set Damage\r\n self.damage = -recover_hp\r\n # HP and SP recovery\r\n last_hp = self.hp\r\n last_sp = self.sp\r\n self.hp += recover_hp\r\n self.sp += recover_sp\r\n effective |= self.hp != last_hp\r\n effective |= self.sp != last_sp\r\n # Return Effectiveness\r\n return effective\r\n end",
"title": ""
},
{
"docid": "4664e5215c9730638175a90c1bf7f614",
"score": "0.64233255",
"text": "def damaged_percentage\n 1 - alive_percentage\n end",
"title": ""
},
{
"docid": "8387a08ef3a2db023c3f08148e3b267e",
"score": "0.64196527",
"text": "def attack() stat(:attack) end",
"title": ""
},
{
"docid": "a0971d1c518c921fe98fa3c4524bf197",
"score": "0.6418719",
"text": "def take_damage(attack_strength)\n @health -= attack_strength\n end",
"title": ""
},
{
"docid": "fcbeefbd58f5ab3f6e028cef3f218aaa",
"score": "0.64149535",
"text": "def slip_damage_effect_dispersion\r\n # Dispersion\r\n if self.damage.abs > 0\r\n amp = [self.damage.abs * 15 / 100, 1].max\r\n self.damage += rand(amp+1) + rand(amp+1) - amp\r\n end\r\n end",
"title": ""
},
{
"docid": "de6699a8d8e4e901758fe95c1d091dfc",
"score": "0.6411437",
"text": "def get_damage\n 1 + Random.rand(3)\n end",
"title": ""
},
{
"docid": "bd92a57e42760b288b3c169d1bce66f4",
"score": "0.64038146",
"text": "def wound(damage)\n remaindmg = damage-@shields\n if damage > @shields\n @shields = 0\n @health -= remaindmg \n elsif @shields >= damage\n @shields -= damage\n else\n @health -= damage\n end\n if @health <= 0\n @health = 0\n end\n end",
"title": ""
},
{
"docid": "e19eda569ab18e728aee1027c0efbdf3",
"score": "0.6401395",
"text": "def attack(player)\n player.receive_damage\n end",
"title": ""
},
{
"docid": "4ae9b5501e1b0188189718e71fb386d6",
"score": "0.63835925",
"text": "def compute_damage\n\t\treturn rand(1..6) * @weapon_level\n\tend",
"title": ""
},
{
"docid": "513b22f2dbf64e24ebdbf38d7e4308ee",
"score": "0.63835305",
"text": "def attacks(victime_name)\n @degat = compute_damage\n puts \"le joueur #{name} fait #{coup} sur le joueur #{victime_name.name}!\"\n victime_name.gets_damage(@degat)\n end",
"title": ""
},
{
"docid": "123e8cf8211abe05f40a441faace87c5",
"score": "0.6381699",
"text": "def attack(user)\n # Variable to see how many damage instances will be\n damage_instances_count = 0\n\n # Search within weapons for damage bonus\n user.weapons.each do |weapon|\n weapon.bonuses.each do |bonus|\n if bonus.bonus_type == 'damage'\n damage_instances_count = bonus.multiplier\n end\n end\n end\n\n # For each damage bonus we will calculate the attack again\n damage_instances = (1..damage_instances_count).map do\n # Values from weapons\n weapon_attack_points = 0\n weapon_attack_modifiers = 0\n weapon_attack_recoil_modifier = 0\n\n weapon_defense_points = 0\n weapon_defense_modifiers = 0\n\n # Finding bonuses and adding to the list\n user.weapons.each do |weapon|\n weapon_attack_points += weapon.attack_points\n weapon_defense_points += weapon.defense_points\n\n weapon.bonuses.each do |bonus|\n if bonus.bonus_type == 'attack'\n weapon_attack_modifiers += bonus.multiplier\n elsif bonus.bonus_type == 'recoil'\n weapon_attack_recoil_modifier += bonus.multiplier\n elsif bonus.bonus_type == 'defense'\n weapon_defense_modifiers += bonus.multiplier\n end\n end\n end\n\n # Values from rings\n rings_attack_points = 0\n rings_attack_modifiers = 0\n\n rings_defense_points = 0\n rings_defense_modifiers = 0\n\n # Finding bonuses and adding to the list\n user.rings.each do |ring|\n rings_attack_points += ring.attack_points\n rings_defense_points += ring.defense_points\n\n ring.bonuses.each do |bonus|\n if bonus.bonus_type == 'attack'\n rings_attack_modifiers += bonus.multiplier\n elsif bonus.bonus_type == 'defense'\n rings_defense_modifiers += bonus.multiplier\n end\n end\n end\n\n # Values from helmets\n helmet_attack_points = user.helmet.attack_points\n helmet_attack_modifiers = 0\n\n helmet_defense_points = user.helmet.defense_points\n helmet_defense_modifiers = 0\n\n # Finding bonuses and adding to the list\n user.helmet.bonuses.each do |bonus|\n if bonus.bonus_type == 'attack'\n helmet_attack_modifiers += bonus.multiplier\n elsif bonus.bonus_type == 'defense'\n helmet_defense_modifiers += bonus.multiplier\n end\n end\n\n # Values from body armor\n body_armor_attack_points = user.body_armor.attack_points\n body_armor_attack_modifiers = 0\n\n body_armor_defense_points = user.body_armor.defense_points\n body_armor_defense_modifiers = 0\n\n # Finding bonuses and adding to the list\n user.body_armor.bonuses.each do |bonus|\n if bonus.bonus_type == 'attack'\n body_armor_attack_modifiers += bonus.multiplier\n elsif bonus.bonus_type == 'defense'\n body_armor_defense_modifiers += bonus.multiplier\n end\n end\n\n # Values from boots\n boots_attack_points = user.boots.attack_points\n boots_attack_modifiers = 0\n\n boots_defense_points = user.boots.defense_points\n boots_defense_modifiers = 0\n\n # Finding bonuses and adding to the list\n user.boots.bonuses.each do |bonus|\n if bonus.bonus_type == 'attack'\n boots_attack_modifiers += bonus.multiplier\n elsif bonus.bonus_type == 'defense'\n boots_defense_modifiers += bonus.multiplier\n end\n end\n\n # Values from gloves\n gloves_attack_points = user.gloves.attack_points\n gloves_attack_modifiers = 0\n\n gloves_defense_points = user.gloves.defense_points\n gloves_defense_modifiers = 0\n\n # Finding bonuses and adding to the list\n user.gloves.bonuses.each do |bonus|\n if bonus.bonus_type == 'attack'\n gloves_attack_modifiers += bonus.multiplier\n elsif bonus.bonus_type == 'defense'\n gloves_defense_modifiers += bonus.multiplier\n end\n end\n\n # Values from amulet\n amulet_attack_points = user.amulet.attack_points\n amulet_attack_modifiers = 0\n\n amulet_defense_points = user.amulet.defense_points\n amulet_defense_modifiers = 0\n\n # Finding bonuses and adding to the list\n user.amulet.bonuses.each do |bonus|\n if bonus.bonus_type == 'attack'\n amulet_attack_modifiers += bonus.multiplier\n elsif bonus.bonus_type == 'defense'\n amulet_defense_modifiers += bonus.multiplier\n end\n end\n\n # Making a sum of all the points from the itens\n attack_points_sum = weapon_attack_points + rings_attack_points + helmet_attack_points + body_armor_attack_points + boots_attack_points + gloves_attack_points + amulet_attack_points\n defense_points_sum = weapon_defense_points + rings_defense_points + helmet_defense_points + body_armor_defense_points + boots_defense_points + gloves_defense_points + amulet_defense_points\n\n # Making a sum of all the bonuses from the items\n attack_modifiers_sum = weapon_attack_modifiers + rings_attack_modifiers + helmet_attack_modifiers + body_armor_attack_modifiers + boots_attack_modifiers + gloves_attack_modifiers + amulet_attack_modifiers\n defense_modifiers_sum = weapon_defense_modifiers + rings_defense_modifiers + helmet_defense_modifiers + body_armor_defense_modifiers + boots_defense_modifiers + gloves_defense_modifiers + amulet_defense_modifiers\n\n # Calculating damage, defense and recoil\n attack_total = attack_points_sum * attack_modifiers_sum\n defense_total = defense_points_sum * defense_modifiers_sum\n recoil_total = (attack_total * weapon_attack_recoil_modifier * ((attack_total / (defense_total + (E ** -attack_total))) / 100)).floor\n\n # Creating a new DamageInstance\n DamageInstance.new(attack_total, recoil_total)\n end\n\n # Returning damage instances\n damage_instances\n end",
"title": ""
},
{
"docid": "dab245fa106bcc29d252f93a3f1240d5",
"score": "0.63793856",
"text": "def compute_damage\r\n return rand(1..6) * @weapon_level\r\n end",
"title": ""
},
{
"docid": "3da43a5900caf84229dacbc7999d9bdd",
"score": "0.63697034",
"text": "def take_damage(damage)\n if(damage <= 0)\n raise \"damage should always be a positive number.\"\n end\n\n @health -= damage\n if @health < 0 # Player should never be below 0 health.\n @health = 0\n end\n end",
"title": ""
},
{
"docid": "138c9a0a1aa679819b32a064d42424e4",
"score": "0.636862",
"text": "def do_battle(damage)\n @health_points = @health_points - damage\n if @health_points < 1\n @lives -= 1\n @health_points = 10\n end\n\n if @lives == 0\n reset\n end\n\n end",
"title": ""
},
{
"docid": "aa2b413d7584a7fa67d9cfffb99d0d20",
"score": "0.6358157",
"text": "def attacks(player)\n dice = compute_damage\n puts \"#{@name} attaque #{player.name} : Il lui inflige #{dice} points de dommages\"\n player.life_points = player.life_points - dice\n end",
"title": ""
},
{
"docid": "af2cbaec1a963e35d104493d79771605",
"score": "0.63537127",
"text": "def take_damage amt, name, sym, message\n @hp -= amt\n @last_hit_by = name\n @kill_type = sym\n hear_line message\n # check if you died?\n end",
"title": ""
},
{
"docid": "d1871d41f43d2ae9ecc63ade956c31a3",
"score": "0.6342706",
"text": "def assassin_damage_defense(damage_type)\n if damage_type == 'ms'\n return {damage: 1, damage_text: \"took 2 extra damage from Melee Spell attack\"}\n elsif damage_type == 'rs'\n return {damage: 1, damage_text: \"took 2 extra damage from Ranged Spell attack\"}\n elsif damage_type == 'mp'\n return {damage: 1, damage_text: \"took 2 extra damage from Melee Physical attack\"}\n elsif damage_type == 'rp'\n return {damage: 1, damage_text: \"took 2 extra damage from Ranged Physical attack\"}\n end\n return {damage: 0, damage_text: \"\"}\n end",
"title": ""
},
{
"docid": "a70cb22b0e9f3dd6c811f864e4c4c212",
"score": "0.63403195",
"text": "def skill_effect_damagefix\r\n self.damage = nil unless $game_temp.in_battle\r\n end",
"title": ""
},
{
"docid": "0c6fa02b24ee10cfc3620b4f65aafa11",
"score": "0.634014",
"text": "def compute_damage\n return rand(1..6) * @weapon_level\n end",
"title": ""
},
{
"docid": "0c6fa02b24ee10cfc3620b4f65aafa11",
"score": "0.634014",
"text": "def compute_damage\n return rand(1..6) * @weapon_level\n end",
"title": ""
},
{
"docid": "b061778cb3e713aee594eb723e426595",
"score": "0.63382745",
"text": "def compute_damage\n rand(1..6) * @weapon_level\n end",
"title": ""
},
{
"docid": "4053f7481043f6e64c49f7c77cfeff31",
"score": "0.6335756",
"text": "def d6_damage\n dmg = 0\n if (match = damage.match /\\A\\s*\\d*(\\s*\\+?\\s*(\\d*)[dw]6(\\/\\d+)?)\\s*\\Z/)\n dmg = (match[2].blank? ? 1 : match[2]).to_i\n unless match[3].nil?\n dmg = \"#{dmg}#{match[3]}\"\n end\n end\n dmg\n end",
"title": ""
}
] |
e561e11bcf379ef5dc139c210017366b
|
Only allow a list of trusted parameters through.
|
[
{
"docid": "8459ffd897c0832698121f8e46c69150",
"score": "0.0",
"text": "def client_params\n params.require(:client).permit(:nombre, :tipo_identificacion, :identificacion, :razon_social, :regimen, :actividad_comercial,\n :direccion, :ciudad, :telefono, :email, account_ids: [])\n end",
"title": ""
}
] |
[
{
"docid": "3663f9efd3f3bbf73f4830949ab0522b",
"score": "0.74768823",
"text": "def whitelisted_params\n super\n end",
"title": ""
},
{
"docid": "36956168ba2889cff7bf17d9f1db41b8",
"score": "0.71700543",
"text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end",
"title": ""
},
{
"docid": "aa06a193f057b6be7c0713a5bd30d5fb",
"score": "0.7044907",
"text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "55ec6c1cf1b67ffe1cee0d4fec651d18",
"score": "0.7009515",
"text": "def allowed_params(*list)\n list.flatten!\n @list_of_allowed_params ||= []\n @list_of_allowed_params += list.map(&:to_s)\n\n params.each do |key, value|\n next if @list_of_allowed_params.index(key.to_s).present?\n\n fail! \"Parameter :#{key} is not allowed\", key.to_sym\n end\n end",
"title": ""
},
{
"docid": "505e334c1850c398069b6fb3948ce481",
"score": "0.69897616",
"text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end",
"title": ""
},
{
"docid": "bfb292096090145a067e31d8fef10853",
"score": "0.6773957",
"text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "236e1766ee20eef4883ed724b83e4176",
"score": "0.6758029",
"text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"title": ""
},
{
"docid": "53d67b9c2ed1e0132c46653273fc708d",
"score": "0.67139274",
"text": "def whitelisted_args\n args.select(&:allowed)\n end",
"title": ""
},
{
"docid": "603f4a45e5efa778afca5372ae8a96dc",
"score": "0.6638781",
"text": "def param_whitelist\n [:role]\n end",
"title": ""
},
{
"docid": "caf5e21ffb495f1a2566ca6a564a6fdb",
"score": "0.6633307",
"text": "def allowed_arguments(arguments); end",
"title": ""
},
{
"docid": "3d346c1d1b79565bee6df41a22a6f28d",
"score": "0.6630876",
"text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "c31ef48e8fd467d94158d7ac7f405a3f",
"score": "0.65786487",
"text": "def list_params\n params.permit(:id, :public_id, :name, :list, :visibility, values: [])\n end",
"title": ""
},
{
"docid": "b29cf4bc4a27d4b199de5b6034f9f8a0",
"score": "0.6551157",
"text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end",
"title": ""
},
{
"docid": "585f461bf01ed1ef8d34fd5295a96dca",
"score": "0.6529035",
"text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "585f461bf01ed1ef8d34fd5295a96dca",
"score": "0.6529035",
"text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "cac0774e508766d2f487cbca3db95df0",
"score": "0.650781",
"text": "def allow_params?\n definition[:param_tokens]\n end",
"title": ""
},
{
"docid": "58d1451e57b0e767db2fc6721dfaa6be",
"score": "0.64761394",
"text": "def allowed_parameters\n parameters.keys\n end",
"title": ""
},
{
"docid": "37d1c971f6495de3cdd63a3ef049674e",
"score": "0.64282405",
"text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "c436017f4e8bd819f3d933587dfa070a",
"score": "0.63983387",
"text": "def filtered_parameters; end",
"title": ""
},
{
"docid": "c72da3a0192ce226285be9c2a583d24a",
"score": "0.63592577",
"text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "7646659415933bf751273d76b1d11b40",
"score": "0.6339914",
"text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end",
"title": ""
},
{
"docid": "2c8e2be272a55477bfc4c0dfc6baa7a7",
"score": "0.6327032",
"text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "b453d9a67af21a3c28a62e1848094a41",
"score": "0.63192505",
"text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "706df0e25391ed2b932f54a646bb0a10",
"score": "0.6280703",
"text": "def list_name_param opts={}\n params.require(:list).permit(:name)\n end",
"title": ""
},
{
"docid": "839591b72f27e154e4840464f1f4684d",
"score": "0.6278046",
"text": "def whitelist=(lst)\n uri.querystring_params[\"whitelist\"] = lst.split(\",\").map(&:strip).reject{|e|e.blank?}\n end",
"title": ""
},
{
"docid": "13a61145b00345517e33319a34f7d385",
"score": "0.62771213",
"text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e64490ed35123aafa1b4627bd165517d",
"score": "0.62693745",
"text": "def allowed_params\n [:title, :description, :is_template, :template_id, :user_id, :color]\n end",
"title": ""
},
{
"docid": "094cae2a77f3def05726eb7961449324",
"score": "0.62682945",
"text": "def allowed; end",
"title": ""
},
{
"docid": "cc60076a498957ddcd05472aa576a2b1",
"score": "0.62651163",
"text": "def param_whitelist\n case action_name\n when 'create'\n [:type, :author_id, :participant_ids]\n else\n [:participant_ids]\n end\n end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.62642586",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.62642586",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.6229388",
"text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.6229388",
"text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end",
"title": ""
},
{
"docid": "91bfe6d464d263aa01e776f24583d1d9",
"score": "0.6213818",
"text": "def permitir_parametros\n params.permit!\n end",
"title": ""
},
{
"docid": "21e97a45d3f9fc907204c8dfd146be09",
"score": "0.62028986",
"text": "def required_params(*list)\n list.flatten!\n @list_of_allowed_params ||= []\n @list_of_allowed_params += list.map(&:to_s)\n list.map(&:to_s).each do |param|\n next if params[param].present?\n\n fail! \"Parameter :#{param} should be present\", param\n end\n end",
"title": ""
},
{
"docid": "e291b3969196368dd4f7080a354ebb08",
"score": "0.61983657",
"text": "def permitir_parametros\n \t\tparams.permit!\n \tend",
"title": ""
},
{
"docid": "e012d7306b402a37012f98bfd4ffdb10",
"score": "0.61918944",
"text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "9ac9542f33069f9d46e4393194623b4c",
"score": "0.61912215",
"text": "def snippets_list_params\n params.require(:snippets_list).permit(:is_public, :tags)\n end",
"title": ""
},
{
"docid": "69d3720ae33b0a9e88f3a951595e767f",
"score": "0.6184765",
"text": "def sanitize_parameters!(sanitizer, params)\n endian = params[:endian] || self.endian\n fields = params[:fields] || self.fields\n hide = params[:hide] || self.hide\n\n params[:endian] = endian unless endian.nil?\n params[:fields] = fields\n params[:hide] = hide\n\n # add default parameters\n default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n super(sanitizer, params)\n end",
"title": ""
},
{
"docid": "a322581bdbf994c8ac99b2f8da40b18f",
"score": "0.61772996",
"text": "def user_params\n params.require(:user).permit(:first_name,:last_name,:email).tap do |whitelisted|\n p params[:user][:role_ids].reject { |c| c.empty? }\n whitelisted[:role_ids] = params[:user][:role_ids].reject { |c| c.empty? }\n end\nend",
"title": ""
},
{
"docid": "9e289c8e3757ad76ffbd2a6991acef28",
"score": "0.61578906",
"text": "def allowed_params\n %i[\n user_defined_id_statelocal\n user_defined_id_cdc\n user_defined_id_nndss\n first_name\n middle_name\n last_name\n date_of_birth\n age\n sex\n white\n black_or_african_american\n american_indian_or_alaska_native\n asian\n native_hawaiian_or_other_pacific_islander\n ethnicity\n primary_language\n secondary_language\n interpretation_required\n nationality\n address_line_1\n foreign_address_line_1\n address_city\n address_state\n address_line_2\n address_zip\n address_county\n monitored_address_line_1\n monitored_address_city\n monitored_address_state\n monitored_address_line_2\n monitored_address_zip\n monitored_address_county\n foreign_address_city\n foreign_address_country\n foreign_address_line_2\n foreign_address_zip\n foreign_address_line_3\n foreign_address_state\n foreign_monitored_address_line_1\n foreign_monitored_address_city\n foreign_monitored_address_state\n foreign_monitored_address_line_2\n foreign_monitored_address_zip\n foreign_monitored_address_county\n primary_telephone\n primary_telephone_type\n secondary_telephone\n secondary_telephone_type\n email\n preferred_contact_method\n preferred_contact_time\n port_of_origin\n source_of_report\n source_of_report_specify\n flight_or_vessel_number\n flight_or_vessel_carrier\n port_of_entry_into_usa\n travel_related_notes\n additional_planned_travel_type\n additional_planned_travel_destination\n additional_planned_travel_destination_state\n additional_planned_travel_destination_country\n additional_planned_travel_port_of_departure\n date_of_departure\n date_of_arrival\n additional_planned_travel_start_date\n additional_planned_travel_end_date\n additional_planned_travel_related_notes\n last_date_of_exposure\n potential_exposure_location\n potential_exposure_country\n contact_of_known_case\n contact_of_known_case_id\n travel_to_affected_country_or_area\n was_in_health_care_facility_with_known_cases\n was_in_health_care_facility_with_known_cases_facility_name\n laboratory_personnel\n laboratory_personnel_facility_name\n healthcare_personnel\n healthcare_personnel_facility_name\n exposure_notes\n crew_on_passenger_or_cargo_flight\n monitoring_plan\n exposure_risk_assessment\n member_of_a_common_exposure_cohort\n member_of_a_common_exposure_cohort_type\n isolation\n jurisdiction_id\n assigned_user\n symptom_onset\n case_status\n ]\n end",
"title": ""
},
{
"docid": "4f7be6ec5bf491c0125e1c2091de0a80",
"score": "0.61395127",
"text": "def place_allow_list_params\n params.permit(:place_id, :group_category_id, :enable)\n end",
"title": ""
},
{
"docid": "3512da8c3cbc10950f1c278d883a22d0",
"score": "0.6128934",
"text": "def check_permit!\n tracker.find_call(:method => :permit!).each do |result|\n if params? result[:call].target and not result[:chain].include? :slice\n warn_on_permit! result\n end\n end\n end",
"title": ""
},
{
"docid": "3ae7a4551c9ded91965010fecb51d76b",
"score": "0.6116012",
"text": "def validate_parameters(allow: [], required: nil, require_any_of: nil) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity\n if required\n raise ArgumentError, \"Expected required parameters as Array of Symbols, got #{required}\" unless required.is_a?(Array) && required.all? { |r| r.is_a?(Symbol) }\n raise ArgumentError, \"#{@__resource_name__}: `#{required}` must be provided\" unless @opts.is_a?(Hash) && required.all? { |req| @opts.key?(req) && !@opts[req].nil? && @opts[req] != \"\" }\n allow += required\n end\n\n if require_any_of\n raise ArgumentError, \"Expected required parameters as Array of Symbols, got #{require_any_of}\" unless require_any_of.is_a?(Array) && require_any_of.all? { |r| r.is_a?(Symbol) }\n raise ArgumentError, \"#{@__resource_name__}: One of `#{require_any_of}` must be provided.\" unless @opts.is_a?(Hash) && require_any_of.any? { |req| @opts.key?(req) && !@opts[req].nil? && @opts[req] != \"\" }\n allow += require_any_of\n end\n\n allow += %i(client_args stub_data aws_region aws_endpoint aws_retry_limit aws_retry_backoff resource_data)\n raise ArgumentError, \"Scalar arguments not supported\" unless defined?(@opts.keys)\n raise ArgumentError, \"Unexpected arguments found\" unless @opts.keys.all? { |a| allow.include?(a) }\n raise ArgumentError, \"Provided parameter should not be empty\" unless @opts.values.all? do |a|\n return true if a.instance_of?(Integer)\n return true if [TrueClass, FalseClass].include?(a.class)\n !a.empty?\n end\n true\n end",
"title": ""
},
{
"docid": "356c5fd5dcbe9214f1330792fa2e18b5",
"score": "0.61158365",
"text": "def param_whitelist\n whitelist = [\n :name,\n :details,\n :completed,\n :started_at, :finished_at,\n :team_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:team_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "f19218511bb46b261576fd4a0359ddd0",
"score": "0.6112491",
"text": "def public_list_params\n params.require(:public_list).permit(:name, :description, places_attributes: [])\n end",
"title": ""
},
{
"docid": "76ec9935ef327d0b5d1af534978cb4f8",
"score": "0.6111488",
"text": "def voter_list_params\n params.require(:voter_list).permit(:user_id, :selection_process_id, :estado, :search, :admission)\n end",
"title": ""
},
{
"docid": "96a4c3e9d28624613a41897ea478af4c",
"score": "0.6111325",
"text": "def list_params\n params.require(:list).permit(:name, :description, :user_id)\n end",
"title": ""
},
{
"docid": "b275e68d657aac7565b7da55922cbcae",
"score": "0.6102179",
"text": "def should_filter_params(*keys)\n ::ActiveSupport::Deprecation.warn(\"use: should filter_param\")\n keys.each do |key|\n should filter_param(key)\n end\n end",
"title": ""
},
{
"docid": "5775dd2574b8acbba92a6a825c2a30b7",
"score": "0.6079451",
"text": "def allow_scopes(*args)\n @target.filterable_scopes = args\n end",
"title": ""
},
{
"docid": "7e3b725e746658a932308b2245800100",
"score": "0.6065513",
"text": "def list_params\n params.require(:list).permit(:user_id)\n end",
"title": ""
},
{
"docid": "b436ac15f83c93ec97a7852cc3cd560d",
"score": "0.6064122",
"text": "def list_params\n params.require(:list).permit(\n :name, :user_id, :location_ids => []\n )\n end",
"title": ""
},
{
"docid": "f5b444bcf4dbe089582ac3c3cf81ca92",
"score": "0.60615236",
"text": "def price_list_params\n params.fetch(:price_list, {}).permit(PriceList::PERMITED_PARAMS)\n end",
"title": ""
},
{
"docid": "d5df8448adfa675e6d25aeb23d7a5e34",
"score": "0.6058738",
"text": "def sanitize_query_fields\n allowed_fields = @list.property_index_keys\n return request.query_parameters.select {|key, val| allowed_fields.include?(key)}\n end",
"title": ""
},
{
"docid": "61d793e7f8b92dfddfe9ee932db6bae5",
"score": "0.60527927",
"text": "def my_list_params\n params.require(:my_list).permit(:user_id, :query)\n end",
"title": ""
},
{
"docid": "3da9117a80cdfd040f0f0ed9d3ffed55",
"score": "0.60501283",
"text": "def allowable_params(unfiltered_params)\n unfiltered_params.permit(:property_id, :branch_id, :client_name, :branch_name,\n :department, :reference_number, :address_name, :address_number, :address_street,\n :address2, :address3, :address4, :address_postcode, :country, :display_address,\n :property_bedrooms, :property_bathrooms, :property_ensuites, :property_reception_rooms,\n :property_kitchens, :display_property_type, :property_type, :property_style,\n :property_age, :floor_area, :floor_area_units, :property_feature1, :property_feature2,\n :property_feature3, :property_feature4, :property_feature5, :property_feature6,\n :property_feature7, :property_feature8, :property_feature9, :property_feature10,\n :price, :for_sale_poa, :price_qualifier, :property_tenure, :sale_by,\n :development_opportunity, :investment_opportunity, :estimated_rental_income,\n :availability, :main_summary, :full_description, :date_last_modified,\n :featured_property, :region_id, :latitude, :longitude,\n flags_attributes: [:title],\n images_attributes: [:url, :modified],\n floorplans_attributes: [:url, :modified],\n epc_graphs_attributes: [:url, :modified],\n epc_front_pages_attributes: [:url, :modified],\n brochures_attributes: [:url, :modified],\n virtual_tours_attributes: [:url, :modified],\n external_links_attributes: [:url, :description, :modified])\n end",
"title": ""
},
{
"docid": "b63e6e97815a8745ab85cd8f7dd5b4fb",
"score": "0.6045103",
"text": "def excluded_from_filter_parameters; end",
"title": ""
},
{
"docid": "84bd386d5b2a0d586dca327046a81a63",
"score": "0.6032686",
"text": "def good_params\n permit_params\n end",
"title": ""
},
{
"docid": "25220437209ae6056988e50c38a01211",
"score": "0.6025226",
"text": "def trust_params\n trusts = params.select { |k, _v| k.starts_with?(\"vault_entry_\") }\n permitted_params = {}\n trusts.keys.each do |trust|\n permitted_params[trust] = [:id, :name, :notes, :document_id, agent_ids: [], trustee_ids: [], successor_trustee_ids: [], share_ids: [],\n share_with_contact_ids: []]\n end\n trusts.permit(permitted_params)\n end",
"title": ""
},
{
"docid": "08a3b9a8de9dd7334ffe66919731cb94",
"score": "0.60225105",
"text": "def permit_params!(params)\n if @allow_all_params\n params.permit!\n elsif @allowed_params\n @allowed_params.each do |resource, attributes|\n if params[resource].respond_to? :permit\n params[resource] = params[resource].permit(*attributes)\n end\n end\n end\n end",
"title": ""
},
{
"docid": "4aa2ef6967e8f3024acea2b3d1cfd9e5",
"score": "0.6019055",
"text": "def allow_list_all?\n false\n end",
"title": ""
},
{
"docid": "45791845cef485d15b7014088dd0be8d",
"score": "0.60152686",
"text": "def allowed_params\n %i[title body]\n end",
"title": ""
},
{
"docid": "cb7fc4ad3e08a4341c6395a2c154c575",
"score": "0.6009825",
"text": "def filter_params(_sub_object_attribute = nil)\n required = :returns_lbtt_party\n attribute_list = Lbtt::Party.attribute_list\n params.require(required).permit(attribute_list) if params[required]\n end",
"title": ""
},
{
"docid": "cb7fc4ad3e08a4341c6395a2c154c575",
"score": "0.6009825",
"text": "def filter_params(_sub_object_attribute = nil)\n required = :returns_lbtt_party\n attribute_list = Lbtt::Party.attribute_list\n params.require(required).permit(attribute_list) if params[required]\n end",
"title": ""
},
{
"docid": "bd826c318f811361676f5282a9256071",
"score": "0.6003619",
"text": "def filter_parameters; end",
"title": ""
},
{
"docid": "0c9d4c365c1621bdf0a6b700bd6e3bef",
"score": "0.59931374",
"text": "def cleanedParams(params)\n params.select {|k, v| ALLOWED_PARAMS.include? k}\n end",
"title": ""
},
{
"docid": "71f97bda880101aa36b21017c0787f98",
"score": "0.5989032",
"text": "def validate_params\n invalid_parameter = @params.find { |key, value| !ConsolidatedScreeningList::PARAMETERS.key?(key) }\n raise ArgumentError, \"Invalid parameter: #{@params}\" if invalid_parameter\n end",
"title": ""
},
{
"docid": "67fe19aa3f1169678aa999df9f0f7e95",
"score": "0.5984926",
"text": "def list_params\n params.permit(:name)\n end",
"title": ""
},
{
"docid": "6af3741c8644ee63d155db59be10a774",
"score": "0.59798354",
"text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end",
"title": ""
},
{
"docid": "f023b3871638291b75273a71bc75459c",
"score": "0.59747314",
"text": "def page_list_params\n params.permit(:url_list)\n params[:page_list].permit!\n end",
"title": ""
},
{
"docid": "d78d0776c63005d7f56f3a21b5e4c50a",
"score": "0.59729695",
"text": "def user_list_params\n params.require(:user_list).permit(:user_id, :list_id)\n end",
"title": ""
},
{
"docid": "4cf4346dd54b99fe0a7782ceaf7c26be",
"score": "0.5971315",
"text": "def quotation_list_params\n params.require(:quotation_list).permit!\n end",
"title": ""
},
{
"docid": "38ed4234ecadfc5889a7c25028dc9a58",
"score": "0.5965672",
"text": "def sanitize(params = {})\n blacklist = options.fetch(:blacklist, []).map(&:to_s)\n redacted_string = options.fetch(:redacted_string, 'REDACTED')\n params.each do |param, _value|\n params[param] = redacted_string if blacklist.include?(param.to_s)\n end\n end",
"title": ""
},
{
"docid": "157e773497f78353899720ad034a906a",
"score": "0.5962804",
"text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end",
"title": ""
},
{
"docid": "5fc4ba2ae074a90a66c53c25e751f3f0",
"score": "0.5960231",
"text": "def black_list_params\n params.require(:black_list).permit(:user)\n end",
"title": ""
},
{
"docid": "63f5e4e9733f9e6b3f98d5e069440292",
"score": "0.595559",
"text": "def black_list_params\r\n params.require(:black_list).permit(:user)\r\n end",
"title": ""
},
{
"docid": "8e519fbf8b7f524a91ac5c7f842a6121",
"score": "0.59538776",
"text": "def validate_params_present!; end",
"title": ""
},
{
"docid": "037a774fcd9c86ff09a88570fba7bebd",
"score": "0.59527713",
"text": "def filter_for ownable\n # get the class name of the ownable\n class_name = ownable.class_name_to_sym.to_s\n \n # make sure params format is as follows:\n # { ownable_class_name: {param1: :value, param2: :value} }\n params.required(class_name)\n\n # return {} if !params || params.empty?\n\n # get a list of attributes that are allowed for this item\n # could be true, false, or an array of allowed attributes\n allowed_attributes = attributes_for(ownable)\n\n # decide how to handle the received attributes\n if allowed_attributes == true\n \n # allow all\n params.permit!\n\n elsif allowed_attributes == false\n \n # allow none\n params.permit *[]\n\n else\n \n # filter out everything except allowed_attributes\n params.permit *allowed_attributes\n \n raise params.to_yaml\n end\n\n end",
"title": ""
},
{
"docid": "d4e0fd0cd70ef3707f081791087f33b6",
"score": "0.5949399",
"text": "def validate_parameters(allow: [], required: nil, require_any_of: nil)\n opts = @opts\n allow += %i(azure_retry_limit azure_retry_backoff azure_retry_backoff_factor\n endpoint api_version required_parameters allowed_parameters display_name method)\n Validators.validate_parameters(resource_name: @__resource_name__,\n allow: allow, required: required,\n require_any_of: require_any_of, opts: opts)\n true\n end",
"title": ""
},
{
"docid": "d7f0d4c3dc66c34a6e17c0a14432c0e9",
"score": "0.5946416",
"text": "def verification_list_params\n params.require(:verification_list).permit!\n end",
"title": ""
},
{
"docid": "5ed866fb3c6ebdffbc794d04bb9f2531",
"score": "0.5945795",
"text": "def list_params\n params.fetch(:list, {}).permit(\n :name\n )\n end",
"title": ""
},
{
"docid": "ba0704d4182a1a6fb0a743f6eb9cd25e",
"score": "0.59403497",
"text": "def check_params\n\t\t\t return []\t\t\t \n\tend",
"title": ""
},
{
"docid": "229afde2ab7c3109de2027d47fba2c70",
"score": "0.5937114",
"text": "def white_list_params(params, allowed_values, ignored_values = [])\n result = {}\n params.each_pair do |key, value|\n if allowed_values.include? key\n result[key] = value\n elsif !ignored_values.include?(key)\n raise SwaggerInvalidException.new(\"Unknown property [#{key}] with value [#{value}]#{list_or_none(allowed_values, 'properties')}\")\n end\n end\n result\n end",
"title": ""
},
{
"docid": "a99f218b156087cc665291b5dfc21e1f",
"score": "0.59363353",
"text": "def validate_parameters(allow: [], required: nil, require_any_of: nil)\n if required\n raise ArgumentError, \"Expected required parameters as Array of Symbols, got #{required}\" unless required.is_a?(Array) && required.all? { |r| r.is_a?(Symbol) }\n raise ArgumentError, \"#{@__resource_name__}: region must be provided via environment variable or hash parameter\" if required.include?(:region) && ([email protected]_a?(Hash) || (@opts[:region].nil? || @opts[:region] == \"\"))\n raise ArgumentError, \"#{@__resource_name__}: `#{required}` must be provided\" unless @opts.is_a?(Hash) && required.all? { |req| @opts.key?(req) && !@opts[req].nil? && @opts[req] != \"\" }\n\n allow += required\n end\n\n if require_any_of\n raise ArgumentError, \"Expected required parameters as Array of Symbols, got #{require_any_of}\" unless require_any_of.is_a?(Array) && require_any_of.all? { |r| r.is_a?(Symbol) }\n raise ArgumentError, \"#{@__resource_name__}: One of `#{require_any_of}` must be provided.\" unless @opts.is_a?(Hash) && require_any_of.any? { |req| @opts.key?(req) && !@opts[req].nil? && @opts[req] != \"\" }\n\n allow += require_any_of\n end\n\n allow += %i{region} unless allow.include?(:region)\n allow += %i{endpoint} unless allow.include?(:endpoint)\n @opts.delete(:region) if @opts.is_a?(Hash) && @opts[:region].nil?\n\n raise ArgumentError, \"Scalar arguments not supported\" unless defined?(@opts.keys)\n raise ArgumentError, \"Unexpected arguments found\" unless @opts.keys.all? { |a| allow.include?(a) }\n raise ArgumentError, \"Provided parameter should not be empty\" unless @opts.values.all? do |a|\n return true if a.instance_of?(Integer) || a.instance_of?(TrueClass) || a.instance_of?(FalseClass)\n\n !a.empty?\n end\n\n true\n end",
"title": ""
},
{
"docid": "527035c39c066958cc202c06528f2673",
"score": "0.59362227",
"text": "def patient_list_params\n params.require(:patient_list).permit!\n end",
"title": ""
},
{
"docid": "ab49b0baeea5bf6f204adca9e864094e",
"score": "0.59332967",
"text": "def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"title": ""
},
{
"docid": "5b53a222b1dec771125370679892e873",
"score": "0.5929766",
"text": "def sanitize(raw_parameters = {})\n kept_params = {}\n sanitize_nesting(kept_params, @whitelist, symbolize_recursive(raw_parameters))\n kept_params\n end",
"title": ""
},
{
"docid": "d8b02fce801fc219417d86d0ca117836",
"score": "0.59260756",
"text": "def _valid_params\n valid_params # method private cause needed only for internal usage\n end",
"title": ""
},
{
"docid": "d8b02fce801fc219417d86d0ca117836",
"score": "0.59260756",
"text": "def _valid_params\n valid_params # method private cause needed only for internal usage\n end",
"title": ""
},
{
"docid": "f70301232281d001a4e52bd9ba4d20f5",
"score": "0.5921627",
"text": "def room_allowed_params\n end",
"title": ""
},
{
"docid": "a1a9495fb0e2abd93f64e7d722073f1f",
"score": "0.59203607",
"text": "def interest_list_params\n params.require(:interest_list).permit(:name, :public, :user_id)\n end",
"title": ""
},
{
"docid": "b3e49440054c3ad3ddb77e29e74a8e4b",
"score": "0.59200895",
"text": "def sanitized_allowed_attributes=(attributes)\n sanitizer_vendor.safe_list_sanitizer.allowed_attributes = attributes\n end",
"title": ""
},
{
"docid": "7d35b10ac04b461c800fcfea1623a8bb",
"score": "0.591923",
"text": "def sanitize_by_param(allowed=[], default='id')\n sanitize_params params && params[:by], allowed, default\n end",
"title": ""
},
{
"docid": "7d35b10ac04b461c800fcfea1623a8bb",
"score": "0.591923",
"text": "def sanitize_by_param(allowed=[], default='id')\n sanitize_params params && params[:by], allowed, default\n end",
"title": ""
},
{
"docid": "9bd89e2fd22e220afe97917f75377374",
"score": "0.59133667",
"text": "def whitelist\n gather_params(self.jsonschema) if self.jsonschema.present? && self.jsonschema.key?('properties')\n end",
"title": ""
},
{
"docid": "1685d76d665d2c26af736aa987ac8b51",
"score": "0.5912647",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "7f38dfb5bc4d7e89f8aa414e3097f268",
"score": "0.5905095",
"text": "def allow_access_list(opts)\n opts = check_params(opts,[:self_ips])\n super(opts)\n end",
"title": ""
},
{
"docid": "bf71f22b6a3d024d9581258c3391dd13",
"score": "0.59014034",
"text": "def filter_params(params); end",
"title": ""
},
{
"docid": "925ab7429771692d76184dc744dc843c",
"score": "0.58916956",
"text": "def user_list_params\n params.require(:user_list).permit(:user_id, :user_name)\n end",
"title": ""
},
{
"docid": "1c1ee6cc45fd852cab3c1e192bec902b",
"score": "0.5888005",
"text": "def parametro_params\r\n params.require(:parametro).tap do |whitelisted|\r\n whitelisted[:clave] = params[:parametro][:clave]\r\n whitelisted[:valor] = params[:parametro][:valor]\r\n whitelisted[:bloqueado] = params[:parametro][:bloqueado]\r\n\r\n for i in 0..params[:parametro].count do\r\n whitelisted[\"valor#{i}\".to_sym] = params[:parametro][\"valor#{i}\".to_sym]\r\n end\r\n end\r\n # params.require(:parametro).permit(:clave, :valor)\r\n end",
"title": ""
},
{
"docid": "b248e725f40ba361d6e0529f389090df",
"score": "0.5884956",
"text": "def filter_by_param(params={})\n if (sub_keys = params[\"allowed_keys\"])\n sub_keys.split(',').select do |key|\n self.allowed_keys.any? {|allowed_key| key.start_with?(allowed_key)}\n end\n else\n self.allowed_keys\n end\n end",
"title": ""
}
] |
81a41b6dc74e536c4155b166433ecbf4
|
TODO Work out what the min packet size really is
|
[
{
"docid": "ca0283caaf76450a9750292f6c727bcf",
"score": "0.0",
"text": "def initialize\n @buffer = String.new().force_encoding('binary')\n end",
"title": ""
}
] |
[
{
"docid": "0e13615e77021c6122353d70c4b2eb3c",
"score": "0.6800629",
"text": "def min_size\n data[:min_size]\n end",
"title": ""
},
{
"docid": "4f9b6c392b0b492c9663ac5705cd5294",
"score": "0.66406304",
"text": "def min_size\n data.min_size\n end",
"title": ""
},
{
"docid": "41d607e27513ce1fa4f9f76a85f999b0",
"score": "0.66140974",
"text": "def packet_buffer_size\n instance.packet_buffer.size\n rescue NoMethodError\n 0\n end",
"title": ""
},
{
"docid": "1c288f1958591d08694f13aae2339d55",
"score": "0.6539851",
"text": "def size_packets_all\n self.size_packets_incoming + self.size_packets_outgoing\n end",
"title": ""
},
{
"docid": "f6ea6c2ada03e43c0efdd6b183f13bfb",
"score": "0.6340265",
"text": "def minimum_size(options)\n version = 4\n\n if ( options.kind_of?(Hash) )\n if ( !options.has_key?(:IPCount) )\n raise ArgumentError, \"Missing argument: List.\"\n end\n ipcount = options[:IPCount]\n \n if (options.has_key?(:Version))\n version = options[:Version]\n end\n elsif ( options.kind_of?(Integer) )\n ipcount = options\n else\n raise ArgumentError, \"Integer or Hash expected but #{options.class} provided.\"\n end\n \n if (version == 4)\n max_bits = 32 \n else\n max_bits = 128\n end\n \n \n if (ipcount > 2**max_bits) \n raise \"Required IP count exceeds number of IP addresses available \" +\n \"for IPv#{version}.\"\n end\n\n \n bits_needed = 0\n until (2**bits_needed >= ipcount)\n bits_needed += 1\n end\n subnet_bits = max_bits - bits_needed\n \n return(subnet_bits)\nend",
"title": ""
},
{
"docid": "0b3cef28a76eca86d75d84c0790adbc0",
"score": "0.6324193",
"text": "def get_max_packed_length()\n (@prefixer.get_packed_length) + (@interpreter.get_packed_length(@length))\n end",
"title": ""
},
{
"docid": "d4a8c9f0cfbcee82617963e8576a2fc1",
"score": "0.63182324",
"text": "def minimum_size(ipcount, options=nil)\n version = 4\n extended = false\n known_args = [:Version, :Extended]\n\n # validate ipcount\n raise ArgumentError, \"Integer expected for argument 'ipcount' but #{ipcount.class} provided.\" if (!ipcount.kind_of?(Integer))\n\n # validate options\n if (options)\n raise ArgumentError, \"Hash expected for argument 'options' but #{options.class} provided.\" if (!options.kind_of?(Hash))\n\n NetAddr.validate_args(options.keys,known_args)\n\n if (options.has_key?(:Version))\n version = options[:Version]\n end\n\n if (options.has_key?(:Extended) && options[:Extended] == true)\n extended = true\n end\n end\n\n return( ip_count_to_size(ipcount,version,extended) )\nend",
"title": ""
},
{
"docid": "b0bacc917e533718ccc02ea7092ef2fb",
"score": "0.62766725",
"text": "def required_space\n # Start with our cached default generated size\n space = cached_size\n\n # Reliability checks add 4 bytes for the first check, 5 per recv check (2)\n # TODO: coming soon\n #space += 14\n\n # The final estimated size\n space\n end",
"title": ""
},
{
"docid": "75d32fafcfae7c94fc3c8d5decc3ad3c",
"score": "0.6276425",
"text": "def compressed_size; end",
"title": ""
},
{
"docid": "75d32fafcfae7c94fc3c8d5decc3ad3c",
"score": "0.6276425",
"text": "def compressed_size; end",
"title": ""
},
{
"docid": "75d32fafcfae7c94fc3c8d5decc3ad3c",
"score": "0.6276425",
"text": "def compressed_size; end",
"title": ""
},
{
"docid": "3f75e7a8b28221a67a725f3fae6e389e",
"score": "0.62737733",
"text": "def minimum_size\n return @minimum_size\n end",
"title": ""
},
{
"docid": "9f60216211d086e0e94f308530afcc19",
"score": "0.625741",
"text": "def get_minimum_order_size(crypto, fiat) end",
"title": ""
},
{
"docid": "2bea480c519d9d28cfbaaafba8516423",
"score": "0.6243071",
"text": "def node_byte_size; end",
"title": ""
},
{
"docid": "8a7f2f020848942c737b980089f7a350",
"score": "0.6181358",
"text": "def get_outbound_data_size; end",
"title": ""
},
{
"docid": "6b0bf4279bb5442f3e8f650da1b4076b",
"score": "0.6169566",
"text": "def udp_calc_len\n\t\t\tbody.to_s.size + 8\n\t\tend",
"title": ""
},
{
"docid": "094af6559f33456af39440eefe85f3fb",
"score": "0.6150019",
"text": "def udp_calc_len\n body.to_s.size + 8\n end",
"title": ""
},
{
"docid": "9501f51ded093b9d62d1667d6b8be356",
"score": "0.61417484",
"text": "def udp_packet_size\n # if @udp_size > DefaultUDPSize then we use EDNS and\n # @udp_size should be taken as the maximum packet_data length\n ret = (@udp_size > Resolver::DefaultUDPSize ? @udp_size : Resolver::DefaultUDPSize)\n return ret\n end",
"title": ""
},
{
"docid": "ffc0468cd73e4772b12fda3b23045a9b",
"score": "0.613768",
"text": "def compression_minimum_size\n super\n end",
"title": ""
},
{
"docid": "da45440621549474b357861d61742bfd",
"score": "0.61142147",
"text": "def rtt_packet_length\n super\n end",
"title": ""
},
{
"docid": "2663f34da61b103b5b32f30f333e9e39",
"score": "0.609504",
"text": "def min_size\n @min_size ||= options[:min_pool_size] || MIN_SIZE\n end",
"title": ""
},
{
"docid": "2663f34da61b103b5b32f30f333e9e39",
"score": "0.609504",
"text": "def min_size\n @min_size ||= options[:min_pool_size] || MIN_SIZE\n end",
"title": ""
},
{
"docid": "80b26aaf4b9b0603283900dea62bc1f6",
"score": "0.6087139",
"text": "def size\r\n\t\[email protected]\r\n\tend",
"title": ""
},
{
"docid": "5f358796f18d461a2a26071813258a44",
"score": "0.6083393",
"text": "def n_bytes; end",
"title": ""
},
{
"docid": "ba1000eb52c765fcb9a0caa9fb43eae9",
"score": "0.6054541",
"text": "def byte_size(); 0; end",
"title": ""
},
{
"docid": "f29fc5f0abeeb6f2a6a5b28370b5f01b",
"score": "0.6046129",
"text": "def frame_size\n end",
"title": ""
},
{
"docid": "c408d95991d760b6eecec5efdc899426",
"score": "0.6035442",
"text": "def wMaxPacketSize\n self[:wMaxPacketSize]\n end",
"title": ""
},
{
"docid": "ec139b6d6a7ea253c9f62e2e156485ac",
"score": "0.60308486",
"text": "def min_burst_size\n @min_burst_size || transfer_size\n end",
"title": ""
},
{
"docid": "437eeffe8be5e130386ab67ac17298de",
"score": "0.60131097",
"text": "def byte_length\n 4\n end",
"title": ""
},
{
"docid": "9946bd300cdab69df76f79bab8ae23c1",
"score": "0.6008076",
"text": "def size\n 148 * self.in.size + 34 * self.out.size + 10\n end",
"title": ""
},
{
"docid": "69bbd0812f8b9566c1405dc0db491406",
"score": "0.5991473",
"text": "def min_items\n case @data_type\n when GDT_NO_DATA\n\t\t 0\n when GDT_ASCII\n\t\t (@size == 0) ? 1 : @min_len/@size\n else \n @min_len/@size\n end\n end",
"title": ""
},
{
"docid": "99f0a1b5cec725aae752f4b15b7e941f",
"score": "0.5983682",
"text": "def mtu\n @mtu\n end",
"title": ""
},
{
"docid": "99f0a1b5cec725aae752f4b15b7e941f",
"score": "0.5982509",
"text": "def mtu\n @mtu\n end",
"title": ""
},
{
"docid": "9aa5ebef4f2bb06e4d09a6bbda122cf1",
"score": "0.59813243",
"text": "def length_bytes; end",
"title": ""
},
{
"docid": "9aa5ebef4f2bb06e4d09a6bbda122cf1",
"score": "0.59813243",
"text": "def length_bytes; end",
"title": ""
},
{
"docid": "54a780cf458e843e824467cbb5481870",
"score": "0.59748346",
"text": "def bytes_needed(count); end",
"title": ""
},
{
"docid": "71896e4a2199d53d89207bbeadf78bc5",
"score": "0.5970682",
"text": "def min_size\n @min_size ||= options[:min_size] || DEFAULT_MIN_SIZE\n end",
"title": ""
},
{
"docid": "2312e401a8c94701975ebb0e5a480613",
"score": "0.592288",
"text": "def original_size; end",
"title": ""
},
{
"docid": "46e3bf7885b0459e64b9f63c63dda732",
"score": "0.592238",
"text": "def min_time_slot_size\n @min_slot_size ||= ApiThrottle.configuration.min_time_slot_size\n end",
"title": ""
},
{
"docid": "16234f85eca1195d2c178d911e386d81",
"score": "0.59223545",
"text": "def tcp_data_len ; ip_len - ( ip_hlen * 4 ) - (tcp_hlen * 4) ; end",
"title": ""
},
{
"docid": "0434c0fa414a9b4ec1afddfcfbd22fc4",
"score": "0.58936554",
"text": "def size\n [capacity, pushes.size].min\n end",
"title": ""
},
{
"docid": "a56cf8cccf0edbb41a301dec7bfb5828",
"score": "0.5892957",
"text": "def message_size\n self[:parsed] - self[:off] + self[:used]\n end",
"title": ""
},
{
"docid": "0eb959e58aaafacf91f6f3e4af15c8c9",
"score": "0.5867607",
"text": "def max_sql_bytesize\n @max_sql_bytesize ||= database_variable_get(:MAX_ALLOWED_PACKET).to_i\n end",
"title": ""
},
{
"docid": "3ec8977ef4f6e4032a73bef4e9a87420",
"score": "0.5853278",
"text": "def pack_it_with_size(nbytes, int); end",
"title": ""
},
{
"docid": "1630ae1e20d474d37dc52112012afd9a",
"score": "0.58522874",
"text": "def udp_len; self[:udp_len].to_i; end",
"title": ""
},
{
"docid": "289fa190e66e2c4db09022726e0007e8",
"score": "0.58474034",
"text": "def max_data_transfer_bytes\n 4\n end",
"title": ""
},
{
"docid": "54460b7dd1297d5d8b3b2322b0d4b56c",
"score": "0.5840206",
"text": "def node_byte_size\n @record_size / 4\n end",
"title": ""
},
{
"docid": "2b82a79b78c618a765199435c9f4d143",
"score": "0.58401775",
"text": "def num_bytes(*) end",
"title": ""
},
{
"docid": "e8196a5907be22b39efe01250ac53b72",
"score": "0.58283514",
"text": "def puts_small(bytes, size)\n packet_list = FFI::MemoryPointer.new(256)\n packet_ptr = Map.MIDIPacketListInit(packet_list)\n if Map::SnowLeopard\n packet_ptr = Map.MIDIPacketListAdd(packet_list, 256, packet_ptr, 0, size, bytes)\n else\n # Pass in two 32-bit 0s for the 64 bit time\n packet_ptr = Map.MIDIPacketListAdd(packet_list, 256, packet_ptr, 0, 0, size, bytes)\n end\n Map.MIDISend( @handle, @resource, packet_list )\n end",
"title": ""
},
{
"docid": "e78bb35d3b1190a1d2bf70c54f07b868",
"score": "0.58256173",
"text": "def frame_size\n ((COEFFICIENTS[lsf][layer] * bitrate * 1000 / sample_rate) + @padded_stream) * SLOT_SIZES[layer]\n end",
"title": ""
},
{
"docid": "487fc9d14690b80bf1402262d50bcea3",
"score": "0.582375",
"text": "def set_rtt_packet_length\n super\n end",
"title": ""
},
{
"docid": "ac01293baa35cbafefb1e07aa15f1d76",
"score": "0.58084476",
"text": "def header_udp package_number, file_size, signal=\"send\"\n file_size = \"%0#{@header_file_size}b\" % file_size\n number_package = \"%0#{@header_number_package_size}b\" % package_number\n eof = \"0\" if signal == \"send\"\n eof = \"1\" if signal == \"eof\"\n file_size + number_package + eof\n end",
"title": ""
},
{
"docid": "92acf5d6183930cb4ef1685951b36e18",
"score": "0.5805115",
"text": "def tcp_hlen ; ( ( ip_data.getbyte(12) & 0XF0) / 16 ) ; end",
"title": ""
},
{
"docid": "b10f7e9ebea851c1aa545180fe65c4dd",
"score": "0.57945573",
"text": "def send_buffer_size\n super\n end",
"title": ""
},
{
"docid": "b10f7e9ebea851c1aa545180fe65c4dd",
"score": "0.57945573",
"text": "def send_buffer_size\n super\n end",
"title": ""
},
{
"docid": "14fb311264ac05eefd3fc6c1b6a498cc",
"score": "0.57892436",
"text": "def max_sql_bytesize\n @max_sql_bytesize ||= parent.connection.database_variable_get(:MAX_ALLOWED_PACKET).to_i\n end",
"title": ""
},
{
"docid": "12f1a2f94dd59cacbd5101beda62f7cb",
"score": "0.57852054",
"text": "def size\n @encoder.size / 8\n end",
"title": ""
},
{
"docid": "caca3207420b486334fcd5d85c5c5b72",
"score": "0.57775974",
"text": "def compressed_size=(_arg0); end",
"title": ""
},
{
"docid": "caca3207420b486334fcd5d85c5c5b72",
"score": "0.57775974",
"text": "def compressed_size=(_arg0); end",
"title": ""
},
{
"docid": "92db54cd224056973b21489673c8e508",
"score": "0.5774875",
"text": "def d_size\n @capacity / @blockSize\n end",
"title": ""
},
{
"docid": "cb94977eb6ce31472c23cc168c3d3182",
"score": "0.5770207",
"text": "def tcp_hlen; self[:tcp_hlen].to_i; end",
"title": ""
},
{
"docid": "8bb493e9f1b5dd2baff7d7b4ee9a4da5",
"score": "0.57477766",
"text": "def recv_packet(socket)\n # read the size and then the rest of the packet\n msg_size = socket.read(4).unpack(\"N\").first\n\n if msg_size > 1\n packet = socket.read(msg_size)\n else\n raise AgentException, \"Invalid short packet received from ssh-agent\"\n end\n\n return packet\n end",
"title": ""
},
{
"docid": "137436a6fdadb72420f9c61b50580e28",
"score": "0.57375765",
"text": "def len ; 24 ; end",
"title": ""
},
{
"docid": "639905cc9defee1cfaba742cf5d53bc1",
"score": "0.57344186",
"text": "def payload_size\n unless @payload_size\n @payload_size = name.to_s.bytesize +\n type.to_s.bytesize +\n value.to_s.bytesize\n\n unless members.nil?\n @payload_size = members.inject @payload_size do |sum, member|\n sum + member.payload_size\n end\n end\n end\n\n @payload_size\n end",
"title": ""
},
{
"docid": "e278da23b8633b85582d6d7b10071f15",
"score": "0.57314265",
"text": "def invalid_payload_size(payload)\n size = payload_size(payload)\n size unless size < MAX_PAYLOAD_SIZE\n end",
"title": ""
},
{
"docid": "589ac57ac76a009888b33491d7c249d7",
"score": "0.5726043",
"text": "def tcp_opts_len\n\t\t\ttcp_opts.to_s.size * 4\n\t\tend",
"title": ""
},
{
"docid": "2f5767a0453eff733f551d2d097afc74",
"score": "0.5724367",
"text": "def test_poll_next_packet\n return nil if available <= 0\n\n packet = Net::SSH::Buffer.new(read_available(4))\n length = packet.read_long\n Net::SSH::Packet.new(read_available(length))\n end",
"title": ""
},
{
"docid": "0a050defeef6003833972a7a11a21e92",
"score": "0.5714935",
"text": "def chk\n if @pkt.size > 900 # arbitrary flush, 1024 is the max allowed\n flush\n #sleep(0.01) # don't overwhelm output buffers\n start\n end\n end",
"title": ""
},
{
"docid": "6124f79c57ac92052e1b452253940299",
"score": "0.5708536",
"text": "def maxCapacity\n #60GB => Bytes == 64 424 509 440\n {:eth0=>64424509440}\n end",
"title": ""
},
{
"docid": "33e7caf8177a709e4b2f94aff2a95845",
"score": "0.5705459",
"text": "def expected_size\n limited? ? limit : offset_size\n end",
"title": ""
},
{
"docid": "6f7b8f4bbd5aa22defca04756d869615",
"score": "0.57040143",
"text": "def arp_proto_len; self[:arp_proto_len].to_i; end",
"title": ""
},
{
"docid": "103da9d291c3bb87d37a48b90b545ac0",
"score": "0.569744",
"text": "def stripped_size\n 80 + Bitcoin.pack_var_int(transactions.size).bytesize +\n transactions.inject(0){|sum, tx| sum + tx.serialize_old_format.bytesize}\n end",
"title": ""
},
{
"docid": "351a54a7af5c20cdec7609c0c62f1a2a",
"score": "0.56957453",
"text": "def enqueue_packet(payload) # rubocop:disable Metrics/AbcSize\n # try to compress the packet\n payload = client.compress(payload)\n\n # the length of the packet, minus the padding\n actual_length = (client.hmac.etm ? 0 : 4) + payload.bytesize + 1\n\n # compute the padding length\n padding_length = client.block_size - (actual_length % client.block_size)\n padding_length += client.block_size if padding_length < 4\n\n # compute the packet length (sans the length field itself)\n packet_length = payload.bytesize + padding_length + 1\n\n if packet_length < 16\n padding_length += client.block_size\n packet_length = payload.bytesize + padding_length + 1\n end\n\n padding = Array.new(padding_length) { rand(256) }.pack(\"C*\")\n\n if client.cipher.implicit_mac?\n unencrypted_data = [padding_length, payload, padding].pack(\"CA*A*\")\n message = client.cipher.update_cipher_mac(unencrypted_data, client.sequence_number)\n elsif client.hmac.etm\n debug { \"using encrypt-then-mac\" }\n\n # Encrypt padding_length, payload, and padding. Take MAC\n # from the unencrypted packet_lenght and the encrypted\n # data.\n length_data = [packet_length].pack(\"N\")\n\n unencrypted_data = [padding_length, payload, padding].pack(\"CA*A*\")\n\n encrypted_data = client.update_cipher(unencrypted_data) << client.final_cipher\n\n mac_data = length_data + encrypted_data\n\n mac = client.hmac.digest([client.sequence_number, mac_data].pack(\"NA*\"))\n\n message = mac_data + mac\n else\n unencrypted_data = [packet_length, padding_length, payload, padding].pack(\"NCA*A*\")\n\n mac = client.hmac.digest([client.sequence_number, unencrypted_data].pack(\"NA*\"))\n\n encrypted_data = client.update_cipher(unencrypted_data) << client.final_cipher\n\n message = encrypted_data + mac\n end\n\n debug { \"queueing packet nr #{client.sequence_number} type #{payload.getbyte(0)} len #{packet_length}\" }\n enqueue(message)\n\n client.increment(packet_length)\n\n self\n end",
"title": ""
},
{
"docid": "f529989e6a71d92b226cd6d9c2967994",
"score": "0.5692974",
"text": "def header_size\n 4 * (32 / 8)\n end",
"title": ""
},
{
"docid": "a8826ef87d3a039b185cb9ae56a0d2e2",
"score": "0.56790024",
"text": "def validate_min_size(min, message: nil)\n if get.size < min\n errors << error_message(:min_size, message, min)\n end\n end",
"title": ""
},
{
"docid": "57d971f75444ae4c81ecae0f22e3f033",
"score": "0.56772476",
"text": "def validate_min_size(min, message: nil)\n get.size >= min or add_error(:min_size, message, min) && false\n end",
"title": ""
},
{
"docid": "c94eac3b6c9765e67936cc777950350d",
"score": "0.56719834",
"text": "def mdnsize\n iph = ip_header(self)\n case iph\n when IP\n iph.dst = '224.0.0.251'\n dst_mac.from_human('01:00:5E:00:00:FB')\n when IPv6\n iph.dst = 'ff02::fb'\n dst_mac.from_human('33:33:00:00:00:FB')\n end\n end",
"title": ""
},
{
"docid": "b92a5e632ae8c67432e58a5401e072b7",
"score": "0.56719226",
"text": "def insert_size\n @bam1[:core][:isize]\n end",
"title": ""
},
{
"docid": "8ea9b5cff6c1bf4893dd893c7995e542",
"score": "0.5666957",
"text": "def size_in_bytes\n data[:size_in_bytes]\n end",
"title": ""
},
{
"docid": "e0d6ae6e7943e837acf1f4e485d420ef",
"score": "0.566668",
"text": "def size_fsp_header\n ((4 * 6) + (1 * 8) + (5 * Innodb::List::BASE_NODE_SIZE))\n end",
"title": ""
},
{
"docid": "dc8ccd1301c274eeadafb4eb080ded33",
"score": "0.56652224",
"text": "def set_compression_minimum_size(opts)\n opts = check_params(opts,[:sizes])\n super(opts)\n end",
"title": ""
},
{
"docid": "18369d44e9376c724cd30218f2705d1a",
"score": "0.5644291",
"text": "def size\n space_needed_for(header, code, msg, digest)\n end",
"title": ""
},
{
"docid": "24ae12cd51b3767bb90b163df758c2c9",
"score": "0.5634628",
"text": "def required_space\n # Start with our cached default generated size\n space = cached_size\n\n # Add 100 bytes for the encoder to have some room\n space += 100\n\n # Make room for the maximum possible URL length\n space += 256\n\n # The final estimated size\n space\n end",
"title": ""
},
{
"docid": "9e4c865da2e5fb260386d9a74ef1f985",
"score": "0.5632783",
"text": "def maximum_size; end",
"title": ""
},
{
"docid": "6092aa925491fd62082b0c74a4213ba2",
"score": "0.56316614",
"text": "def size\n 1 + 2 + (payload ? payload.size : 0)\n end",
"title": ""
},
{
"docid": "4109f78ce726c5300ba27252aaeabe84",
"score": "0.56305337",
"text": "def block_size; end",
"title": ""
},
{
"docid": "4109f78ce726c5300ba27252aaeabe84",
"score": "0.56305337",
"text": "def block_size; end",
"title": ""
},
{
"docid": "3412ad757cf606e7464ae21186312877",
"score": "0.5625333",
"text": "def new_size\n return @size * 1024 if @size\n\n return unless @one_res['ORIGINAL_SIZE']\n\n osize = @one_res['ORIGINAL_SIZE'].to_i\n nsize = @one_res['SIZE'].to_i\n nsize > osize ? nsize * 1024 : nil\n end",
"title": ""
},
{
"docid": "42dab2dc3c037932e528c5e926a4b541",
"score": "0.5621457",
"text": "def minimum_supported_mobipocket_version\n @minimum_supported_mobipocket_version ||= @data[104, 4].unpack('N*')[0]\n end",
"title": ""
},
{
"docid": "992f9bd4e87a3c2186a7af4990db6289",
"score": "0.5616691",
"text": "def required_space\n # Start with our cached default generated size\n space = cached_size\n\n # Add 100 bytes for the encoder to have some room\n space += 100\n\n # Make room for the maximum possible URL length (wchars)\n space += 512 * 2\n\n # proxy (wchars)\n space += 128 * 2\n\n # EXITFUNK processing adds 31 bytes at most (for ExitThread, only ~16 for others)\n space += 31\n\n # Custom headers? Ugh, impossible to tell\n space += 512\n\n # The final estimated size\n space\n end",
"title": ""
},
{
"docid": "fe6923b6842884a44c2dc0c1d62c71a1",
"score": "0.56130385",
"text": "def data_len_bytes()\n 2\n end",
"title": ""
},
{
"docid": "8224eb102f5d8cbd1013483b2b7b64b2",
"score": "0.56118524",
"text": "def minimum_size=(value)\n @minimum_size = value\n end",
"title": ""
},
{
"docid": "2d8d73c6b173703f0d8ef0e875474c33",
"score": "0.5611332",
"text": "def minsize(value)\n merge(apminsize: value.to_s)\n end",
"title": ""
},
{
"docid": "ae8141ed244847d809675ad3da07e6d8",
"score": "0.5610683",
"text": "def test_server_packet_read\n\t\tpkt = \"0015d0420001000f1219000611490000000511a4000050d0520002004a2201000611490000000c112ee2d8d3f0f8f0f2f4000d002fd8e3c4e2d8d3e7f8f6000a00350006119c033300062103022e00172135c3f0c1f8f6c1f0f14bc5c6f1f2070402195612008cd0030002008624080000000000303030303053514c303830323400ffffffff0200000000000000030000000000000000000000202020202020202020202000124d59444232444220202020202020202020200000003331ff383139ff4d59555345522020ff4d594442324442ff514442322f4c494e5558ff353538ff353538ff30ff31323038ff30ffff\".scan(/../).map {|x| x.to_i(16).chr}.join\n\t\ts = Klass::SERVER_PACKET.new\n\t\tassert_equal 0, s.size\n\t\ts.read(pkt)\n\t\tassert_equal 3, s.size\n\t\tassert_equal Konst::SECCHKRM, s[0].codepoint\n\t\tassert_equal Konst::ACCRDBRM, s[1].codepoint\n\t\tassert_equal Konst::SQLCARD, s[2].codepoint\n\t\tassert_equal 0xd0, s[0].magic \n\t\tassert_equal 0x52, s[1].format\n\t\tassert_equal 134, s[2].length2\n\t\tassert_equal 21+80+140, s.sz\n\tend",
"title": ""
},
{
"docid": "29b63d515c5d870e8b4a4ace9f7cedbf",
"score": "0.5609261",
"text": "def read_size; end",
"title": ""
},
{
"docid": "057fe7f58d11e20c9a82ed9af9488e3d",
"score": "0.5606971",
"text": "def required_space\n # Start with our cached default generated size\n space = cached_size\n\n # Add 100 bytes for the encoder to have some room\n space += 100\n\n # Make room for the maximum possible URL length\n space += 256\n\n # EXITFUNK processing adds 31 bytes at most (for ExitThread, only ~16 for others)\n space += 31\n\n # Proxy options?\n space += 200\n\n # Custom headers? Ugh, impossible to tell\n space += 512\n\n # The final estimated size\n space\n end",
"title": ""
},
{
"docid": "057fe7f58d11e20c9a82ed9af9488e3d",
"score": "0.5606971",
"text": "def required_space\n # Start with our cached default generated size\n space = cached_size\n\n # Add 100 bytes for the encoder to have some room\n space += 100\n\n # Make room for the maximum possible URL length\n space += 256\n\n # EXITFUNK processing adds 31 bytes at most (for ExitThread, only ~16 for others)\n space += 31\n\n # Proxy options?\n space += 200\n\n # Custom headers? Ugh, impossible to tell\n space += 512\n\n # The final estimated size\n space\n end",
"title": ""
},
{
"docid": "914426a68a492dea2ad077c778f41b1b",
"score": "0.56057584",
"text": "def minsize(value)\n merge(aiminsize: value.to_s)\n end",
"title": ""
},
{
"docid": "f47b520856eb44746724f4e90196b5c3",
"score": "0.5605141",
"text": "def set_drop_policy_average_packet_size(opts)\n opts = check_params(opts,[:drop_policies,:mtus])\n super(opts)\n end",
"title": ""
},
{
"docid": "1a026e3cf042af2e63a69730cda64700",
"score": "0.5599924",
"text": "def size\n to_payload.bytesize\n end",
"title": ""
},
{
"docid": "1a026e3cf042af2e63a69730cda64700",
"score": "0.5599924",
"text": "def size\n to_payload.bytesize\n end",
"title": ""
}
] |
4f690f11f7d2c0ac6fcfbd64d47e2d85
|
make sure that persona is capitalized
|
[
{
"docid": "eee180b7f385a91622e42fc2358dd44a",
"score": "0.0",
"text": "def persona=(s)\n\t\twrite_attribute(:persona, s.to_s.capitalize)\n\tend",
"title": ""
}
] |
[
{
"docid": "6426bf8102e999ab3307ee06976e739a",
"score": "0.7825145",
"text": "def name_must_be_titleized\n # Make sure first char is uppercase\n first_char = name[0]\n first_char_is_not_upcased = (first_char != first_char.upcase)\n # If first character is not uppercase, add an error\n if first_char_is_not_upcased\n errors.add(:name, 'must be capitalized.')\n end#if\n end",
"title": ""
},
{
"docid": "13aa05250309137a3e6024f342c3b933",
"score": "0.778903",
"text": "def capitalize!\n end",
"title": ""
},
{
"docid": "34c6bdeb18f3f3f481d86a170619527f",
"score": "0.7766501",
"text": "def name_upcaser(input)\n\tinput.capitalize!\nend",
"title": ""
},
{
"docid": "a89fa3abfdd058b861287e7d3fc29251",
"score": "0.77507883",
"text": "def fix_capitalization word\n\n end",
"title": ""
},
{
"docid": "b48ee44fc8802a78a3010d4a00edefab",
"score": "0.7575696",
"text": "def name_in_caps\n name.upcase\n end",
"title": ""
},
{
"docid": "dadd4b494b07fe289298a100eef3eabe",
"score": "0.7533602",
"text": "def capitalize\n end",
"title": ""
},
{
"docid": "474acd684e1965034e54048d5956d0ad",
"score": "0.75109464",
"text": "def force_uppercase\n\t\tself.last_name.upcase!\n\t\tself.first_name.upcase!\n\t\tself.address1.upcase!\n\t\tself.address2.upcase!\n\tend",
"title": ""
},
{
"docid": "5fb7ca34ca76634d9e8fed3f5903b270",
"score": "0.7484504",
"text": "def capitalize!\n end",
"title": ""
},
{
"docid": "df7a102680c65a19cf5a68ac62b9a256",
"score": "0.74439496",
"text": "def uppercase_name\n\t self.name = name.split.map(&:capitalize).join(' ')\n\t end",
"title": ""
},
{
"docid": "7fe822255a46da555369bbd5618ac6ee",
"score": "0.7422757",
"text": "def uppercase_name\n self.name.upcase! if self.name\n end",
"title": ""
},
{
"docid": "8d3c825d9e3f95b4a39527d535356adb",
"score": "0.7397273",
"text": "def is_title_case\n if self.name != self.name.titlecase\n self.errors.add(:name, \"must be titlecase\")\n end\n end",
"title": ""
},
{
"docid": "1d673ab299b874bb7dbdf57147bf7657",
"score": "0.73780483",
"text": "def capitalized_name(name)\n\n\t\tname.capitalize\n\tend",
"title": ""
},
{
"docid": "3cc982287ffb0dd6ff950b70ec3ea027",
"score": "0.7363571",
"text": "def capitalize\n self.name = self.name.titleize()\n self.country_of_origin = self.country_of_origin.titleize()\n end",
"title": ""
},
{
"docid": "e56fa2999e6cc2776eb23187ffaa4dd0",
"score": "0.7361853",
"text": "def uncapitalize\n (self.length > 0) ? (self[0, 1].downcase + self[1..-1]) : \"\"\n end",
"title": ""
},
{
"docid": "d22abfb791192b6ca417f248218e739a",
"score": "0.73404723",
"text": "def uncapitalize!\n\t\tself.strip!.gsub!(/^[АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯABCDEFGHIJKLMNOPQRSTUVWXYZ]/,UPTODW)\n\t\tself\n\tend",
"title": ""
},
{
"docid": "aaca271a7038d0739fce3a95a0cb81c2",
"score": "0.7295136",
"text": "def namecase\n self.slice(0,1).upcase + self.slice(1..-1)\n end",
"title": ""
},
{
"docid": "7e142ffa97f20bb4d03a00addbd01d62",
"score": "0.7280971",
"text": "def upcase_first; end",
"title": ""
},
{
"docid": "7e142ffa97f20bb4d03a00addbd01d62",
"score": "0.7280971",
"text": "def upcase_first; end",
"title": ""
},
{
"docid": "bb7ed185ea0d69347f5a52912a6e6917",
"score": "0.72702986",
"text": "def words_that_can_be_capitalized_differently_in_title_consistency_validation\n # Override this method in subclasses\n []\n end",
"title": ""
},
{
"docid": "c769c2a6fe326826a10f10e9365a4e2b",
"score": "0.72578704",
"text": "def fake_name(name)\n name = successive_letter(name).join(\"\")\n name = capitalize(name)\nend",
"title": ""
},
{
"docid": "9168ffc7f4d947d64e84cfda1109cd08",
"score": "0.7250964",
"text": "def name_case(full_name)\r\n names = full_name.split(' ')\r\n names.map! {|name| name.capitalize}\r\n names.join(' ')\r\nend",
"title": ""
},
{
"docid": "e0bb5da5f08442e9538847b7c9d106f6",
"score": "0.7250622",
"text": "def capitalize!\n modify = nil\n first = self[0].chr\n if islower first then\n self[0] = toupper first\n modify = self\n end\n\n 1.upto(self.length - 1) do |i|\n cur = self[i].chr\n if isupper cur then\n self[i] = tolower cur\n modify = self\n end\n end\n\n return modify\n end",
"title": ""
},
{
"docid": "1895302ca9ba3517737ae0d6e11f1ded",
"score": "0.7248202",
"text": "def capitalize(person)\n person.name.capitalize\n end",
"title": ""
},
{
"docid": "552f4bd6833997b1e9a4ca3f2d9d2ae7",
"score": "0.7245402",
"text": "def name_upper\n @name_upper_counter += 1\n name.upcase\n end",
"title": ""
},
{
"docid": "c0adf6375cad834bbefc5e4b1b9f663a",
"score": "0.7230747",
"text": "def name_upcase\n name.upcase\n end",
"title": ""
},
{
"docid": "b3ebf7f7dd7d5ecfc07b32b451ecd5b8",
"score": "0.72300345",
"text": "def capit(nomen)\n # if there are multiple names separated by a dash\n fix = nomen.to_s.dup.split('-').map do |outer|\n outer.split(' ').map(&:capitalize).join ' '\n end.join '-'\n\n # anything begining with Mac and not ending in [aciozj], except for a few\n fix.sub!(/Mac(?!\n hin|hlen|\n har|\n kle|\n klin|\n kie|\n hado| # Portugese\n evicius| # Lithuanian\n iulis| # Lithuanian\n ias # Lithuanian\n )([\\p{Alpha}]{2,}[^aAcCiIoOzZjJ])\\b/x) { \"Mac#{$1.capitalize}\" }\n\n fix.sub!(/\\bMacmurdo\\b/, 'MacMurdo') # fix MacMurdo\n\n # anything beginning with Mc, Mcdonald == McDonald\n fix.sub!(/Mc(\\p{Alpha}{2,})/) { |s| \"Mc#{s[2..-1].capitalize}\" }\n\n # names like D'Angelo or Van 't Hooft, no cap 't\n fix.gsub!(/('\\p{Alpha})(?=\\p{Alpha})/) { |s| \"'#{s[(1..-1)].capitalize}\" }\n\n fix\n end",
"title": ""
},
{
"docid": "83d3fb10e6026dc33d98e5f45dcca23f",
"score": "0.72183675",
"text": "def capitalize_data\n self.first_name = self.first_name.downcase.titleize\n self.last_name = self.last_name.downcase.titleize\n end",
"title": ""
},
{
"docid": "fd23de22483e011ada99320d9013e435",
"score": "0.72064835",
"text": "def is_upper?(c)\n return c == c.capitalize\n end",
"title": ""
},
{
"docid": "30c947d0242defbb352e572c033fcfcc",
"score": "0.72030884",
"text": "def downcase_it_all\n self.email.downcase! if self.email\n self.first_name.downcase! if self.first_name\n self.last_name.downcase! if self.last_name\n end",
"title": ""
},
{
"docid": "b8c50fb148054272fd8f52ac65af1651",
"score": "0.7200823",
"text": "def capitalize_field(str); end",
"title": ""
},
{
"docid": "dc8484e3cf5f61431c8b1a2c3d2d75c0",
"score": "0.7197434",
"text": "def downcase_input!\n name.downcase!\n end",
"title": ""
},
{
"docid": "bd04ee6500520af85ef8aabdab9bdd6b",
"score": "0.7192407",
"text": "def capitalize_names\n self.first_name = first_name.camelcase\n self.last_name = last_name.camelcase\n end",
"title": ""
},
{
"docid": "745018a0f99221574f033365bda4bbef",
"score": "0.71830904",
"text": "def capitalize_names\n first_name.capitalize!\n last_name.capitalize!\n end",
"title": ""
},
{
"docid": "15d57912d34a08cb733ac999d5f6ac65",
"score": "0.7179879",
"text": "def uppercase_name\n\t self.name = name.split.map(&:capitalize).join(' ')\n\t self.location = location.split.map(&:capitalize).join(' ')\n\t end",
"title": ""
},
{
"docid": "171024a2b36ca0213e9cda07aea00549",
"score": "0.7170739",
"text": "def fix_case_up(name)\n return name[0, 1].upcase + name[1..-1]\n end",
"title": ""
},
{
"docid": "fdaa54e4e864a49175223faa272a53c8",
"score": "0.71608233",
"text": "def name_must_be_titleized\n first_char = name[0]\n first_char_is_not_upcased = (first_char != first_char.upcase)\n errors.add(:name, 'is not a proper title') if first_char_is_not_upcased\n\n end",
"title": ""
},
{
"docid": "38f9b68ee4c4613e3bab0f63aae2df6b",
"score": "0.71501815",
"text": "def startcase\n self.gsub(/(?<![a-z'])([a-z]+)/i, &:capitalize)\n end",
"title": ""
},
{
"docid": "911729e8b3686b26babc9c30efa5a1cd",
"score": "0.7143522",
"text": "def is_capitalized?(word)\r\n if word.strip[0] =~ /[A-Z]/\r\n return true\r\n end\r\n return false\r\n end",
"title": ""
},
{
"docid": "1e91a63a5ee4b0493bb725872d9ae6e4",
"score": "0.71408594",
"text": "def uncapitalize\n if self.length > 0\n self[0, 1].downcase + self[1..-1]\n else\n self\n end\n end",
"title": ""
},
{
"docid": "988b58bf1301ab880475439b1fce93a8",
"score": "0.7127797",
"text": "def format_name\n self.first_name.gsub!(/\\b[a-z]/) { |w| w.capitalize } if self.first_name\n self.last_name.gsub!(/\\b[a-z]/) { |w| w.capitalize } if self.last_name\n self.middle_name.gsub!(/\\b[a-z]/) { |w| w.capitalize } if self.middle_name \n self.first_name.strip! if self.first_name\n self.last_name.strip! if self.last_name\n self.middle_name.strip! if self.middle_name\n\n true\n end",
"title": ""
},
{
"docid": "6ca559859be1e55b335c424ff1e66878",
"score": "0.71181655",
"text": "def cap\n self.nom=self.nom.upcase\n self.prenom=self.prenom.capitalize\n self.prenom2=self.prenom2.capitalize\n end",
"title": ""
},
{
"docid": "fc862ec0a353f14550c786b25297210c",
"score": "0.71046144",
"text": "def unicode_capitalize!()\n self.replace( self.unicode_capitalize() )\n end",
"title": ""
},
{
"docid": "3b14a17d30a48afce763872201ea495e",
"score": "0.7101947",
"text": "def capitalize_name\n self.name = self.name.downcase.split.collect(&:capitalize).join(' ') if self.name && !self.name.blank?\n end",
"title": ""
},
{
"docid": "c8fa6af88a8ad6ae43efe48aebc9a73c",
"score": "0.7095627",
"text": "def upcase! \n end",
"title": ""
},
{
"docid": "0e6366fc03d9d477a00c16a6858b5b31",
"score": "0.7092601",
"text": "def is_lower?(c)\n return c != c.capitalize\n end",
"title": ""
},
{
"docid": "dffb5520036e03f2eff47d90a21bbd81",
"score": "0.7090617",
"text": "def caseify(word)\n if word =~ /[A-Z]/\n word.downcase!\n word.capitalize!\n end\n word\nend",
"title": ""
},
{
"docid": "d905f588dab482b3cd86cb732d77b6d7",
"score": "0.70833343",
"text": "def is_capitalized(word)\n\n# \tword[0] the chr at first index\n# \tword[1..-1] the chr's in the rest index\n\tif word[0] == word[0].upcase && word[1..-1] == word[1..-1].downcase\n \treturn true\n \telse\n \treturn false\n \tend\nend",
"title": ""
},
{
"docid": "079eaa22e38c1d69818c2142c1fc60d7",
"score": "0.70831835",
"text": "def name_capitalize(match_predection_params)\n match_predection_params['name'].capitalize!\n end",
"title": ""
},
{
"docid": "d3cccf044737a7acc6ba0ba14877a956",
"score": "0.70813394",
"text": "def normalize_name(name)\n name.downcase\n end",
"title": ""
},
{
"docid": "d1ad2b699ad99a497fdbf57650414e05",
"score": "0.70749974",
"text": "def downcase_stuff\n email.downcase! if email\n username.downcase! if username\n end",
"title": ""
},
{
"docid": "ab529eb43b54db9a41f43e163f876e83",
"score": "0.70636904",
"text": "def is_proper(name)\n return name == (name[0].upcase + name[1..-1].downcase)\nend",
"title": ""
},
{
"docid": "41ca501104d983aee49ff1dffa17783b",
"score": "0.7063247",
"text": "def cap_name \n self.first_name = first_name.capitalize if attribute_present?(\"first_name\")\n self.last_name = last_name.capitalize if attribute_present?(\"last_name\")\n end",
"title": ""
},
{
"docid": "a8aeff2c84b8a4d789a9edad4257ab4e",
"score": "0.7060384",
"text": "def name_capitalize\n \tname.slice(0,1).capitalize + name.slice(1..-1)\n end",
"title": ""
},
{
"docid": "3f05606b9d1093cd3bd2da36251ccb26",
"score": "0.7055191",
"text": "def capital\n round capital_real\n end",
"title": ""
},
{
"docid": "00f98f1a72101039324d877c2c2b2bb9",
"score": "0.7049834",
"text": "def capitalized?(word)\n word == word.capitalize\nend",
"title": ""
},
{
"docid": "00f98f1a72101039324d877c2c2b2bb9",
"score": "0.7049834",
"text": "def capitalized?(word)\n word == word.capitalize\nend",
"title": ""
},
{
"docid": "00f98f1a72101039324d877c2c2b2bb9",
"score": "0.7049834",
"text": "def capitalized?(word)\n word == word.capitalize\nend",
"title": ""
},
{
"docid": "24d510cf2c3d8f55193e6c66984c6ce9",
"score": "0.7044758",
"text": "def unicode_capitalize()\n self[0].unicode_upcase() + self[1..self.length].unicode_downcase()\n end",
"title": ""
},
{
"docid": "f4f13ae43d4dbbace05c1f86b0b9672e",
"score": "0.70311403",
"text": "def downcase_name\n name.downcase!\n end",
"title": ""
},
{
"docid": "9499521a531a659e9e856a972cc86127",
"score": "0.7027048",
"text": "def titlecase_title\n self.name=(name().titlecase())\n end",
"title": ""
},
{
"docid": "56a280320ed6138680a50b6101751755",
"score": "0.7025705",
"text": "def cap(name) \n name.split(' ').each {|name| name.capitalize!}.join(' ') \nend",
"title": ""
},
{
"docid": "dd0503657a212df4af9db5be402da8c4",
"score": "0.7024974",
"text": "def name_upcase\n self.name.mb_chars.upcase\n end",
"title": ""
},
{
"docid": "807a543d632af935e6739f9434a6831d",
"score": "0.7022136",
"text": "def upcase!\n end",
"title": ""
},
{
"docid": "b0fb6485b4032761e3f931c322f19aa1",
"score": "0.70200014",
"text": "def capitalize_name\n self.name = self.name.split.map(&:capitalize).join(' ')\n end",
"title": ""
},
{
"docid": "fa9a1e0b90707ff4a7f3c3fdf770f3f0",
"score": "0.7015124",
"text": "def capitalise_first_word\n @title = @title.slice(0,1).upcase + @title.slice(1..-1)\n end",
"title": ""
},
{
"docid": "b4a266cb11fd2181a6f93e20c334f017",
"score": "0.70008886",
"text": "def capitalized?(word)\n word.match(/^[A-Z]/) ? true : false\n end",
"title": ""
},
{
"docid": "b800ad29ee88e92226534aa0f90aa178",
"score": "0.69941765",
"text": "def cap\n self.nom=self.nom.upcase\n self.prenom=self.prenom.capitalize\n end",
"title": ""
},
{
"docid": "5c671227ca0f1d93d38c250cd54689d5",
"score": "0.69892037",
"text": "def downcase_name\n self.name.downcase!\n end",
"title": ""
},
{
"docid": "8412175d538b56c7323149a84757134a",
"score": "0.69882494",
"text": "def titlecase!\n replace(titlecase)\n end",
"title": ""
},
{
"docid": "1e8f157cab29a547c75b80a40b1fb25b",
"score": "0.69789517",
"text": "def fake_name(full_name)\n\ti = 0\t\n\tname = full_name.downcase.split(\" \")\n\treversed_name = name.reverse.join(\" \")\n\tnew_name = \"\"\n\t\n\tuntil i == reversed_name.length\n\t\tletter = reversed_name[i]\n\t\tif letter == \" \"\n\t\t\tnew_name += \" \"\n\t\telsif letter == \"a\"\n\t\t\tnew_name += \"e\"\n\t\telsif letter == \"e\"\n\t\t\tnew_name += \"i\"\n\t\telsif letter == \"i\"\n\t\t\tnew_name += \"o\"\n\t\telsif letter == \"o\"\n\t\t\tnew_name += \"u\"\n\t\telsif letter == \"u\"\n\t\t\tnew_name += \"a\"\n\t\telsif letter == \"z\"\n\t\t\tnew_name += \"b\"\n\t\telsif letter == \"d\"\n\t\t\tnew_name += \"f\"\n\t\telsif letter == \"h\"\n\t\t\tnew_name += \"j\"\n\t\telsif letter == \"n\"\n\t\t\tnew_name += \"p\"\n\t\telsif letter == \"t\"\n\t\t\tnew_name += \"v\"\n\t\telse\n\t\t \tnew_name += letter.next\n\t\tend\n\t\tnew_name\n\t\ti+=1\n\tend\n\t\n\tcapitalized = new_name.split(\" \")\n\tcapitalized_name = []\n\tcapitalized.each do |name|\n\t\tcapitalized_name << name.capitalize\n\tend\n\tcodename = capitalized_name.join(\" \")\nend",
"title": ""
},
{
"docid": "e233330165cb8b25b2821447f5a092d5",
"score": "0.69783235",
"text": "def downcase!\n end",
"title": ""
},
{
"docid": "d7c9f6fa27452db210e3bfdaa1efae91",
"score": "0.6974855",
"text": "def titleize_name(character)\n names_array = character.split(\" \")\n names_array.collect { |name| name[0] = name[0].upcase}\n capital_name = names_array.join(\" \")\n if capital_name.include?(\"-\")\n capital_name.gsub(/-[a-z]/) {|letter| letter.upcase}\n else\n capital_name\n end\n # binding.pry\nend",
"title": ""
},
{
"docid": "b77089dafd0ab4af6d6dacfe60440570",
"score": "0.6970144",
"text": "def pascalcase\n downcase.scan(/[a-z0-9]+/).map { |x| x.capitalize }.join\n end",
"title": ""
},
{
"docid": "299353994bbe47508e558d9b55ed3150",
"score": "0.69650733",
"text": "def capitalize_name\n name.capitalize\n end",
"title": ""
},
{
"docid": "014ee5c3b6b33f80ab9a11a5666c000a",
"score": "0.6955741",
"text": "def titlecase(input)\n input.titlecase\n end",
"title": ""
},
{
"docid": "e7c73dcdf236d91791a71c0867a9a294",
"score": "0.69554615",
"text": "def downcase! \n end",
"title": ""
},
{
"docid": "84b9592f18085a26fcb6d1b890f0720b",
"score": "0.69513345",
"text": "def make_caps(string)\n string.upcase\nend",
"title": ""
},
{
"docid": "f7a4a72529cfa929922ce21de48e9159",
"score": "0.6948339",
"text": "def downcase_input!\n name.downcase!\n room.downcase!\n category.downcase!\n end",
"title": ""
},
{
"docid": "70c6dff30da8f13054a5b08a118efc34",
"score": "0.69459826",
"text": "def titleize(up)\n\n sw = %w[and in the of a an]\n\n up.capitalize.gsub( /\\S+/ ) { |w| sw.include?(w) ? w : w.capitalize }\nend",
"title": ""
},
{
"docid": "95869eb772c93f9cc233be21eb79025a",
"score": "0.69402075",
"text": "def capitalized?\n self.match(/^[[:upper:]]/) ? true : false\n end",
"title": ""
},
{
"docid": "6610d4e1e04265c9007042e2d4a59940",
"score": "0.6939545",
"text": "def proper\n split.map(&:capitalize).join(' ')\n end",
"title": ""
},
{
"docid": "e5458e21df8ff1e314ff88adbe7a5525",
"score": "0.6938327",
"text": "def all_caps(word)\n return word.upcase\nend",
"title": ""
},
{
"docid": "0df753bf3de969ff1301495e33c9f9bc",
"score": "0.6932212",
"text": "def clean_full_name(first_name, last_name)\n puts \"#{first_name.downcase.capitalize}#{last_name.downcase.capitalize}\"\nend",
"title": ""
},
{
"docid": "6b7efab01409cdf7255396de2b6ca51e",
"score": "0.69257367",
"text": "def filter_capitalize(value)\n value.capitalize\n end",
"title": ""
},
{
"docid": "13794a5f853d0445388320bef4e85d3e",
"score": "0.6915291",
"text": "def entitle\n little_words = %w[a an the at for up and but\n or nor in on under of from as by to]\n preserve_acronyms = !all_upper?\n newwords = []\n capitalize_next = false\n words = split(/\\s+/)\n last_k = words.size - 1\n words.each_with_index do |w, k|\n first = k.zero?\n last = (k == last_k)\n if w =~ %r{c/o}i\n # Care of\n newwords.push('c/o')\n elsif w =~ /^p\\.?o\\.?$/i\n # Post office\n newwords.push('P.O.')\n elsif w =~ /^[0-9]+(st|nd|rd|th)$/i\n # Ordinals\n newwords.push(w.downcase)\n elsif w =~ /^(cr|dr|st|rd|ave|pk|cir)$/i\n # Common abbrs to capitalize\n newwords.push(w.capitalize)\n elsif w =~ /^(us|ne|se|rr)$/i\n # Common 2-letter abbrs to upcase\n newwords.push(w.upcase)\n elsif w =~ /^[0-9].*$/i\n # Other runs starting with numbers,\n # like 3-A\n newwords.push(w.upcase)\n elsif w =~ /^(N|S|E|W|NE|NW|SE|SW)$/i\n # Compass directions all caps\n newwords.push(w.upcase)\n elsif w =~ /^[^aeiouy]*$/i && w.size > 2\n # All consonants and at least 3 chars, probably abbr\n newwords.push(w.upcase)\n elsif w =~ /^[A-Z0-9]+\\z/ && preserve_acronyms\n # All uppercase and numbers, keep as is\n newwords.push(w)\n elsif w =~ /^(\\w+)-(\\w+)$/i\n # Hyphenated double word\n newwords.push($1.capitalize + '-' + $2.capitalize)\n elsif capitalize_next\n # Last word ended with a ':'\n newwords.push(w.capitalize)\n capitalize_next = false\n elsif little_words.include?(w.downcase)\n # Only capitalize at beginning or end\n newwords.push(first || last ? w.capitalize : w.downcase)\n else\n # All else\n newwords.push(w.capitalize)\n end\n # Capitalize following a ':'\n capitalize_next = true if newwords.last =~ /:\\s*\\z/\n end\n newwords.join(' ')\n end",
"title": ""
},
{
"docid": "fa567b0aa00f51d5ece90cef00b5af63",
"score": "0.69137174",
"text": "def normalize_name\n hyphens_to_spaces = name.tr('-', ' ')\n capitalised = hyphens_to_spaces.split.map(&:capitalize).join(' ')\n self.name = capitalised.delete(\"'\")\n end",
"title": ""
},
{
"docid": "b0f5a14fdf331d48072da0de45300118",
"score": "0.69131696",
"text": "def fake_agent_name(name)\n word = name.downcase\n fake_name = next_consonant(next_vowel(swap_name(word)))\n fake_name.split.map(&:capitalize).join(' ')\nend",
"title": ""
},
{
"docid": "6b75633825c8d3636576042b6ab44e52",
"score": "0.6908708",
"text": "def capitalize(name)\n name\n end",
"title": ""
},
{
"docid": "585a145b5de998cec40afe6f822101d4",
"score": "0.6904634",
"text": "def name_upcase\n self.name.capitalize\n end",
"title": ""
},
{
"docid": "d82e2e3d393f6798ff867f2db2906af2",
"score": "0.6902057",
"text": "def lowercase ; downcase ; end",
"title": ""
},
{
"docid": "1f41f562b79882053ad23ce00112986e",
"score": "0.6899106",
"text": "def testing(phrase)\n puts phrase.downcase.capitalize\nend",
"title": ""
},
{
"docid": "4cab61d8730f0b2fba254e1a74583a23",
"score": "0.68935734",
"text": "def input_lowercase\n self.email.downcase!\n self.name.downcase!\n # the built in method for lowercasing something is .downcase!\n end",
"title": ""
},
{
"docid": "bdf5ed16a09892b19cb49af1c9ff4fe9",
"score": "0.6890382",
"text": "def capitalize\n self[0].upcase + self[1..-1]\n end",
"title": ""
},
{
"docid": "dbfdac509cc0e332e2ed866f45fba3fc",
"score": "0.6883621",
"text": "def upperCase\r\n self.Per_Apellido_Materno= self.Per_Apellido_Materno.upcase\r\n self.Per_Apellido_Paterno= self.Per_Apellido_Paterno.upcase\r\n self.Per_Nombres= self.Per_Nombres.upcase\r\n end",
"title": ""
},
{
"docid": "15d5e43c45f29c5d9bed9c4db129bab8",
"score": "0.6880921",
"text": "def humanize\n name.capitalize + ' ' + surname.capitalize\n end",
"title": ""
},
{
"docid": "99093341b3e91036f9e8ea60de1b5e6c",
"score": "0.6876661",
"text": "def upcase(string); end",
"title": ""
},
{
"docid": "4f580f2fc85f98fda0ce9973c028128e",
"score": "0.68701",
"text": "def lower_fields\n\t\tself.email.downcase!\n\t\tself.name.downcase!\n\tend",
"title": ""
},
{
"docid": "cdd3eed3ca85f70ea07f33bedfc9f39c",
"score": "0.6868385",
"text": "def lower_under_ize(name)\n \tname.gsub(/([a-z])([A-Z])/, '\\1_\\2').gsub(' ', '_').gsub(',', '').downcase\n end",
"title": ""
},
{
"docid": "268d7873c3aba76d9e06d3ffb4f8581e",
"score": "0.6867794",
"text": "def humanize(lower_case_and_underscored_word, capitalize: T.unsafe(nil), keep_id_suffix: T.unsafe(nil)); end",
"title": ""
},
{
"docid": "268d7873c3aba76d9e06d3ffb4f8581e",
"score": "0.6867794",
"text": "def humanize(lower_case_and_underscored_word, capitalize: T.unsafe(nil), keep_id_suffix: T.unsafe(nil)); end",
"title": ""
},
{
"docid": "268d7873c3aba76d9e06d3ffb4f8581e",
"score": "0.6867794",
"text": "def humanize(lower_case_and_underscored_word, capitalize: T.unsafe(nil), keep_id_suffix: T.unsafe(nil)); end",
"title": ""
}
] |
c657de4b70d266e9a3a784b999ea9e60
|
Never trust parameters from the scary internet, only allow the white list through.
|
[
{
"docid": "e716037c0d330470bf928c09c205b75d",
"score": "0.0",
"text": "def batch_params\n params.require(:batch).permit(:item_id, :name, :comment, :in_price, :distributor_price, :retail_price, :expire_at, :refined_at)\n end",
"title": ""
}
] |
[
{
"docid": "3663f9efd3f3bbf73f4830949ab0522b",
"score": "0.7495027",
"text": "def whitelisted_params\n super\n end",
"title": ""
},
{
"docid": "13a61145b00345517e33319a34f7d385",
"score": "0.69566035",
"text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "c72da3a0192ce226285be9c2a583d24a",
"score": "0.69225836",
"text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "3d346c1d1b79565bee6df41a22a6f28d",
"score": "0.68929327",
"text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "aa06a193f057b6be7c0713a5bd30d5fb",
"score": "0.67848456",
"text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "f6060519cb0c56a439976f0c978690db",
"score": "0.674347",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "fad8fcf4e70bf3589fbcbd40db4df5e2",
"score": "0.6682223",
"text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end",
"title": ""
},
{
"docid": "b453d9a67af21a3c28a62e1848094a41",
"score": "0.6636527",
"text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "2c8e2be272a55477bfc4c0dfc6baa7a7",
"score": "0.66291976",
"text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "1685d76d665d2c26af736aa987ac8b51",
"score": "0.66258276",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f",
"score": "0.65625846",
"text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"title": ""
},
{
"docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18",
"score": "0.6491194",
"text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e291b3969196368dd4f7080a354ebb08",
"score": "0.6477825",
"text": "def permitir_parametros\n \t\tparams.permit!\n \tend",
"title": ""
},
{
"docid": "2d2af8e22689ac0c0408bf4cb340d8c8",
"score": "0.64526874",
"text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end",
"title": ""
},
{
"docid": "236e1766ee20eef4883ed724b83e4176",
"score": "0.64001405",
"text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"title": ""
},
{
"docid": "b29cf4bc4a27d4b199de5b6034f9f8a0",
"score": "0.63810205",
"text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end",
"title": ""
},
{
"docid": "bfb292096090145a067e31d8fef10853",
"score": "0.63634825",
"text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "6bf3ed161b62498559a064aea569250a",
"score": "0.633783",
"text": "def require_params\n return nil\n end",
"title": ""
},
{
"docid": "b4c9587164188c64f14b71403f80ca7c",
"score": "0.6336759",
"text": "def sanitize_params!\n request.sanitize_params!\n end",
"title": ""
},
{
"docid": "b63e6e97815a8745ab85cd8f7dd5b4fb",
"score": "0.6325718",
"text": "def excluded_from_filter_parameters; end",
"title": ""
},
{
"docid": "38bec0546a7e4cbf4c337edbee67d769",
"score": "0.631947",
"text": "def user_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password)\n end",
"title": ""
},
{
"docid": "37d1c971f6495de3cdd63a3ef049674e",
"score": "0.63146484",
"text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "5ec018b4a193bf3bf8902c9419279607",
"score": "0.63137317",
"text": "def user_params # contains strong parameters\n params.require(:user).permit(:name, :email, :password,\n :password_confirmation)\n # strong parameters disallows any post information that is not permitted (admin security) when signing_up\n # so not all users will get admin access by hacking params using curl\n end",
"title": ""
},
{
"docid": "91bfe6d464d263aa01e776f24583d1d9",
"score": "0.6306224",
"text": "def permitir_parametros\n params.permit!\n end",
"title": ""
},
{
"docid": "e012d7306b402a37012f98bfd4ffdb10",
"score": "0.6301168",
"text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "157e773497f78353899720ad034a906a",
"score": "0.63000035",
"text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end",
"title": ""
},
{
"docid": "8c384af787342792f0efc7911c3b2469",
"score": "0.629581",
"text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end",
"title": ""
},
{
"docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c",
"score": "0.62926817",
"text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end",
"title": ""
},
{
"docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c",
"score": "0.62926817",
"text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end",
"title": ""
},
{
"docid": "9b76b3149ac8b2743f041d1af6b768b5",
"score": "0.6280713",
"text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end",
"title": ""
},
{
"docid": "603f4a45e5efa778afca5372ae8a96dc",
"score": "0.6271388",
"text": "def param_whitelist\n [:role]\n end",
"title": ""
},
{
"docid": "f6399952b4623e5a23ce75ef1bf2af5a",
"score": "0.6266194",
"text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend",
"title": ""
},
{
"docid": "37c5d0a9ebc5049d7333af81696608a0",
"score": "0.6256044",
"text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend",
"title": ""
},
{
"docid": "505e334c1850c398069b6fb3948ce481",
"score": "0.62550515",
"text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end",
"title": ""
},
{
"docid": "6c4620f5d8fd3fe3641e0474aa7014b2",
"score": "0.62525266",
"text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end",
"title": ""
},
{
"docid": "d14bb69d2a7d0f302032a22bb9373a16",
"score": "0.6234781",
"text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend",
"title": ""
},
{
"docid": "5629f00db37bf403d0c58b524d4c3c37",
"score": "0.62278074",
"text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "d370098b1b3289dbd04bf1c073f2645b",
"score": "0.6226693",
"text": "def allow_params\n params.permit(:id, :email, :password)\n end",
"title": ""
},
{
"docid": "fde8b208c08c509fe9f617229dfa1a68",
"score": "0.6226605",
"text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "78cbf68c3936c666f1edf5f65e422b6f",
"score": "0.6226114",
"text": "def whitelisted_user_params\n if params[:user]\n params.require(:user).permit(:email, :username, :password)\n else\n { :email => params[:email],\n :username => params[:username],\n :password => params[:password] }\n end\nend",
"title": ""
},
{
"docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5",
"score": "0.6200643",
"text": "def roaster_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password_digest, :address, :website, :phone, :latitude, :longitutde, :description)\n end",
"title": ""
},
{
"docid": "d724124948bde3f2512c5542b9cdea74",
"score": "0.61913997",
"text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end",
"title": ""
},
{
"docid": "d18a36785daed9387fd6d0042fafcd03",
"score": "0.61835426",
"text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end",
"title": ""
},
{
"docid": "36956168ba2889cff7bf17d9f1db41b8",
"score": "0.6179986",
"text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end",
"title": ""
},
{
"docid": "07bc0e43e1cec1a821fb2598d6489bde",
"score": "0.61630195",
"text": "def accept_no_params\n accept_params {}\n end",
"title": ""
},
{
"docid": "fc4b1364974ea591f32a99898cb0078d",
"score": "0.6160931",
"text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end",
"title": ""
},
{
"docid": "13e3cfbfe510f765b5944667d772f453",
"score": "0.6155551",
"text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end",
"title": ""
},
{
"docid": "84bd386d5b2a0d586dca327046a81a63",
"score": "0.61542404",
"text": "def good_params\n permit_params\n end",
"title": ""
},
{
"docid": "b9432eac2fc04860bb585f9af0d932bc",
"score": "0.61356604",
"text": "def wall_params\n params.permit(:public_view, :guest)\n end",
"title": ""
},
{
"docid": "f2342adbf71ecbb79f87f58ff29c51ba",
"score": "0.61342114",
"text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end",
"title": ""
},
{
"docid": "8fa507ebc4288c14857ace21acf54c26",
"score": "0.61188847",
"text": "def strong_params\n # to dooo\n end",
"title": ""
},
{
"docid": "9292c51af27231dfd9f6478a027d419e",
"score": "0.61140966",
"text": "def domain_params\n params[:domain].permit!\n end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.611406",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.611406",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "a3aee889e493e2b235619affa62f39c3",
"score": "0.61107725",
"text": "def user_params\n params.permit(:full_name, :email, :job, :about, :max_search_distance,\n :website_url, :linkedin_url,\n :behance_url, :github_url, :stackoverflow_url)\n end",
"title": ""
},
{
"docid": "585f461bf01ed1ef8d34fd5295a96dca",
"score": "0.61038506",
"text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "585f461bf01ed1ef8d34fd5295a96dca",
"score": "0.61038506",
"text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.6097247",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.6097247",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "677293afd31e8916c0aee52a787b75d8",
"score": "0.60860336",
"text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end",
"title": ""
},
{
"docid": "e50ea3adc222a8db489f0ed3d1dce35b",
"score": "0.60855556",
"text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end",
"title": ""
},
{
"docid": "b7ab5b72771a4a2eaa77904bb0356a48",
"score": "0.608446",
"text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end",
"title": ""
},
{
"docid": "b2841e384487f587427c4b35498c133f",
"score": "0.6076753",
"text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end",
"title": ""
},
{
"docid": "3f5347ed890eed5ea86b70281803d375",
"score": "0.60742563",
"text": "def user_params\n params.permit!\n end",
"title": ""
},
{
"docid": "0c8779b5d7fc10083824e36bfab170de",
"score": "0.60677326",
"text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end",
"title": ""
},
{
"docid": "7646659415933bf751273d76b1d11b40",
"score": "0.60666215",
"text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end",
"title": ""
},
{
"docid": "fa0608a79e8d27c2a070862e616c8c58",
"score": "0.6065763",
"text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end",
"title": ""
},
{
"docid": "a3dc8b6db1e6584a8305a96ebb06ad21",
"score": "0.60655254",
"text": "def need_params\n end",
"title": ""
},
{
"docid": "4f8205e45790aaf4521cdc5f872c2752",
"score": "0.6064794",
"text": "def search_params\n params.permit(:looking_for, :utf8, :authenticity_token, :min_age,\n :max_age, :sort_by, likes:[])\n end",
"title": ""
},
{
"docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06",
"score": "0.6062697",
"text": "def permitted_params\n params.permit :utf8, :_method, :authenticity_token, :commit, :id,\n :encrypted_text, :key_size\n end",
"title": ""
},
{
"docid": "c436017f4e8bd819f3d933587dfa070a",
"score": "0.60620916",
"text": "def filtered_parameters; end",
"title": ""
},
{
"docid": "d6886c65f0ba5ebad9a2fe5976b70049",
"score": "0.60562736",
"text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end",
"title": ""
},
{
"docid": "96ddf2d48ead6ef7a904c961c284d036",
"score": "0.60491294",
"text": "def user_params\n permit = [\n :email, :password, :password_confirmation,\n :image, :name, :nickname, :oauth_token,\n :oauth_expires_at, :provider, :birthday\n ]\n params.permit(permit)\n end",
"title": ""
},
{
"docid": "f78d6fd9154d00691c34980d7656b3fa",
"score": "0.60490465",
"text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "f78d6fd9154d00691c34980d7656b3fa",
"score": "0.60490465",
"text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "75b7084f97e908d1548a1d23c68a6c4c",
"score": "0.6046521",
"text": "def allowed_params\n params.require(:sea).permit(:name, :temperature, :bio, :mood, :image_url, :favorite_color, :scariest_creature, :has_mermaids)\n end",
"title": ""
},
{
"docid": "080d2fb67f69228501429ad29d14eb29",
"score": "0.6041768",
"text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff",
"score": "0.60346854",
"text": "def parameters\n params.permit(permitted_params)\n end",
"title": ""
},
{
"docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8",
"score": "0.6030552",
"text": "def filter_params\n end",
"title": ""
},
{
"docid": "cf73c42e01765dd1c09630007357379c",
"score": "0.6024842",
"text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end",
"title": ""
},
{
"docid": "793abf19d555fb6aa75265abdbac23a3",
"score": "0.6021606",
"text": "def user_params\n if admin_user?\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter, :active, :admin, :receive_customer_inquiry)\n else\n # Don't allow non-admin users to hack the parameters and give themselves admin security; self created records automatically set to active\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter)\n end\n end",
"title": ""
},
{
"docid": "2e70947f467cb6b1fda5cddcd6dc6304",
"score": "0.6019679",
"text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend",
"title": ""
},
{
"docid": "2a11104d8397f6fb79f9a57f6d6151c7",
"score": "0.6017253",
"text": "def user_params\n sanitize params.require(:user).permit(:username, :password, :password_confirmation, :display_name, :about_me, :avatar, :current_password, :banned, :ban_message)\n end",
"title": ""
},
{
"docid": "a83bc4d11697ba3c866a5eaae3be7e05",
"score": "0.60145336",
"text": "def user_params\n\t params.permit(\n\t :name,\n\t :email,\n\t :password\n\t \t )\n\t end",
"title": ""
},
{
"docid": "2aa7b93e192af3519f13e9c65843a6ed",
"score": "0.60074294",
"text": "def user_params\n params[:user].permit!\n end",
"title": ""
},
{
"docid": "9c8cd7c9e353c522f2b88f2cf815ef4e",
"score": "0.6006753",
"text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6005122",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6005122",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "9736586d5c470252911ec58107dff461",
"score": "0.60048765",
"text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end",
"title": ""
},
{
"docid": "e7cad604922ed7fad31f22b52ecdbd13",
"score": "0.60009843",
"text": "def member_params\n # byebug\n params.require(:member).permit(\n :first_name, \n :last_name, \n :username, \n :email, \n :password, \n :image, \n :family_size, \n :address)\n\n end",
"title": ""
},
{
"docid": "58ad32a310bf4e3c64929a860569b3db",
"score": "0.6000742",
"text": "def user_params\n\t\tparams.require(:user).permit!\n\tend",
"title": ""
},
{
"docid": "58ad32a310bf4e3c64929a860569b3db",
"score": "0.6000742",
"text": "def user_params\n\t\tparams.require(:user).permit!\n\tend",
"title": ""
},
{
"docid": "f70301232281d001a4e52bd9ba4d20f5",
"score": "0.6000161",
"text": "def room_allowed_params\n end",
"title": ""
},
{
"docid": "2e6de53893e405d0fe83b9d18b696bd5",
"score": "0.599852",
"text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.59984183",
"text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.59984183",
"text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end",
"title": ""
},
{
"docid": "a50ca4c82eaf086dcbcc9b485ebd4261",
"score": "0.59947807",
"text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end",
"title": ""
},
{
"docid": "0f53610616212c35950b45fbcf9f5ad4",
"score": "0.5993962",
"text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end",
"title": ""
},
{
"docid": "b545ec7bfd51dc43b982b451a715a538",
"score": "0.5992739",
"text": "def user_params\n params_allowed = %i[email password password_confirmation is_admin]\n params.require(:user).permit(params_allowed)\n end",
"title": ""
},
{
"docid": "0b704016f3538045eb52c45442e7f704",
"score": "0.59911275",
"text": "def admin_params\n filtered_params = params.require(:admin).permit(:display_name, :email, :password, :password_confirmation)\n if filtered_params[:password] == \"\"\n filtered_params.delete(:password)\n filtered_params.delete(:password_confirmation)\n end\n filtered_params\n end",
"title": ""
},
{
"docid": "6af3741c8644ee63d155db59be10a774",
"score": "0.59906775",
"text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end",
"title": ""
}
] |
4cc43cadd24aca96fad6a2b84a4dcbd9
|
Define any customized permissions here.
|
[
{
"docid": "63e04a64c4e1c0b3b13e8b6dfc1d7583",
"score": "0.80175394",
"text": "def custom_permissions\n alias_action :pdf, :show, :manifest, to: :read\n roles.each do |role|\n send \"#{role}_permissions\" if current_user.send \"#{role}?\"\n end\n end",
"title": ""
}
] |
[
{
"docid": "e7fa55c996c89a154f6ff748543f9ee3",
"score": "0.8672363",
"text": "def define_permissions\n end",
"title": ""
},
{
"docid": "9414be29752fb67f99b3187e2c835691",
"score": "0.846895",
"text": "def custom_permissions\n end",
"title": ""
},
{
"docid": "9414be29752fb67f99b3187e2c835691",
"score": "0.846895",
"text": "def custom_permissions\n end",
"title": ""
},
{
"docid": "73e508b62772b93fccb848de453d734f",
"score": "0.8456043",
"text": "def custom_permissions; end",
"title": ""
},
{
"docid": "fdcd363b0dfc2c2492d4cbb30eded23c",
"score": "0.8339471",
"text": "def custom_permissions\n\n end",
"title": ""
},
{
"docid": "66b17658a7a5d28f6d3337fbdfb1292c",
"score": "0.8236553",
"text": "def custom_permissions\n alias_action :pdf, :show, :manifest, to: :read\n admin_permissions if current_user.admin?\n curation_concern_creator_permissions if current_user.curation_concern_creator?\n campus_patron_permissions if current_user.campus_patron?\n end",
"title": ""
},
{
"docid": "b8efa661b0a0f64dd097175b8b856168",
"score": "0.82031506",
"text": "def custom_permissions\n alias_action :show, :manifest, :color_pdf, :pdf, to: :read\n alias_action :edit, :browse_everything_files, to: :modify\n roles.each do |role|\n send \"#{role}_permissions\" if current_user.send \"#{role}?\"\n end\n end",
"title": ""
},
{
"docid": "636ad60ba531547ded93eb76a0886cb7",
"score": "0.8129152",
"text": "def custom_permissions\n alias_action :show, :manifest, to: :read\n alias_action :edit, to: :modify\n # alias_action :color_pdf, :pdf, :edit, to: :modify\n roles.each do |role|\n send \"#{role}_permissions\" if current_user.send \"#{role}?\"\n end\n end",
"title": ""
},
{
"docid": "02827efcddd557e02e0973fbcfddca9e",
"score": "0.78687835",
"text": "def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n can %i[edit update], SolrDocument do |solr_doc|\n (AdminSet.where(title: solr_doc.admin_set).first.edit_users.include?(current_user.username) || current_user.admin?) if solr_doc.admin_set.present? && current_user.present?\n end\n\n can %i[edit update], ActiveFedora::Base do |record|\n (record.admin_set.edit_users.include?(current_user.username) if record.respond_to?(:admin_set)) || current_user.admin?\n end\n end",
"title": ""
},
{
"docid": "0ea2772b5aee3cc45e47b81f0932eba4",
"score": "0.7851879",
"text": "def custom_permissions\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n end\n\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"title": ""
},
{
"docid": "2fe137a5c53bcf962e5589393e7f2742",
"score": "0.78460246",
"text": "def custom_permissions\n return unless admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n can [:destroy], ActiveFedora::Base\n can [:read], Schools::School\n end",
"title": ""
},
{
"docid": "0f651b0d99aeaf33e7ecd36c41db4261",
"score": "0.78228855",
"text": "def custom_permissions\n # Limits deleting objects to a the admin user\n #\n if current_user.admin?\n can [:destroy], ActiveFedora::Base\n end\n\n if current_user.repository_managers?\n can [:destroy], ActiveFedora::Base\n end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n end\n\n if current_user.repository_managers?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n end\n\n end",
"title": ""
},
{
"docid": "18be0ddf3ffa8f5379ae0856ea8288aa",
"score": "0.7815739",
"text": "def custom_permissions\n\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n can :manage, BulkOps::Operation\n can :manage, User\n end\n\n if user_groups.include? \"reviewer\"\n can :read, ContentBlock\n can :read, :admin_dashboard\n \n can :review, :submissions\n\n can :view_admin_show_any, AdminSet\n can :view_admin_show_any, Collection\n can :view_admin_show_any, ::SolrDocument\n\n can [:show, :index, :edit, :update, :delete], BulkOps::Operation\n end\n\n # Limits deleting objects to admin users\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"title": ""
},
{
"docid": "159f4c48dff331e06c5e25e9d779f3d9",
"score": "0.77954704",
"text": "def custom_permissions\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n can :manage, User\n end\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"title": ""
},
{
"docid": "78efeed29bcb69a73b63c7f237512197",
"score": "0.7759223",
"text": "def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"title": ""
},
{
"docid": "78efeed29bcb69a73b63c7f237512197",
"score": "0.7759223",
"text": "def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"title": ""
},
{
"docid": "82400d2d6d2778918e11a70e4ece8736",
"score": "0.7742963",
"text": "def custom_permissions\n if can_review_submissions?\n can [:manage], String do |id|\n approver_for?(admin_set: ActiveFedora::Base.find(id)&.admin_set)\n end\n\n can [:manage], ActiveFedora::Base do |obj|\n approver_for?(admin_set: obj.admin_set)\n end\n end\n return unless admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n can [:destroy], ActiveFedora::Base\n can [:read], Schools::School\n can [:manage], RegistrarFeed\n end",
"title": ""
},
{
"docid": "89cb1849101eaf5614248e8c9b6f3080",
"score": "0.77357423",
"text": "def permissions; end",
"title": ""
},
{
"docid": "f0f1da7d159495eff1d856fb323e19f6",
"score": "0.7717197",
"text": "def custom_permissions\n if current_user.groups.include? :admin.to_s\n can [:discover, :read, :edit], AdministrativeCollection\n can [:discover, :read, :edit], Collection\n can [:discover, :read, :edit], GenericFile\n can [:download], FileContentDatastream\n can [:destroy], ActiveFedora::Base\n end\n end",
"title": ""
},
{
"docid": "0503003fc82636428dde75a19a303d61",
"score": "0.7688794",
"text": "def custom_permissions\n\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n if registered_user?\n can [ :create ], Collection\n can [ :create ], Submission\n end\n\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n end\n\n if current_user.curator?\n can [ :create ], BatchImport\n can [ :create ], Dataset\n end\n\n can [ :assign_register_doi ], Dataset do |ds|\n current_user.curator? &&\n current_user.can?(:edit, ds) &&\n ds.doi_assignable? &&\n ds.doi_required_metadata_present?\n end\n\n can [ :assign_register_doi ], SolrDocument do |doc|\n current_user.curator? &&\n current_user.can?(:edit, doc) &&\n doc.doi_assignable? &&\n doc.doi_required_metadata_present?\n end\n\n end",
"title": ""
},
{
"docid": "fed9c57016857f47eb7ab08ff81d85f0",
"score": "0.7687899",
"text": "def custom_permissions\n can [:read], ApplicationPresenter, &:can_read?\n can [:read], UsersPresenter, &:can_read?\n can [:read], UserPresenter, &:can_read?\n can [:read], RolesPresenter, &:can_read?\n can [:read], RolePresenter, &:can_read?\n\n can %i[index read], Press\n\n # press admin\n grant_press_admin_abilities\n\n grant_platform_admin_abilities\n end",
"title": ""
},
{
"docid": "66065fa6db96079fa4129c2c153b25df",
"score": "0.76628286",
"text": "def custom_permissions\n # our custom action to deliver json to viewer, same permissions as show\n alias_action :viewer_images_info, to: :read\n\n if current_user.admin?\n # Role management\n # don't allow :destroy, :edit, :create\n # - destroy adds a 'delete' button that\n # - could be clicked accidentally\n # - would be very infrequently used (if ever)\n # - implications of edit are unclear for associated actions\n # - create is meaningless without associating actions which happens in code.\n can [:read, :add_user, :remove_user], Role\n can [:manage], ActiveFedora::Base\n # used by views where solr_document stands in for AF object, to avoid\n # retrieving from Fedora.\n can [:manage], SolrDocument\n # Hydra code passes an object id sometimes (as a string) to bypass object\n # retrieval in views. Since admins can do anything, we just allow it.\n can [:manage], String\n end\n end",
"title": ""
},
{
"docid": "5c8502dd9efc948a21c41e3b0f963082",
"score": "0.76361465",
"text": "def custom_permissions\n can [:index, :show], :people_controller\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index], Role\n can [:edit, :create, :destroy], :people_controller\n can [:update], ContentBlock\n end\n\n if current_user.id\n can :show, :unpublished_doi\n end\n\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"title": ""
},
{
"docid": "3c830d32fd35aabf605b83042a974ead",
"score": "0.7616113",
"text": "def custom_permissions\n can %i[file_manager save_structure structure pdf], PagedResource\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy, :pdf], Role\n can :manage, :sidekiq_dashboard\n end\n end",
"title": ""
},
{
"docid": "40fcff520da8f8aa030931b554cf3830",
"score": "0.7602567",
"text": "def permissions\n end",
"title": ""
},
{
"docid": "e6066fbe50ee88991dda0c8f16a1f008",
"score": "0.7600976",
"text": "def custom_permissions\n can [:index, :show, :detail, :read], Batch if current_user&.groups&.include?('rdc_managers')\n return unless admin?\n can [:index, :show, :detail, :read], Batch\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n can [:edit, :destroy], ActiveFedora::Base\n can :edit, String\n end",
"title": ""
},
{
"docid": "4002617bef49c1400588706eaf62d4fb",
"score": "0.7599612",
"text": "def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n return unless current_user.admin?\n\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n\n # Deprecation Warning: As of Curate v3, Zizia and these abilities will be removed.\n can :manage, Zizia::CsvImport\n can :manage, Zizia::CsvImportDetail\n can :manage, :archivesspace\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"title": ""
},
{
"docid": "d1a08d6c90b588877bccf49950ab33cc",
"score": "0.75925255",
"text": "def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n \n \n\t\tif current_user.superuser?\n\t\t\tcan [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role\n\t\tend\n\t\t\n\t\tif current_user.admin? || current_user.superuser? || current_user.contributor?\n\t\t\tcan [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy, :change_member_visibility, :collection_invisible, :collection_visible, :public_index, :public_show, :collection_thumbnail_set], Collection\n\t\t\tcan [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy, :regenerate], GenericFile\n\t\t\tcan [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Institution\n\t#\t\tcannot [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], GenericFile\n\t else\n\t cannot [:create, :add_user, :remove_user, :edit, :update, :destroy, :change_member_visibility, :collection_invisible, :collection_visible, :index, :collection_thumbnail_set], Collection\n\t\t\tcan [:show, :public_index, :public_show], Collection\n\t\t\tcannot [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy, :regenerate], GenericFile\n\t\t\tcannot [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Institution\n\t\tend\n\t\t\n\t\t#cannot :manage, ::Collection unless current_user.superuser?\n end",
"title": ""
},
{
"docid": "aa04cb09824ea80bcebf8aa78be10f9b",
"score": "0.7559684",
"text": "def custom_permissions\n # Limits deleting objects to a the admin user\n can :create, curation_concerns_models if current_user.admin?\n # cannot [:manage], Collection unless current_user.admin? \n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role if current_user.admin?\n # Limits creating new objects to a specific group\n #\n # StudentWork_permission if user_groups.include? 'qualifying_project'\n end",
"title": ""
},
{
"docid": "7e6f0eae62aa1512ff0baaefd55cc744",
"score": "0.75433356",
"text": "def custom_permissions\n can [:index, :read], Press\n can [:read], SubBrand\n\n # press admin\n can :manage, Role, resource_id: @user.admin_roles.pluck(:resource_id), resource_type: 'Press'\n\n # monograph.press is a String (the subdomain of a Press)\n can :create, Monograph do |m|\n @user.admin_presses.map(&:subdomain).include?(m.press)\n end\n\n can :manage, SubBrand do |sb|\n admin_for?(sb.press)\n end\n\n can :update, Press do |p|\n admin_for?(p)\n end\n\n grant_platform_admin_abilities\n end",
"title": ""
},
{
"docid": "316f02c39b7807454bd3d6ee57145aaa",
"score": "0.75238293",
"text": "def my_permission\n super\n end",
"title": ""
},
{
"docid": "14f8bc1f27b165cf2777a67d53ea8736",
"score": "0.747922",
"text": "def custom_permissions\n # Limits deleting objects to a the admin user\n\n if current_user.admin?\n can :manage, :all\n can [:index, :edit, :destory, :create], User\n can :access, :rails_admin\n can :dashboard\n end\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n end",
"title": ""
},
{
"docid": "f044f25358ab029f4d68a8f6a9e3b0fb",
"score": "0.7471762",
"text": "def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n can [:advanced], Image\n can [:dl_powerpoint], Collection\n can [:dl_pdf], Collection\n can [:copy], Collection\n can [:update_work_order], Collection, depositor: current_user.username\n can [:update_subcollection_order], Collection, depositor: current_user.username\n end",
"title": ""
},
{
"docid": "47b8eb4f62bc5d453bc03d42a9df1a73",
"score": "0.7393693",
"text": "def permissions=(value); end",
"title": ""
},
{
"docid": "75cfc3b2181e3d642de252a19d8b06f7",
"score": "0.72283375",
"text": "def permission; end",
"title": ""
},
{
"docid": "6d046ec410e711bf047c424bc97d5c7a",
"score": "0.71827483",
"text": "def custom_permissions # rubocop:disable Metrics/MethodLength\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n # Limits creating new objects to a specific group\n #\n # if user_groups.include? 'special_group'\n # can [:create], ActiveFedora::Base\n # end\n\n cannot [:edit, :update, :delete], Etd\n can [:manage], Etd if user_is_etd_manager\n\n can :show, CollectionExport do |collection_export|\n collection_export.user == current_user.email ||\n (current_user.can? :show, look_for_collection(collection_export))\n end\n\n can :destroy, CollectionExport do |collection_export|\n collection_export.user == current_user.email ||\n (current_user.can? :destroy, look_for_collection(collection_export))\n end\n\n can [:show, :destroy], CollectionExport if current_user.admin?\n can [:create], ClassifyConcern unless current_user.new_record?\n can [:create, :destroy], FeaturedCollection if current_user.admin?\n can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role if current_user.admin?\n can [:manage], Etd if current_user.admin?\n end",
"title": ""
},
{
"docid": "70993edbde1c49aa7305b412234212b0",
"score": "0.7120786",
"text": "def setable_permissions\n setable_permissions = Redmine::AccessControl.permissions - Redmine::AccessControl.public_permissions\n setable_permissions -= Redmine::AccessControl.members_only_permissions if self.builtin == BUILTIN_NON_MEMBER\n setable_permissions -= Redmine::AccessControl.loggedin_only_permissions if self.builtin == BUILTIN_ANONYMOUS\n setable_permissions\n end",
"title": ""
},
{
"docid": "a588c8e8a4bd149293bf8af9170ada16",
"score": "0.711383",
"text": "def setable_permissions\n setable_permissions = Jartai::AccessControl.permissions - Jartai::AccessControl.public_permissions\n setable_permissions -= Jartai::AccessControl.members_only_permissions if self.builtin == BUILTIN_NON_MEMBER\n setable_permissions -= Jartai::AccessControl.loggedin_only_permissions if self.builtin == BUILTIN_ANONYMOUS\n setable_permissions\n end",
"title": ""
},
{
"docid": "d8331d15d02d7c4375b4dd0fcddc9e62",
"score": "0.7102514",
"text": "def custom_permissions\n Curate.configuration.registered_curation_concern_types.each do |work_type|\n # Blacklisting Create for work types UNLESS explicitly authorized\n unless user_work_type_policy.authorized_for?(work_type)\n # Show, Edit, Update, and Destroy are determined by the access controls\n # on the work.\n cannot :create, work_type.constantize\n end\n\n # Access to temporary access token management is limited to names in etd_manager_permission.yml\n if token_managers.include?(current_user.to_s)\n can [:manage], TemporaryAccessToken\n else\n cannot [:manage], TemporaryAccessToken\n end\n\n if super_administrators.include?(current_user.to_s)\n can [:manage], Admin::AuthorityGroup\n can [:orphan], GenericFile\n else\n cannot [:manage], Admin::AuthorityGroup\n cannot [:orphan], GenericFile\n end\n\n if repository_administrators.include?(current_user.to_s)\n can :characterize_file, :all\n else\n cannot :characterize_file, :all\n end\n end\n end",
"title": ""
},
{
"docid": "65662c2fa126b75a65a5047773a8017e",
"score": "0.70903814",
"text": "def custom_permissions(user, session)\n end",
"title": ""
},
{
"docid": "c5fa62405f0b3d79eaf0ac02e97ed325",
"score": "0.7072718",
"text": "def permissions\n (super || \"\").split(\",\")\n end",
"title": ""
},
{
"docid": "d405fa2a13442eae0dcb1e81f8654b0e",
"score": "0.70396984",
"text": "def setup_permissions\n # merge_permissions_attributes\n merge_visibility\n end",
"title": ""
},
{
"docid": "f534d21fe866cedc3b70ed6aa408efe8",
"score": "0.7016378",
"text": "def custom_permissions\n can :update, current_user\n custom_collection_permissions\n end",
"title": ""
},
{
"docid": "665b5657e095d664d39fa6b0073e8ac7",
"score": "0.7013835",
"text": "def user_permission\n super\n end",
"title": ""
},
{
"docid": "6146be367767fc3ba3a294dbc369b0ef",
"score": "0.6985436",
"text": "def load_permissions\n authorize! :manage, :all\n end",
"title": ""
},
{
"docid": "6146be367767fc3ba3a294dbc369b0ef",
"score": "0.6985436",
"text": "def load_permissions\n authorize! :manage, :all\n end",
"title": ""
},
{
"docid": "6146be367767fc3ba3a294dbc369b0ef",
"score": "0.6985436",
"text": "def load_permissions\n authorize! :manage, :all\n end",
"title": ""
},
{
"docid": "1e10146551068de37ca69a09d6d92735",
"score": "0.69739157",
"text": "def add_allow_access_list\n super\n end",
"title": ""
},
{
"docid": "dd07f0c7dab69e6944c001023da04ef2",
"score": "0.6962758",
"text": "def permission=(_arg0); end",
"title": ""
},
{
"docid": "d0f62febacb010b97120ef28c345d057",
"score": "0.6946357",
"text": "def permissions_policy(&block); end",
"title": ""
},
{
"docid": "c28aba02c7d3905a650debfe600ee7e7",
"score": "0.69249713",
"text": "def permissions\n # TODO: consider removing as potentially unsafe\n # (in the event a malicious user wants to model a super user with a real\n # super user's permissions)\n end",
"title": ""
},
{
"docid": "ae6f39797536d51bdd0f42c1cfdb38f2",
"score": "0.6846118",
"text": "def assign_permission\r\n \t# using users_permissions table for storage\r\n end",
"title": ""
},
{
"docid": "04504cdd51b73fec210e49faf6930da9",
"score": "0.6842757",
"text": "def custom_permissions\n def is_institutional_group_admin?(object)\n common_groups = object.edit_groups & current_user.groups\n common_groups.any? {|o| o.include?('-Admin') } ? true : false\n end\n\n cannot [:edit, :update, :new, :create], Collection do |collection|\n !is_institutional_group_admin?(collection) if collection.is_institutional?\n end\n\n def get_solr_doc(object_id)\n resp = ActiveFedora::SolrService.instance.conn.get(\n 'select', params: { q: \"id:#{object_id}\" })\n if resp['response']['numFound'] == 0\n raise Blacklight::Exceptions::InvalidSolrID.new(\n \"Parent collection: #{object_id} was not found\")\n end\n resp['response']['docs'].first\n end\n\n def is_institutional?(object_id)\n get_solr_doc(object_id)['institutional_collection_bsi']\n end\n\n can [:remove_members], Array do |member_ids|\n can_remove = true\n member_ids.each do |id|\n next unless is_institutional?(id)\n can_remove = false\n end\n can_remove\n end\n\n can [:add_members], Collection do |collection|\n test_edit(collection.id)\n end\n\n can [:add_members], String do |collection_id|\n test_edit(collection_id)\n end\n\n can [:follow, :unfollow], Collection do |collection|\n test_read(collection.id)\n end\n\n can [:follow, :unfollow], String do |collection_id|\n test_read(collection_id)\n end\n\n # Editors can do everything but delete things\n if current_user.has_role?('editor')\n can :manage, :all\n end\n\n if current_user.admin?\n can :manage, :all\n end\n\n # Limits deleting objects to a the admin user\n if !current_user.admin?\n cannot [:destroy], :all\n end\n end",
"title": ""
},
{
"docid": "ada9bdd0f5fe851df36e71a35b278221",
"score": "0.68411416",
"text": "def discovery_permissions\n if params[:owner]==\"mine\"\n [\"edit\"]\n else\n super\n end\n end",
"title": ""
},
{
"docid": "b91484a3573443497661d90bfd224eed",
"score": "0.6821876",
"text": "def set_permissions(*args)\n self.permissions = {}\n args.each do | permission |\n raise InvalidPermissionError.new(\"Permission #{permission} is invalid.\") unless ALLOWED_PERMISSIONS.include?(permission)\n self.permissions[permission] = true\n end\n end",
"title": ""
},
{
"docid": "cf46f9e62fda62ccca58f75a2e2e33a3",
"score": "0.6821553",
"text": "def admin!\n write_attribute('permissions', {\n 'systems' => true,\n 'services' => true,\n 'files' => true,\n 'users' => true\n })\n end",
"title": ""
},
{
"docid": "4cb0a570532f0fa026c4257026ae9abf",
"score": "0.68168175",
"text": "def set_CustomPermissions(value)\n set_input(\"CustomPermissions\", value)\n end",
"title": ""
},
{
"docid": "4cb0a570532f0fa026c4257026ae9abf",
"score": "0.68168175",
"text": "def set_CustomPermissions(value)\n set_input(\"CustomPermissions\", value)\n end",
"title": ""
},
{
"docid": "de83e63b57b1e63ede9a41e37a0d3975",
"score": "0.6812269",
"text": "def discovery_permissions\n if params[:owner]==\"mine\"\n [\"edit\"]\n else\n super\n end\n end",
"title": ""
},
{
"docid": "0ca5bcb4d458b5ceecd904759490de0d",
"score": "0.6793114",
"text": "def set_permissions\n default_params = {:view => false, :edit => false, :hi_res => false}\n params.reverse_merge!(default_params)\n\n view_action, edit_action, hi_res_download = case params[:view].to_sym\n when :private\n [default_params[:view], default_params[:edit], default_params[:hi_res]]\n when :public\n [true, !!params[:edit], true]\n else\n [default_params[:view], default_params[:edit], default_params[:hi_res]]\n end\n \n pre_load # OPTIMIZE\n @media_entries.each do |media_entry|\n actions = {:view => view_action, :edit => edit_action, :hi_res => hi_res_download}\n media_entry.default_permission=(actions)\n end\n\n if params[:view].to_sym == :zhdk_users\n zhdk_group = Group.where(:name => \"ZHdK (Zürcher Hochschule der Künste)\").first\n actions = {:view => true, :edit => !!params[:edit], :hi_res => true}\n @media_entries.each do |media_entry|\n actions.each_pair do |action, boolean|\n media_entry.permission.send((boolean.to_s == \"true\" ? :grant : :deny), {action => zhdk_group}) \n end\n end\n end\n\n edit\n render :action => :edit\n end",
"title": ""
},
{
"docid": "50289d8162a152fb11733a814a86b94c",
"score": "0.67863375",
"text": "def change_role_permissions(permissions)\n permissions.each do |key, value|\n # scroll_to_bottom\n\n case value\n when \"N\"\n revoke_permission key\n when \"R\"\n grant_read_permission key\n when \"D\"\n grant_delete_permission key\n when \"W\"\n grant_write_permissions key\n else\n \"Error: Unknown permission type. Defaulting to NONE.\"\n end\n end\n end",
"title": ""
},
{
"docid": "747e78256680fb7db9f05734cd2d1704",
"score": "0.67651147",
"text": "def set_permissions\n unless @permissions_set\n @permissions_set = true\n if self.exists?.nil?\n resource[:configure_permission] ||= defaults[:configure_permission]\n resource[:read_permission] ||= defaults[:read_permission]\n resource[:write_permission] ||= defaults[:write_permission]\n else\n resource[:configure_permission] = resource[:configure_permission] || configure_permission || defaults[:configure_permission]\n resource[:read_permission] = resource[:read_permission] || read_permission || defaults[:read_permission]\n resource[:write_permission] = resource[:write_permission] || write_permission || defaults[:write_permission]\n end\n self.create\n end\n end",
"title": ""
},
{
"docid": "3c40c3680434736d896f1ac29ad4dbc0",
"score": "0.6761199",
"text": "def initialize(user)\n user ||= User.new # guest user\n user.roles.each do |role|\n role.permissions.each do |permission|\n can permission.ability.downcase.to_sym, Object::const_get(permission.model)\n if permission.ability.to_s == 'manage'\n ['view','edit','delete','add'].each do |action|\n can action.to_sym, Object::const_get(permission.model)\n end\n end\n end\n end\n\n if user.role? :super_admin\n can :manage, :all\n end\n\t\t#examples of some ways to have certain roles manage certain controllers\n\t\t#please see the user views on how to check for the permissions\n\t\t#if user.role? :super_admin\n\t\t# can :manage, :all\n\t\t#elsif user.role? :product_admin\n\t\t# can [:read, :update, :create, :destroy], [Product, Asset, Issue]\n\t\t#elsif user.role? :product_team\n\t\t# can :read, [Product, Asset]\n\t\t# # manage products, assets he owns\n\t\t# can :manage, Product do |product|\n\t\t# can :read, Product, :active => true, :user_id => user.id\n\t\t# can :read, Project, :category => { :visible => true }\n\t\t# can :read, Project, :priority => 1..3\n\t\t#end\n\t\t#can :manage, Asset do |asset|\n\t\t# asset.assetable.try(:owner) == user\n\t\t#end\n\t\t#end\n\t\t##If you want to add a permissions scaffold to replace the roles_users\n\t\t#def initialize(user)\n\t\t# can do |action, subject_class, subject|\n\t\t# user.permissions.find_all_by_action(action).any do |permission|\n\t\t# permission.subject_class == subject_class.to_s &&\n\t\t# (subject.nil? || permission.subject_id.nil? || permission.subject_id == subject.id)\n\t\t# end\n\t\t# end\n\t\t#end\n end",
"title": ""
},
{
"docid": "96f1b17eb518f273c837b157c2603cda",
"score": "0.6737063",
"text": "def create_permissions\n if user_groups.include?('admin_group') || user_groups.include?('gis_cataloger')\n can [:new, :create], ActiveFedora::Base\n end\n end",
"title": ""
},
{
"docid": "6566afc7681578a08f40f4ba4ee3fdbd",
"score": "0.67309546",
"text": "def insert_roles_and_permissions_permissions\n create_permission(6, 'CanEditAllRoles')\n create_permission(7, 'CanEditAllPermissions')\n add_permission_to_super_admin(6)\n add_permission_to_super_admin(7)\nend",
"title": ""
},
{
"docid": "61612a1b1d4f0045d0f79c06c9ab7d41",
"score": "0.6718981",
"text": "def custom_permissions\n can [:create], Account\n end",
"title": ""
},
{
"docid": "61612a1b1d4f0045d0f79c06c9ab7d41",
"score": "0.6718981",
"text": "def custom_permissions\n can [:create], Account\n end",
"title": ""
},
{
"docid": "61612a1b1d4f0045d0f79c06c9ab7d41",
"score": "0.6718981",
"text": "def custom_permissions\n can [:create], Account\n end",
"title": ""
},
{
"docid": "b4302e417dc3e5fc07544edf07e0c739",
"score": "0.6713575",
"text": "def common_managerial_permissions(user)\n #can :manage, Roommate, :company_id => user.company.id\n can :manage, Neighborhood\n can :manage, Room\n can :manage, ListingDetail\n can :manage, BuildingAmenity, :company_id => user.company.id\n can :manage, ResidentialAmenity, :company_id => user.company.id\n can :manage, Utility, :company_id => user.company.id\n posting_permissions(user)\n\n if user.has_role?(:company_admin)\n can :manage, UserWaterfall\n end\n\n can :manage, Deal\n end",
"title": ""
},
{
"docid": "bef0f53afe3a17a9ed9139f85c9cfdda",
"score": "0.6688795",
"text": "def permissions\n authorize @member\n @roles = Role.all\n end",
"title": ""
},
{
"docid": "4d150f2a0bc0dd0214aff1292fc52bba",
"score": "0.6682634",
"text": "def global_oauth_required_permissions\n [:write] & Opro.request_permissions\n end",
"title": ""
},
{
"docid": "8ed72fe1ff6645091f97393b67fd427c",
"score": "0.668261",
"text": "def with_permission_scoping(&blk); wrap_permission_scoping(true,&blk); end",
"title": ""
},
{
"docid": "04a27ae53e182de40631dabc6fe86d14",
"score": "0.66801715",
"text": "def campus_patron_permissions\n end",
"title": ""
},
{
"docid": "d8e1f64572fad065400fb8110b7a7b4f",
"score": "0.6678236",
"text": "def acl(*args)\n permissions(*args)\n end",
"title": ""
},
{
"docid": "de95bfc86f92ed4f10dba9fb4e119089",
"score": "0.66750354",
"text": "def method_missing(name, *args, &block)\n return define_permission(name, *args, &block) if self.respond_to?(name)\n super\n end",
"title": ""
},
{
"docid": "d389cd724a4b6fe65f8199c313e44dc3",
"score": "0.6662282",
"text": "def set_user_permission(opts)\n opts = check_params(opts,[:permissions])\n super(opts)\n end",
"title": ""
},
{
"docid": "dd9691daee161ba1b318b7e441406d83",
"score": "0.6659946",
"text": "def set_permissions(permissions)\n self.read_restricted, @permissions = Category.resolve_permissions(permissions)\n\n # Ideally we can just call .clear here, but it runs SQL, we only want to run it\n # on save.\n end",
"title": ""
},
{
"docid": "16dc7e01a417e78463b305845cbd7c83",
"score": "0.6629711",
"text": "def set_permissions\n @permissions = Permission.all\n @role_permission = @role.try(:permission_ids) || []\n end",
"title": ""
},
{
"docid": "1af3c8ce5e2378e75816c8c1a491894c",
"score": "0.6616465",
"text": "def permissions\n (rightsMetadata.groups.map {|x| Permission.new(type: 'group', access: x[1], name: x[0] )} + \n rightsMetadata.individuals.map {|x| Permission.new(type: 'user', access: x[1], name: x[0] )})\n end",
"title": ""
},
{
"docid": "62876723826fe0e9a5e256790bc4d85f",
"score": "0.6613618",
"text": "def enforce_permissions\n controller_permissions.each do |permission|\n all_parameters = []\n permission.each do |p|\n check_format(p)\n parameter = {}\n parameter[:roles] = add_roles(p)\n parameter[:options] = (reformat_options(p[:options]) if p[:options]) || {}\n all_parameters << parameter\n end\n all_parameters.each{|param| self.require_role(param[:roles], param[:options]) \\\n if param[:roles]}\n end\n end",
"title": ""
},
{
"docid": "88fc699ea04daa62f22f18cf83b1104d",
"score": "0.6588469",
"text": "def check_permissions\n if role.in? ['Manager', 'Owner', 'Admin']\n PERMISSION_FLAGS.each { |flag| send(\"#{flag}=\", true) }\n end\n end",
"title": ""
},
{
"docid": "0ebe2138d6045037f6ea83d01d6bf7f2",
"score": "0.6587709",
"text": "def apply_default_permissions\n self.datastreams[\"rightsMetadata\"].update_permissions( \"group\"=>{\"Repository Administrators\"=>\"edit\"} )\n self.save\n end",
"title": ""
},
{
"docid": "6c0a5ffe22553a4a3bef253e74269d65",
"score": "0.6578298",
"text": "def permissions\n attribute_get(:permissions) or OohAuth[:default_permissions]\n end",
"title": ""
},
{
"docid": "6ccd66f44a836af8e0903f249c04f044",
"score": "0.6570042",
"text": "def change_role_permissions(permissions)\n permissions.each do |key, value|\n logger.debug \"Setting role permission '#{key}' to '#{value}'\"\n case value\n when \"N\"\n revoke_permission key\n when \"R\"\n grant_read_permission key\n when \"D\"\n grant_delete_permission key\n when \"W\"\n grant_write_permissions key\n else\n logger.error \"Unknown permission type. Defaulting to NONE.\"\n end\n end\n end",
"title": ""
},
{
"docid": "e8e44624200bade29c9d28ebedcce8ce",
"score": "0.6559031",
"text": "def permissions=(value)\n @permissions = value\n end",
"title": ""
},
{
"docid": "e8e44624200bade29c9d28ebedcce8ce",
"score": "0.6559031",
"text": "def permissions=(value)\n @permissions = value\n end",
"title": ""
},
{
"docid": "41d784e76ba93823bdeeb913cd85e3f7",
"score": "0.6540175",
"text": "def admin_users_permissions user\n can :read, :all\n can :access, :rails_admin\n can :update, User do |user|\n !(user.admin? || user.superadmin?)\n end\n can :crud, RoleAggregate\n can :crud, Dashboard\n can :crud, DashboardWidget\n can :crud, QuestionWidget\n can :crud, Dashboard\n if user.superadmin?\n # Super powers!!\n can :debug, :dashboard\n can :manage, :all\n can :read, :lime_survey_website\n end\n\n end",
"title": ""
},
{
"docid": "b57b0c26e54a5adfe9594afed53c72e6",
"score": "0.6539772",
"text": "def default_permissions\n # @collection.apply_depositor_metadata(@collection.depositor)\n @collection.set_edit_users([current_user.user_key], [])\n @collection.set_edit_groups([\"admin\"], [])\n end",
"title": ""
},
{
"docid": "23354738a653cd0516316a339ebaab75",
"score": "0.6536879",
"text": "def gen_permissions\n\t\tif current_user\n\t\t\t@permissions = {}\n\t\t\t@@PERMISSIONS.each do |permission, roles|\n\t\t\t\t@permissions[permission] = roles[current_user.role_id.to_sym]\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "049c14213e7faa3f3510a6f680d08cde",
"score": "0.6532427",
"text": "def set_permission\n\t\tself.permission ||= 2\n\tend",
"title": ""
},
{
"docid": "2836af80a75d0b0b80582ffa7af13ae3",
"score": "0.6508202",
"text": "def add_permission(admin, permission)\n inject_into_file destination_root(\"#{admin}/app.rb\"), indent(6, \"\\n#{permission}\\n\"), :after => \"access_control.roles_for :admin do |role, account|\\n\"\n end",
"title": ""
},
{
"docid": "1e741e642d852cff51c40223ac4bd988",
"score": "0.65046245",
"text": "def one_permission(permission, &block)\n define_method(\"#{permission.to_s}_permitted?\", &block)\nend",
"title": ""
},
{
"docid": "8db24cde45c0ad63ba49f1837c66856f",
"score": "0.65002626",
"text": "def default_permissions\n allows_read_of :created_at, :created_on, :type, :id, :updated_at, \\\n :updated_on, :lock_version, :position, :parent_id, :lft, :rgt, \\\n (table_name + '_count').to_sym\n\n # These shouldn't change after the first save.\n allows_write_of :created_at, :created_on, :type, :id, :if => :new_record?\n\n # These can change.\n allows_write_of :updated_at, :updated_on, :lock_version, :position, :parent_id, \\\n :lft, :rgt\n end",
"title": ""
},
{
"docid": "c56279cdba42c5333b589f0f609865e1",
"score": "0.6497516",
"text": "def permissions\n\t\t\t@permissions ||= {}\n\t\tend",
"title": ""
},
{
"docid": "b34165bb6d4c85504be89b26facce74e",
"score": "0.6490377",
"text": "def set_permissions\n return if @permissions_set\n\n @permissions_set = true\n resource[:configure_permission] ||= configure_permission\n resource[:read_permission] ||= read_permission\n resource[:write_permission] ||= write_permission\n rabbitmqctl(\n 'set_permissions',\n '-p', should_vhost,\n should_user,\n resource[:configure_permission],\n resource[:write_permission],\n resource[:read_permission]\n )\n end",
"title": ""
},
{
"docid": "7c32c59b67b1c7054dc30d845c602bef",
"score": "0.64845383",
"text": "def permissions\n @permissions ||= (self.user_permissions.to_a + self.roles.map{ |r| r.role_permissions.to_a }).flatten\n end",
"title": ""
},
{
"docid": "18d78c8d418d83f4c6f97693c4b2c081",
"score": "0.6474883",
"text": "def music_patron_permissions\n curation_concern_read_permissions\n can [:flag], curation_concerns\n end",
"title": ""
},
{
"docid": "2ce2831ae244d02d877482e12707ede7",
"score": "0.64724445",
"text": "def define_im_folder_permission\n case new_resource.im_install_mode\n when 'admin'\n im_folder_permission = '755'\n im_folder_permission\n when 'nonAdmin', 'group'\n im_folder_permission = '775'\n im_folder_permission\n end\nend",
"title": ""
},
{
"docid": "6e8900a8ffbb373d01bb24feadc863e2",
"score": "0.64695525",
"text": "def permissions(&block)\n target_eval do\n @_permissions = Permissions.eval(self, &block).result.freeze\n end\n end",
"title": ""
},
{
"docid": "7dc4759aa4b98a0ce4fd8377e4ce41a7",
"score": "0.64666593",
"text": "def permission_chain; self.class.permissable_options[:permission_chain] || {}; end",
"title": ""
}
] |
35f384b715f230d51837f6ee41c4d90a
|
Returns a move tree of legal move positions.
|
[
{
"docid": "63d67976f2417613e406003c271c16e1",
"score": "0.7800998",
"text": "def possible_moves\n row, col = @position\n @move_tree = @move_tree_template.clone || move_tree\n @move_tree.each do |node|\n r, c = node.loc\n potential_space = [row + r, col + c]\n node.loc = potential_space\n end\n\n move_tree_in_bounds\n end",
"title": ""
}
] |
[
{
"docid": "e1ffc215b389ad06f3519bacfe9c36de",
"score": "0.7241513",
"text": "def build_pawn_move_tree\n move_tree = MoveTree.new([0, 0])\n\n # Create changes based on @direction because pawns can only move one\n # direction.\n move_tree.root.add_child([@direction, 0])\n move_tree.root.add_child([@direction, 1])\n move_tree.root.add_child([@direction, -1])\n\n move_tree\n end",
"title": ""
},
{
"docid": "d024692e94d900a1277aea96a588b952",
"score": "0.7163461",
"text": "def build_move_tree(start_pos)\n # generate next possible move\n \n end",
"title": ""
},
{
"docid": "eb0d865c4fefcad58a02e5bceb983239",
"score": "0.709374",
"text": "def legal_moves(state)\n position = state[:position]\n outer_bounds = state[:outer_bounds]\n moves = []\n # Loop through all spaces on grid\n # position.each_with_index do |row, i|\n # row.each_with_index do |space, j|\n # if space == \".\"\n # moves << [i, j]\n # end\n # end\n # end\n\n # FOR SIMPLICITY require move to be within outer bounds\n # Calculate range of space to check\n\n row_min = [outer_bounds[:top] - 1, 0].max\n row_max = [outer_bounds[:bottom] + 1, 18].min\n\n column_min = [outer_bounds[:left] - 1, 0].max\n column_max = [outer_bounds[:right] + 1, 18].min\n (row_min..row_max).each do |i|\n (column_min..column_max).each do |j|\n if position[i][j] == \".\" # && !moves.index([i, j])\n moves << [i, j]\n end\n end\n end\n\n moves\n end",
"title": ""
},
{
"docid": "bc3c7e62e9f8aa3519c60f3365f64157",
"score": "0.7080078",
"text": "def legal_moves(state)\n position = state[:position]\n move_list = []\n position.each_with_index do |square, index|\n if square == 0\n move_list << index\n end\n end\n move_list\n end",
"title": ""
},
{
"docid": "bc3c7e62e9f8aa3519c60f3365f64157",
"score": "0.7080078",
"text": "def legal_moves(state)\n position = state[:position]\n move_list = []\n position.each_with_index do |square, index|\n if square == 0\n move_list << index\n end\n end\n move_list\n end",
"title": ""
},
{
"docid": "efc3cbf07400aed6990d75ca8ca4ba08",
"score": "0.70185125",
"text": "def legal_moves(state)\n move_list = []\n position = state[:position]\n position.each_with_index do |heap, index|\n if heap > 0\n (1..heap).each do |number|\n move_hash = { :heap => index, :number => number }\n move_list << move_hash\n end\n end\n end\n move_list\n end",
"title": ""
},
{
"docid": "e6e9c16340d53f347c45d59731cc4800",
"score": "0.69777966",
"text": "def moves\n moves = []\n\n #call move_dirs and generate moves\n move_dirs.each do |x,y|\n moves += valid_positions(x,y)\n end\n moves\n end",
"title": ""
},
{
"docid": "bd77b550b996daace5c4e17e7c670813",
"score": "0.69717836",
"text": "def build_move_tree\n poss_moves = new_move_positions(@start_pos)\n # until possible moves is empty, create children.\n # poss_moves each\n # get first possible move and shift it, and then assign parents and add children\n # then add first.children to possible moves\n\n until poss_moves.empty?\n poss_moves.each do |move|\n debugger\n first_move = PolyTreeNode.new(poss_moves.shift)\n first_move.parent = @start_pos\n @start_pos.add_child(first_move)\n poss_moves.concat(first_move.children) unless first_move.children.empty?\n #first_move.childern doesnt know his kids\n #need to call new_move_positions(first_move)\n end\n end\n\n\n # until visited_positions includes self(aka end_pos) keep going\n # poss_moves.map! do |move|\n # node = PolyTreeNode.new(move)\n # node.parent = @start_pos\n # @start_pos.add_child(node)\n # end\n end",
"title": ""
},
{
"docid": "0bff4b99a66feec05cfa8e26e16a94b7",
"score": "0.6963917",
"text": "def build_move_tree\n #starts at start_pos\n queue = []\n queue << @start_pos\n path = []\n until queue.empty?\n pos = queue.shift\n @visited_pos << pos\n node = @board.get_node(pos)\n if node.value == @end_pos\n return get_path(node)\n else\n\n new_moves = new_move_positions(pos)\n queue += new_moves.select{|x| !@visited_pos.include?(x)}\n\n assign_pointers(new_moves, node)\n\n end\n\n end\n end",
"title": ""
},
{
"docid": "ccc81ccc73ea1a2a4a8760f9bf9aab2b",
"score": "0.6853564",
"text": "def build_pawn_move_tree_first_move\n move_tree = MoveTree.new([0, 0])\n\n # Create changes based on @direction because pawns can only move one\n # direction.\n move_tree.root.add_child([@direction, 0])\n move_tree.root.children[0].add_child([2 * @direction, 0])\n move_tree.root.add_child([@direction, 1])\n move_tree.root.add_child([@direction, -1])\n\n move_tree\n end",
"title": ""
},
{
"docid": "8ab495b02c1db486f9af31718731de0f",
"score": "0.6849498",
"text": "def moves\n pos=[]\n DIC[self.rank].each do |(row, col)|\n pos << [position.first + row, position.last + col]\n end\n\n all_moves = remove_invalid(pos)\n valid_moves(all_moves)\n end",
"title": ""
},
{
"docid": "f162cd1cfbf56d0b479f4303b0f1304a",
"score": "0.6838746",
"text": "def potential_moves\n row = @position.first\n col = @position.last\n pos = []\n if @color == :white\n if row == 1\n\t pos << [row+2, col]\n\tend\n\tif row < 7\n\t pos << [row + 1, col]\n\tend\n\tif col > 0 && row < 7\n\t pos << [row + 1, col - 1]\n\tend\n\tif col < 7 && row < 7\n\t pos << [row + 1, col + 1]\n\tend\n else\n\tif row == 6\n\t pos << [row - 2, col]\n\tend\n\tif row > 0\n\t pos << [row -1, col] \n\t if col > 0\n\t pos << [row - 1, col - 1]\n\t elsif col < 7\n\t pos << [row -1, col + 1]\n\t end\n\tend\n end\n return pos\n end",
"title": ""
},
{
"docid": "f162cd1cfbf56d0b479f4303b0f1304a",
"score": "0.6838746",
"text": "def potential_moves\n row = @position.first\n col = @position.last\n pos = []\n if @color == :white\n if row == 1\n\t pos << [row+2, col]\n\tend\n\tif row < 7\n\t pos << [row + 1, col]\n\tend\n\tif col > 0 && row < 7\n\t pos << [row + 1, col - 1]\n\tend\n\tif col < 7 && row < 7\n\t pos << [row + 1, col + 1]\n\tend\n else\n\tif row == 6\n\t pos << [row - 2, col]\n\tend\n\tif row > 0\n\t pos << [row -1, col] \n\t if col > 0\n\t pos << [row - 1, col - 1]\n\t elsif col < 7\n\t pos << [row -1, col + 1]\n\t end\n\tend\n end\n return pos\n end",
"title": ""
},
{
"docid": "9dd1b38af8c48b78ed569b4d617d95f5",
"score": "0.682125",
"text": "def potential_moves\n pos_x = @position.first\n pos_y = @position.last\n positions = []\n (0...pos_x).each do |x|\n positions << [x, pos_y]\n end\n (pos_x...8).each do |x|\n positions << [x, pos_y]\n end\n (0...pos_y).each do |y|\n positions << [pos_x, y]\n end\n (pos_y...8).each do |y|\n positions << [pos_x, y]\n end\n positions.delete([pos_x, pos_y])\n return positions\n end",
"title": ""
},
{
"docid": "9dd1b38af8c48b78ed569b4d617d95f5",
"score": "0.682125",
"text": "def potential_moves\n pos_x = @position.first\n pos_y = @position.last\n positions = []\n (0...pos_x).each do |x|\n positions << [x, pos_y]\n end\n (pos_x...8).each do |x|\n positions << [x, pos_y]\n end\n (0...pos_y).each do |y|\n positions << [pos_x, y]\n end\n (pos_y...8).each do |y|\n positions << [pos_x, y]\n end\n positions.delete([pos_x, pos_y])\n return positions\n end",
"title": ""
},
{
"docid": "0b2241082533b74f4f5806282d133e20",
"score": "0.6785544",
"text": "def moves\n allowed_directions = move_dir\n move_offsets = allowed_directions.map { |direction| DIRECTIONS[direction] }\n valid_moves = []\n\n\n move_offsets.each do |offsets|\n offsets[0].each do |row_offset|\n offsets[1].each do |col_offset|\n step = 1\n row, col = self.position\n while (row + step * row_offset).between?(0,7) && (col + step * col_offset).between?(0,7)\n test_pos = [row +step * row_offset, col + step * col_offset]\n outcome = valid_move?(test_pos)\n if outcome.nil?\n valid_moves << test_pos\n break\n elsif outcome\n valid_moves << test_pos\n else\n break\n end\n step += 1\n end\n end\n end\n end\n valid_moves\n end",
"title": ""
},
{
"docid": "d340d92680acfbe8d6b51c20c05af204",
"score": "0.675806",
"text": "def possible_moves\n # Remove the two space move on the Pawn's first move\n @move_tree_template = @move_count.zero? ? build_pawn_move_tree_first_move : build_pawn_move_tree\n super\n end",
"title": ""
},
{
"docid": "c9b2c513177b25260071b4e46efe8fbd",
"score": "0.6716768",
"text": "def build_move_tree\r\n self.root_node = PolyTreeNode.new(@pos)\r\n # HashMap[root_pos] = new_move_positions()\r\n nodes = [root_node]\r\n until nodes.empty?\r\n current_node = nodes.shift #Take first one, FIFO!\r\n\r\n current_pos = current_node.value\r\n current_new_move_positions = new_move_positions(current_pos)\r\n current_new_move_positions.each do |moved_to_pos|\r\n moved_to_node = PolyTreeNode.new(moved_to_pos)\r\n # is a position you can move to from the current_node so it\r\n # is a child node\r\n current_node.add_child(moved_to_node) \r\n nodes << moved_to_node #Tag it onto the end\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "a78d6177241a7ed5a3a996f59dcd1fe3",
"score": "0.6712647",
"text": "def build_rook_move_tree\n move_tree = MoveTree.new([0, 0])\n\n # Build in each of the four directions the rook can go.\n move_tree.root.add_child(build_directional_tree_nodes([1, 0]))\n move_tree.root.add_child(build_directional_tree_nodes([-1, 0]))\n move_tree.root.add_child(build_directional_tree_nodes([0, 1]))\n move_tree.root.add_child(build_directional_tree_nodes([0, -1]))\n\n move_tree\n end",
"title": ""
},
{
"docid": "a963a031e6578856eed51d57aa7b3836",
"score": "0.6707772",
"text": "def legal_moves\n @check_move = []\n @capture_moves = []\n @legal_moves = []\n get_legal_move(-1, -2)\n get_legal_move(-1, 2)\n get_legal_move(1, -2)\n get_legal_move(1, 2)\n @legal_moves\n end",
"title": ""
},
{
"docid": "e519c191aafa195307a33b353727b6e1",
"score": "0.6705662",
"text": "def get_moves\n moves = []\n x,y = @position\n RULES.each do |rule|\n moves << [x + rule[0], y + rule[1]]\n end\n moves\n end",
"title": ""
},
{
"docid": "9e5ffc2c63b76a6b24f4ad17ccaadd91",
"score": "0.6693195",
"text": "def children\n moves = []\n\n board.rows.each_index do |r_index|\n board.rows[r_index].each_index do |c_index|\n pos = [r_index, c_index]\n next unless board.empty?(pos)\n new_board = board.dup\n new_board[pos] = next_mover_mark\n current_mark = next_mover_mark == :x ? :o : :x\n move_node = self.class.new(new_board, current_mark, pos)\n moves << move_node\n end\n end\n moves\n end",
"title": ""
},
{
"docid": "b69e83c616764387b2d07acba1f818e8",
"score": "0.66777194",
"text": "def children\n all_possible_moves = [] # initialize array to hold moves\n\n # iterate through all positions that are empty?\n (0..2).each do |row|\n (0..2).each do |col|\n current_pos = [row,col]\n # skip position if not empty\n next unless board.empty?(current_pos)\n # at each empty position, create node by dup'ing board, and put next_mover_mark\n dup_board = board.dup\n dup_board[current_pos] = self.next_mover_mark\n next_mover_mark = self.next_mover_mark == :x ? :o : :x\n all_possible_moves << TicTacToeNode.new(dup_board, next_mover_mark, current_pos)\n end\n end\n all_possible_moves # return all moves\n end",
"title": ""
},
{
"docid": "150c070c2584d389bd4f429246521a75",
"score": "0.6661543",
"text": "def build_move_tree\n queue = [@root_node]\n\n until queue.empty?\n # Start at the root and find possible positions (child nodes) to move to\n curr_node = queue.shift\n valid_pos = new_move_positions(curr_node.value)\n\n valid_pos.each do |pos|\n child = PolyTreeNode.new(pos)\n curr_node.add_child(child) # Build the tree with the child nodes\n queue << child\n end\n end\n\n return @root_node\n end",
"title": ""
},
{
"docid": "4814aef43a8c36247addfb8cfbb93f50",
"score": "0.6648061",
"text": "def children\n if @next_mover_mark == :x\n @next_mover_mark = :o\n else @next_mover_mark = :x\n end\n new_moves = []\n VALID_POSITIONS.each do |pos|\n if @board.empty?(pos)\n new_board = @board.dup\n new_board[pos] = @next_mover_mark\n new_moves << TicTacToeNode.new(new_board,@next_mover_mark, pos)\n end\n end\n new_moves\n end",
"title": ""
},
{
"docid": "1e5882dd82886af244cab5e99215d670",
"score": "0.66451484",
"text": "def legal_moves\n legal_move_list = []\n @@MoveList.each do |move_set|\n moved_square = relative_square(move_set[0],move_set[1])\n legal_move_list << moved_square unless moved_square.nil? or friend_exists(moved_square)\n end\n return legal_move_list\n end",
"title": ""
},
{
"docid": "567b1de64bb5d40a091b60665dd05d28",
"score": "0.6631331",
"text": "def new_move_positions(position)\n # possible_moves = []\n # move1 = start_position\n \n idx = 1\n idx2 = 2\n new_arr = []\n (0...4).each do |i|\n idx *= -1 if i == 2\n new_arr << [position[0]+idx, position[1]+idx2]\n idx2 *= -1\n end\n\n reverse_arr = []\n new_arr.each do |pos|\n reverse_arr << pos.reverse\n end\n\n all_possible_moves = new_arr + reverse_arr\n all_possible_moves = all_possible_moves.uniq.select do |pos| \n KnightPathFinder.valid_moves(pos) && \n !@considered_positions.include?(pos)\n end\n all_possible_moves.each do |position|\n @considered_positions.add(position)\n end\n all_possible_moves\n end",
"title": ""
},
{
"docid": "6b83417d01aa44d3c570a93357dd9642",
"score": "0.6630132",
"text": "def legal_moves(state)\n # puts \"Generating moves for piece at #{@location}...\"\n position = state[:position]\n move_list = []\n # Check whether in the middle of a series of captures\n if state[:moving_piece]\n if state[:moving_piece] != @location\n return []\n end\n # Add captures only\n move_list += generate_captures(state)\n else\n # Add both normal moves and captures\n move_list += generate_moves(state)\n move_list += generate_captures(state)\n end\n # (En passant capture no yet implemented)\n # Return move list\n move_list\n end",
"title": ""
},
{
"docid": "0a87084bf09d3cde403d6c1e626b5bf8",
"score": "0.6628081",
"text": "def get_possible_moves(game_state, position)\n position_list = []\n ALL_DIRECTIONS.each do |direction|\n move = add_direction(position, direction)\n if GameUtils::valid?(game_state, move)\n position_list << move\n end\n end\n position_list\n end",
"title": ""
},
{
"docid": "78350a006cb6a7225ec690b300c3af4b",
"score": "0.6620078",
"text": "def get_valid_moves (state)\n cur_state = state\n if !state.present?\n cur_state = self.state\n end\n result = Array.new\n @@valid_moves.each do |f|\n f.each do |t|\n move = @@valid_moves.index(f).to_s + '.' + t.to_s\n jump = self.get_jump(move)\n move += '.' + jump.to_s\n if self.is_valid_move(move, cur_state)\n result.unshift(move)\n end\n end\n end\n return result\n end",
"title": ""
},
{
"docid": "29cc282a478ad8d20f2d5d9d506a5c31",
"score": "0.66141516",
"text": "def legal_moves(chess_piece)\n return pawn_legal_moves(chess_piece) if chess_piece.is_a? Pawn\n\n move_tree = chess_piece.possible_moves\n legal_moves_array = []\n visit_queue = move_tree.root.children\n until visit_queue.empty?\n current_node = visit_queue.shift\n row, col = current_node.loc\n space = @board[row][col]\n # If it's a chess piece, check if it can capture.\n if space.is_a? ChessPiece\n # If the piece can capture it, add it as a valid space, but don't\n # add any of its children to visit_queue.\n next unless chess_piece.can_capture?(space)\n else\n # If there's not piece, it can continue along the move tree.\n current_node.children.each { |child| visit_queue << child }\n end\n # Append legal move locations\n legal_moves_array << current_node.loc\n end\n legal_moves_array\n end",
"title": ""
},
{
"docid": "89f0f5e7921f0e6a38a379b9ad6eea72",
"score": "0.661067",
"text": "def build_move_tree #all possible moves \n queue = [self.root_node]\n until queue.empty?\n node = queue.shift\n # PolyTreeNode.new([0,0])\n new_move_positions(node.value).each do |pos|\n child = node.add_child(PolyTreeNode.new(pos))\n queue << child\n end\n end\n end",
"title": ""
},
{
"docid": "73a6d77187996b5a011d7c0a25db2ef2",
"score": "0.66035986",
"text": "def get_possible_moves(game_state, position)\n position_list = []\n GameState::ALL_DIRECTIONS.each do |direction|\n move = position + direction\n if game_state.valid?(move)\n position_list << move\n end\n end\n position_list\n end",
"title": ""
},
{
"docid": "48eb14c6cc8c7e0116e0287eb1534585",
"score": "0.6591908",
"text": "def build_knight_move_tree\n move_tree = MoveTree.new([0, 0])\n # Get all possible net changes for a knight\n knight_moves_delta = [1, -1, 2, -2].permutation(2).reject { |n| n.sum.zero? }\n knight_moves_delta.each { |move| move_tree.root.add_child(move) }\n\n move_tree\n end",
"title": ""
},
{
"docid": "518ca84c40ae31d2058fc3e2bcc550a0",
"score": "0.6588173",
"text": "def legal_moves(state)\n position = state[:position]\n player = state[:player]\n piece_list = state[:pieces][player]\n move_list = []\n # Loop over pieces\n piece_list.each do |piece|\n move_list += piece.legal_moves(state)\n end\n move_list\n end",
"title": ""
},
{
"docid": "518ca84c40ae31d2058fc3e2bcc550a0",
"score": "0.6588173",
"text": "def legal_moves(state)\n position = state[:position]\n player = state[:player]\n piece_list = state[:pieces][player]\n move_list = []\n # Loop over pieces\n piece_list.each do |piece|\n move_list += piece.legal_moves(state)\n end\n move_list\n end",
"title": ""
},
{
"docid": "4026ed8a843181c0a3fa1c0eb38943d2",
"score": "0.6587733",
"text": "def children\n moves = []\n board.rows.each_with_index do |_, row|\n _.each_with_index do |__, col|\n moves << [row, col] if board.empty?([row, col])\n end\n end\n possible_moves = []\n moves.each do |move|\n start_board = board.dup\n r, c = move\n start_board.rows[r][c] = next_mover_mark\n next_move = ((self.next_mover_mark == :x) ? :o : :x)\n possible_moves << TicTacToeNode.new(start_board, next_move, move)\n end\n possible_moves\n end",
"title": ""
},
{
"docid": "2b8a29c6e277e77a4af76b374ce0744b",
"score": "0.6581433",
"text": "def legal_moves\n if @gamestate != :ongoing\n return []\n else\n return @empty_fields\n end\n end",
"title": ""
},
{
"docid": "9ed3e607ce10b640473656e68ea832f9",
"score": "0.6577637",
"text": "def new_move_positions(pos)\n moves = KnightPathFinder.valid_moves(pos).reject do |move|\n @visited_positions.include?(move)\n end\n moves\n end",
"title": ""
},
{
"docid": "e63c46e508bc935ec78de5792fb9ae1a",
"score": "0.65769696",
"text": "def possible_moves\n Knight.possible_moves_from(@position)\n end",
"title": ""
},
{
"docid": "ca27e5d6f63eeac85788e047df1deeae",
"score": "0.6573216",
"text": "def children\n possible_moves = @board.select{|position| position.empty?}\n game_states = possible_moves.map do |possible_move|\n prev_move_pos = possible_move\n duped_board = @board.deep_dup\n duped_board[possible_move] = self.next_mover_mark\n next_mover_mark = (self.next_mover_mark == :x ? :o : :x)\n TicTacToeNode.new(duped_board, next_mover_mark, possible_move)\n end\n game_states\n end",
"title": ""
},
{
"docid": "47ed31e09423ec8e97728c5f39722a48",
"score": "0.65672386",
"text": "def moves\n pos_moves = []\n\n move_dirs.each do |dx, dy|\n pos_moves.concat(grow_unblocked_moves_in_dir(dx, dy))\n end\n\n pos_moves\n end",
"title": ""
},
{
"docid": "3628f96be0d9f7b3e6ad7e0c7fba3e70",
"score": "0.6565477",
"text": "def build_move_tree(node = self.root_node)\n nmp = new_move_positions(node.position)\n return nil if nmp == []\n nmp.each do |next_position|\n np = PolyTreeNode.new(next_position)\n np.parent = node\n build_move_tree(np)\n end\n end",
"title": ""
},
{
"docid": "99d73ce4835d6a986316c314e40ec0c0",
"score": "0.6562885",
"text": "def children\n moves = []\n @board.rows.each_with_index do |row, idx_1|\n row.each_with_index do |ele, idx_2|\n pos = [idx_1, idx_2]\n if @board.empty?(pos)\n board = @board.dup\n board[pos] = next_mover_mark\n next_mark = (@next_mover_mark == :x ? :o : :x)\n moves << TicTacToeNode.new(board, next_mark, pos)\n end\n end\n end\n moves\n end",
"title": ""
},
{
"docid": "f73e63b3dfe437afad157cd61cfddbd6",
"score": "0.6559827",
"text": "def possible_moves(position)\n x, y = position[0], position[1]\n possibles = []\n \n# possibles is formed by adding only legal moves\n# call move grid method below\n move_grid(x,y).each {|move| possibles << move if move_legal?(move)}\n possibles\n end",
"title": ""
},
{
"docid": "67a15367bd4a7b2f2459443321c49365",
"score": "0.65550095",
"text": "def moves\n poss_moves = []\n\n all_dirs = diag_dirs + straight_dirs\n all_dirs.each_with_index do |dir, idx|\n new_pos = get_pos(pos, dir)\n next unless @board.in_bounds?(new_pos)\n other = @board[new_pos]\n\n if idx < diag_dirs.length\n next if other.is_a?(NullPiece) || other.same_team?(self)\n else\n break unless other.is_a?(NullPiece)\n end\n\n poss_moves << new_pos\n end\n\n poss_moves\n end",
"title": ""
},
{
"docid": "ef426aeee3c58f9674fdf09174e55e8c",
"score": "0.6552041",
"text": "def find_moves\n possibles = []\n possibles << [@x - 2, @y + 1] << [@x - 2, @y - 1] <<\n [@x + 2, @y - 1] << [@x + 2, @y + 1] <<\n [@x + 1, @y - 2] << [@x + 1, @y + 2] <<\n [@x - 1, @y - 2] << [@x - 1, @y + 2]\n # Checks if valid board square\n possibles.each do |x, y|\n added_square = Square.new(x, y, @parent)\n children << added_square if x <= 7 && x >= 0 && y <= 7 && y >= 0\n end\n end",
"title": ""
},
{
"docid": "f4ae608df49450e18436e2ad65381d58",
"score": "0.655063",
"text": "def new_move_positions(pos)\n moves = KnightPathFinder.valid_moves(pos)\n valid_moves = []\n\n moves.each do |move|\n # Look for positions that have not been visited\n if !considered_positions.include?(move)\n valid_moves << move\n considered_positions << move # mark as visited\n end\n end\n\n return valid_moves\n end",
"title": ""
},
{
"docid": "8510e673d90f006a311693b20e462d07",
"score": "0.65473443",
"text": "def build_move_tree(pos)\n queue = [pos]\n chess_tree = []\n # debugger\n until queue.empty?\n node = PolyTreeNode.new(queue.shift)\n children = new_move_positions(node.value)\n\n children.each do |child|\n node.add_child(PolyTreeNode.new(child))\n end\n\n queue += children\n chess_tree << node\n end\n chess_tree\n end",
"title": ""
},
{
"docid": "92e2a4d03ac317cb830ee92d800f5882",
"score": "0.65391827",
"text": "def build_move_tree(node=@root)\n accurate_moves = knight_moves_from_pos(node.value)\n if accurate_moves == nil\n return nil\n end\n accurate_moves.each do |move|\n \n child = PolyTreeNode.new(move)\n node.add_child(child)\n build_move_tree(child)\n end\n end",
"title": ""
},
{
"docid": "419036d78ad920de8ebe31fb653b911f",
"score": "0.6536285",
"text": "def children\n possible_moves = []\n @board.rows.each.with_index do |row, i|\n row.each.with_index do |col, j|\n pos = [i, j]\n if @board.empty?(pos)\n new_board = @board.dup\n new_board[pos] = @next_mover_mark\n next_mark = @next_mover_mark == :x ? :o : :x\n prev_move = pos\n new_node = TicTacToeNode.new(new_board, next_mark, prev_move)\n possible_moves << new_node\n end\n end\n end\n possible_moves\n end",
"title": ""
},
{
"docid": "623b6c3a4cd4752a6d7e1cb7501185d9",
"score": "0.65313166",
"text": "def build_move_tree(pos)\n root = TreeNode.new(pos)\n queue = [root]\n visited_positions = {root.value => true}\n while queue.length > 0\n treenode = queue.shift\n next_level = KnightPathFinder.new_move_positions(treenode.value)\n next_level.delete_if{ |pos| visited_positions.has_key?(pos) }\n next_level.each do |pos|\n new_node = TreeNode.new(pos)\n queue << new_node\n treenode.push(new_node)\n visited_positions[pos] = true\n end\n end\n root\n end",
"title": ""
},
{
"docid": "384635ed2c6093b4bf873c8a6dadb3e8",
"score": "0.6527844",
"text": "def possible_moves\n moves = []\n \n (1..7).each do |x|\n (@row + x > 7)? x_1 = nil : x_1 = @row + x\n (@row - x < 0)? x_2 = nil : x_2 = @row - x\n (@column + x > 7)? y_1 = nil : y_1 = @column + x\n (@column - x < 0)? y_2 = nil : y_2 = @column - x\n \n moves << [x_1, @column]\n moves << [x_2, @column]\n moves << [@row, y_1]\n moves << [@row, y_2]\n moves << [x_1, y_1]\n moves << [x_2, y_1]\n moves << [x_1, y_2]\n moves << [x_2, y_2]\n end\n moves.delete_if {|moves| moves.include?(nil)}\n return moves\n end",
"title": ""
},
{
"docid": "7b28dbfddf12f59be548798b23e541ce",
"score": "0.65214354",
"text": "def children\n moves = []\n @board.rows.each_with_index do |row, idx1|\n row.each_with_index do |pos, idx2|\n if pos.nil?\n newboard = []\n @board.rows.each { |sub| newboard << sub.dup }\n newboard[idx1][idx2] = @next_mover_mark\n newmark = nil\n @next_mover_mark == :x ? newmark = :o : newmark = :x\n moves << TicTacToeNode.new(Board.new(newboard), newmark, [idx1, idx2])\n end\n end\n end\n moves\n end",
"title": ""
},
{
"docid": "9ba822efcde6a210d0101bb52affc387",
"score": "0.6521254",
"text": "def children\n available_moves = []\n ([email protected]).each do |i|\n ([email protected][i].length).each do |j|\n if @board.empty?([i,j])\n new_board = @board.dup\n new_board[[i,j]] = next_mover_mark\n if next_mover_mark == :x\n next_mover_mark = :o\n else\n next_mover_mark = :x\n end\n available_moves << TicTacToeNode.new(new_board, next_mover_mark, [i,j]) \n end\n end\n end\n available_moves\n end",
"title": ""
},
{
"docid": "6d06f207ee24afb783accc0acc409413",
"score": "0.6514688",
"text": "def children\n possible_nodes = []\n\n # iterate through all positions that are empty?\n # for each empty position\n get_empty_pos.each do |pos|\n # create a node by duping the board\n duped_board = @board.dup\n # put a next_mover_mark in the position\n duped_board[pos] = @next_mover_mark\n # alternate next_mover_mark\n next_mark = @next_mover_mark == :x ? :o : :x\n # set prev_move_pos to position you just marked\n new_possible_node = TicTacToeNode.new(duped_board, next_mark, pos)\n possible_nodes << new_possible_node\n end\n\n possible_nodes\n end",
"title": ""
},
{
"docid": "2ba55989a32116390b1fbc124a0f8a16",
"score": "0.65100473",
"text": "def moves\n x, y = @pos\n positions = []\n positions << [x+2, y-1] << [x+2, y+1] << [x-2, y-1] << [x-2, y+1] << [x+1, y-2] << [x+1, y+2] << [x-1, y-2] << [x-1, y+2]\n valid_moves = positions.select {|pos| pos.all? {|i| i.between?(0,7)}} \n valid_moves\n end",
"title": ""
},
{
"docid": "9de565c9dd2063f8dc8664277af6ca82",
"score": "0.65086395",
"text": "def build_move_tree(node = self.root_node)\n node_order = [node]\n until node_order.empty?\n nmp = new_move_positions(node_order.first.position)\n nmp.each do |next_move|\n next_position = PolyTreeNode.new(next_move)\n next_position.parent = node_order.first\n node_order << next_position\n end\n node_order.shift\n end\n end",
"title": ""
},
{
"docid": "3bfa36828d2ecb77d36d9dfa6ea583d7",
"score": "0.6507604",
"text": "def children\n moves = []\n #go through each empty spot on Board\n #dupe board, add next-mover-mark -- X or O, depending\n # create nod\n next_mark = (@next_mover_mark == :o) ? :x : :o\n @board.rows.each_with_index do |row, idx1|\n row.each_with_index do |mark, idx2|\n pos = [idx1, idx2]\n if @board.empty?(pos)\n new_board = @board.dup\n new_board[pos] = next_mark\n moves << TicTacToeNode.new(new_board, next_mark, pos)\n end\n end\n end\n moves\n end",
"title": ""
},
{
"docid": "610af3a3275421b055cbe2dc87bc6505",
"score": "0.6493381",
"text": "def build_move_tree(pos)\n parent = PolyTreeNode.new(pos)\n new_move_positions(pos).each do |new_pos|\n new_node = PolyTreeNode.new(new_pos)\n new_node.parent=(parent)\n \n end \n end",
"title": ""
},
{
"docid": "85091d3e3a84472ef54459465a5e4bb8",
"score": "0.64858174",
"text": "def children\n possible_moves = []\n (0...3).each do |x|\n (0...3).each do |y|\n if @board.empty?([x,y])\n board_dup = @board.dup\n current_pos = [x,y]\n board_dup[current_pos] = @next_mover_mark\n next_mark = prev_move_pos.nil? ? :o : board_dup[@prev_move_pos]\n node = TicTacToeNode.new(board_dup,next_mark,current_pos)\n possible_moves << node\n end\n end\n end\n possible_moves\n end",
"title": ""
},
{
"docid": "8afcff257c612773b325681b6869a812",
"score": "0.6480669",
"text": "def build_move_tree()\n queue = [@start_pos]\n\n until queue.empty?\n current_pos = queue.shift\n new_positions = new_move_positions(current_pos.value)\n new_move_positions.each do |new_pos| #all new possitions are child of new node\n child = PolyTreeNode.new(new_pos)\n current_pos.add_child(child)\n queue << child\n end\n end\n end",
"title": ""
},
{
"docid": "76df64a87551e89428908e1bb3f3230d",
"score": "0.6480076",
"text": "def get_rook_moves\n result = get_standard_moves [:north, :south]\n [:northwest, :northeast, :southwest, :southeast].each do |direction|\n diagonal_adjacent = @space.get_adjacent(direction)\n next if diagonal_adjacent.nil?\n result << diagonal_adjacent.id if diagonal_adjacent.piece.nil?\n end\n result\n end",
"title": ""
},
{
"docid": "70571663a4cda1b9cfe18693c150c4f6",
"score": "0.6470828",
"text": "def children\n moves_available = []\n board.rows.each_index do |row_i|\n board.rows[row_i].each_index do |col_i|\n new_pos = [row_i, col_i]\n if board[new_pos].nil?\n if next_mover_mark == :x\n child_next_mover_mark =:o\n else\n child_next_mover_mark = :x\n end\n child_board = board.dup\n child_board[new_pos] = next_mover_mark\n moves_available << TicTacToeNode.new(child_board, child_next_mover_mark, new_pos)\n end\n end\n end\n moves_available\n end",
"title": ""
},
{
"docid": "b07a588b59f1dfb432628641509a0fbe",
"score": "0.645821",
"text": "def build_move_tree #finding children\n \n end",
"title": ""
},
{
"docid": "de0a14e0a02baf3eca82284f7a92870f",
"score": "0.64518714",
"text": "def children\n empty_pos = []\n\n @board.rows.each_with_index do |row, i1|\n row.each_with_index do |ele, i2|\n if @board.empty?([i1, i2])\n empty_pos << [i1, i2]\n end\n end\n end\n\n possible_states = []\n\n empty_pos.each do |pos|\n dup_board = @board.dup\n dup_board[pos] = @next_mover_mark\n mark = ((@next_mover_mark == :x) ? :o : :x)\n prev_move_pos = pos \n new_node = TicTacToeNode.new(dup_board, mark, prev_move_pos) \n possible_states << new_node\n end\n\n possible_states\n\n end",
"title": ""
},
{
"docid": "4e225225e2d4581ab0ffa3046cb4b84b",
"score": "0.6449718",
"text": "def children\n moves = []\n @board.rows.each_with_index do |row, i|\n row.each_with_index do |tile, j|\n moves << [i, j] if @board[[i, j]].nil?\n end\n end\n moves.map do |move|\n new_state = @board.dup\n new_state[move] = @next_mover_mark\n self.class.new(new_state, other_symbol, move)\n end\n end",
"title": ""
},
{
"docid": "e1b7fa5744b1cbc73c77993473ced665",
"score": "0.64494795",
"text": "def children\n possible_moves = []\n \n @board.rows.each_with_index do |row, row_i|\n row.each_with_index do |box, col_i|\n if @board.empty?([row_i, col_i])\n board_copy = @board.dup\n board_copy[[row_i, col_i]] = next_mover_mark\n possible_moves << TicTacToeNode.new(board_copy, (@next_mover_mark == :x ? :o : :x), [row_i, col_i])\n end\n end\n end\n possible_moves \n end",
"title": ""
},
{
"docid": "29754a89cf7d21d3c285852f960934cb",
"score": "0.64457214",
"text": "def legal_moves\n all_moves = [[0,0], [0,1], [0,2], [1,0], [1,1], [1,2], [2,0],\n [2,1], [2,2]]\n all_moves.select{|move| at(move[0], move[1]) == '_'}\n end",
"title": ""
},
{
"docid": "9487509acfa1af0c559f909d0b5e8bb0",
"score": "0.6444318",
"text": "def build_directional_tree_nodes(direction = [1, 0])\n vertical_movement, horizontal_movement = direction\n closest_move = MoveTreeNode.new(direction)\n (2..7).each do |spaces|\n current_child = closest_move\n (spaces - 2).times { current_child = current_child.children[0] }\n current_child.add_child([spaces * vertical_movement, spaces * horizontal_movement])\n end\n\n closest_move\n end",
"title": ""
},
{
"docid": "db8b05165e0b404253317651ff596071",
"score": "0.6440695",
"text": "def possible_moves\n []\n end",
"title": ""
},
{
"docid": "640824e5f6b0099e9c394d017c804bd5",
"score": "0.64356416",
"text": "def legal_moves(state)\n moves = []\n # Loop over all movable cards\n cards = movable_cards(state)\n cards.each do |card|\n # Loop over legal moves for this card \n legal_destinations(card).each do |dest|\n # Add move to list\n moves << [card, dest]\n end\n end\n moves\n end",
"title": ""
},
{
"docid": "f938ae8698adb5279f270b6363bd11a5",
"score": "0.64345133",
"text": "def moves\n all_moves = []\n pos = self.pos\n\n DIFFS[self.move_dirs].each do |delta_arr|\n all_moves.concat(get_moves(pos, delta_arr))\n end\n all_moves\n end",
"title": ""
},
{
"docid": "607e25d4a95bd8ae82b9711476a1fb2b",
"score": "0.643332",
"text": "def children\n possible_moves = []\n\n (0...3).each do |row|\n (0...3).each do |col|\n if self.board.empty?([row, col])\n new_move = TicTacToeNode.new(self.board.dup, ((self.next_mover_mark == :x) ? :o : :x), [row, col])\n new_move.board[[row, col]] = @next_mover_mark\n possible_moves << new_move\n end\n end\n end\n\n possible_moves\n end",
"title": ""
},
{
"docid": "8e57b038ede4983085203466f2b35329",
"score": "0.64252627",
"text": "def children\n moves = []\n board.rows.each_with_index do |row, idx1|\n row.each_with_index do |ele, idx2|\n pos = [idx1, idx2]\n if board.empty?(pos)\n new_board = board.dup\n new_board[pos] = @next_mover_mark\n next_mover_mark = (@next_mover_mark == :x ? :o : :x)\n moves << TicTacToeNode.new(new_board, next_mover_mark, pos)\n end \n end\n end\n moves\n end",
"title": ""
},
{
"docid": "4c559dd0a6383540b44b56fd6d190528",
"score": "0.64105695",
"text": "def moves \n []\n end",
"title": ""
},
{
"docid": "2168b7c6e2d823d8d69c0da21591f343",
"score": "0.64037454",
"text": "def children\n valid_moves = []\n 0.upto(2).each do |row|\n 0.upto(2).each do |col|\n valid_moves << [row, col] if @board.rows[row][col].nil?\n end\n end\n children = []\n #All board positions initialized with marker and new board\n valid_moves.each do |empty_pos|\n new_board = deep_dup(@board.rows)\n row, col = empty_pos\n new_board[row][col] = @next_mover_mark\n # p @next_mover_mark\n next_mark = switch_marker\n # p next_mark\n # p @next_mover_mark\n\n children << TicTacToeNode.new(Board.new(new_board), next_mark, empty_pos)\n end\n children\n end",
"title": ""
},
{
"docid": "01a40abf375c1186b021a02e01d361e0",
"score": "0.6402124",
"text": "def moves\n @moves ||= move_pairs.flatten\n end",
"title": ""
},
{
"docid": "1c601b2ba5e62464e2d7b71fc60a722e",
"score": "0.6402071",
"text": "def children\n current_pos = @prev_move_pos\n empty_pos = []\n next_mark = switch(next_mover_mark)\n @board.rows.each_with_index do |row, i|\n row.each_with_index do |col, j|\n new_board = @board.dup\n if new_board.rows[i][j].nil?\n new_board.rows[i][j] = next_mover_mark\n empty_pos << TicTacToeNode.new(new_board, next_mark , [i, j])\n \n end\n end\n end\n empty_pos\n end",
"title": ""
},
{
"docid": "fd9b4dceffc5e40d04786968d2940774",
"score": "0.6399871",
"text": "def legal_moves\n @legal_moves = []\n # Different Y coordinates for black and white pieces (moving up and down)\n if self.color == \"w\"\n y = @y + 1\n y2 = @y + 2\n elsif self.color == \"b\"\n y = @y - 1\n y2 = @y - 2\n end\n # The move is available if the space is empty\n if @@board[y][@x] == \" \"\n @legal_moves << [@x, y]\n end\n # For first move of a pawn, 2 moves forward is allowed\n if @first_move && @@board[y2][@x] == \" \" && @@board[y][@x] == \" \"\n @legal_moves << [@x, y2] \n end\n @legal_moves\n end",
"title": ""
},
{
"docid": "b624eaf083d0a49908b41bf73abf2a52",
"score": "0.63945436",
"text": "def all_moves\n moves = {}\n movable_pieces.each { |piece| moves[piece.pos] = piece.valid_moves }\n moves\n end",
"title": ""
},
{
"docid": "e9ee3fef426bcb7e18eb89c51688415e",
"score": "0.6385203",
"text": "def build_move_tree\n @node = PolyTreeNode.new(start_pos)\n end",
"title": ""
},
{
"docid": "8eb9986c4f77449372939d5948c37223",
"score": "0.63849646",
"text": "def children\n empty_positions = positions.select do |pos|\n @board[pos].nil?\n end\n empty_positions.map do |pos|\n board_dup = @board.dup\n board_dup[pos] = @next_mover_mark\n prev_mover_mark = @next_mover_mark == :x ? :o : :x\n TicTacToeNode.new(board_dup, prev_mover_mark, pos)\n end\n end",
"title": ""
},
{
"docid": "e5bc4053861544bbbe20eaa8fca7c339",
"score": "0.638414",
"text": "def new_move_positions(pos)\n new_moves = []\n\n valid_moves(pos).each do |move|\n unless self.visited_pos.include?(move)\n new_moves << move\n self.visited_pos << move\n end\n end\n\n new_moves\n end",
"title": ""
},
{
"docid": "f7830ad515dc57245b687e84a8b64876",
"score": "0.6383331",
"text": "def valid_moves(position)\r\n# position is a tuple, [x, y]\r\n x = position[0] # I could make position into a class/struct and add methods x and y\r\n y = position[1]\r\n #puts \"X = #{x}, Y = #{y}\"\r\n move = []\r\n move[0] = [x-1, y+2]\r\n move[1] = [x-2, y+1]\r\n move[2] = [x-2, y-1]\r\n move[3] = [x-1, y-2]\r\n move[4] = [x+1, y-2]\r\n move[5] = [x+2, y-1]\r\n move[6] = [x+2, y+1]\r\n move[7] = [x+1, y+2]\r\n result = []\r\n move.each do |pos| \r\n \tresult << pos if ( pos[0].between?(0, 7) && pos[1].between?(0,7) && $board[ [pos[0],pos[1]] ].visited == false) \r\n end\r\n result\r\nend",
"title": ""
},
{
"docid": "06cbc9abc79854bd6c4dd567462bce19",
"score": "0.6376984",
"text": "def moves\n moves = []\n move_dirs.each do |poss_move|\n dx, dy = poss_move\n moves += grow_unblocked_moves_in_dir(dx, dy)\n end\n moves\n end",
"title": ""
},
{
"docid": "73a4be1a15997d34045085eeb980feb4",
"score": "0.63745964",
"text": "def moves\n #byebug\n # potential_moves = []\n # valid_moves = []\n # STRAIGHT.each do |diff|\n # x, y = diff\n # potential_moves << [x + position[0], y + position[1]]\n # end\n #\n # until potential_moves.empty?\n # byebug\n # x, y = potential_moves.shift\n # tested_move = [grow_unblocked_moves_in_dir(x, y)]\n # valid_moves += tested_move unless tested_move.nil?\n # potential_moves += tested_move unless tested_move == [nil]\n # end\n # valid_moves\n\n end",
"title": ""
},
{
"docid": "85685565070cb4a1ec40c0461ac706a5",
"score": "0.63711727",
"text": "def new_move_positions(pos)\n possible_moves = KnightPathFinder.valid_moves(pos) - @visited_positions\n @visited_positions.concat(possible_moves)\n possible_moves\n end",
"title": ""
},
{
"docid": "8658b985cba672e99b31f6de11b2823d",
"score": "0.63697994",
"text": "def children\n poss_moves = []\n other_mark = @next_mover_mark == :x ? :o : :x\n\n 3.times do |row|\n 3.times do |col|\n\n if @board.empty?([row, col])\n curr_pos = [row, col]\n next_board = @board.dup\n next_board[curr_pos] = @next_mover_mark\n poss_moves << TicTacToeNode.new(next_board, other_mark, curr_pos)\n end\n\n end\n end\n\n poss_moves\n\n end",
"title": ""
},
{
"docid": "52a0ef86183007f6892ff488669950d1",
"score": "0.63687843",
"text": "def moves(world_state)\n []\n end",
"title": ""
},
{
"docid": "22efcd96a4f2098519eb0a0db24d2c6e",
"score": "0.63687223",
"text": "def from_moves(moves)\n @tree.search moves\n end",
"title": ""
},
{
"docid": "2904c5db0bd2c6547af86ed575317f62",
"score": "0.636763",
"text": "def possible_moves(pos)\n x,y = pos\n width = maze[0].length\n height = maze.length\n positions = [\n [x , y-1], # Top\n [x+1, y ], # Right\n [x , y+1], # Bottom\n [x-1, y ] # Left\n ].select do |x,y|\n x >= 0 && y >= 0 && x < width && y < height && [' ','A','B'].include?(maze[y][x])\n end\n end",
"title": ""
},
{
"docid": "7e78ed431139adc7272924c46c2b60f2",
"score": "0.6366905",
"text": "def children\n moves = []\n\n board.rows.each_with_index do |row, row_idx|\n row.each_with_index do |pos, col_idx|\n if pos.nil?\n new_board = board.dup\n new_board.rows[row_idx][col_idx] = next_mover_mark\n new_mark = switch_mark\n moves << TicTacToeNode.new(new_board, new_mark, [row_idx,col_idx])\n end\n end\n end\n moves\n end",
"title": ""
},
{
"docid": "216e9575924ce0e2d09b300a27f12327",
"score": "0.63666815",
"text": "def legal_moves(position)\n # Fill this in\n end",
"title": ""
},
{
"docid": "9fe9e5a86c99e04ca6433787156c37a2",
"score": "0.6366339",
"text": "def children\n moves = []\n\n if next_mover_mark == :x\n next_mover_mark = :o\n else\n next_mover_mark = :x\n end\n\n MASTER_LIST.each do |move|\n if board.empty?(move)\n @prev_move_pos = move\n end\n moves << TicTacToeNode.new(board.dup, next_mover_mark, prev_move_pos)\n end\n\n moves\n end",
"title": ""
},
{
"docid": "309068a97451ebfaceaddc627d937083",
"score": "0.63638204",
"text": "def children\r\n possible_moves = []\r\n next_mover_mark == :x ? new_mark = :o : new_mark = :x\r\n @board.rows.each_with_index do |row, i|\r\n (0...row.length).each do |j|\r\n new_node = TicTacToeNode.new(@board.dup, new_mark, [i, j])\r\n new_node.board.rows[i][j] = new_mark\r\n possible_moves << new_node if @board.rows[i][j].nil?\r\n end\r\n end\r\n possible_moves\r\n end",
"title": ""
},
{
"docid": "fcf8e6533cf3fc8630e9418167d02ecd",
"score": "0.6363411",
"text": "def moves\n possible_moves = []\n deltas.each do |delta|\n new_pos = [\n position[0] + delta[0],\n position[1] + delta[1]\n ]\n if board.in_bounds?(new_pos)\n if board.piece_at?(new_pos)\n unless board[new_pos].color == color\n possible_moves << new_pos\n end\n else\n possible_moves << new_pos\n end\n end\n end\n possible_moves\n end",
"title": ""
},
{
"docid": "0b4f60fd29baf01dc6b326805b5fe59d",
"score": "0.63633645",
"text": "def build_move_tree\n # root = PolyTreeNode.new(@position)\n queue = [@root]\n until queue.empty?\n current = queue.shift\n # return current if current.position == target_pos\n new_move_positions(current.value).each do |pos|\n node = PolyTreeNode.new(pos)\n node.parent = current\n queue << node\n\n end\n nil\n # p root.bfs([1,2])\n end\n nil\n end",
"title": ""
},
{
"docid": "f18b67233d8543cd23093c083e32f4fd",
"score": "0.63632584",
"text": "def valid_moves\n moves\n end",
"title": ""
},
{
"docid": "93489afb2ab9c4eaf2e6cc8e1acb44c7",
"score": "0.63595533",
"text": "def get_moves(direction)\n deltas = {:right => [0,1], :left => [0,-1],\n :up => [-1, 0], :down => [1,0], :upleft => [-1,-1],\n :upright => [-1,1], :downleft => [1,-1], :downright => [1,1],\n :castle_left => [0, -2], :castle_right => [0, 2]}\n\n row, col = @position\n delta_x, delta_y = deltas[direction]\n possible_moves = []\n new_pos = [row+delta_x, col+delta_y]\n\n if (direction == :castle_left || direction == :castle_right)\n if (@moved == true)\n return []\n end\n\n halfway = [row+(delta_x/2), col+(delta_y/2)]\n if (@board.in_bounds?(new_pos) && @board[new_pos] == nil &&\n @board[halfway] == nil)\n possible_moves.push(new_pos)\n end\n elsif @board.in_bounds?(new_pos)\n if (@board[new_pos] == nil || @board[new_pos].color != @color)\n possible_moves.push(new_pos)\n end\n end\n\n possible_moves\n end",
"title": ""
}
] |
fbe2c75ed56742490a872d7a956fae22
|
Takes in points, P/A, sub, etc. and Calculates the probability in the OC card.
|
[
{
"docid": "b70b67788ab573ba3aaf187c211bae86",
"score": "0.0",
"text": "def calculate_oc_subtotal(wrestler)\n\t\t\n\t\t# Sum up points per roll * probability\n\t\toc_points = 0\n\t\twrestler.each { |k,v| \n\t\t\tk = remove_attribute_from_key(k)\n\t\t\tprob = return_rational(calculate_probability(symbol_to_integer(k))).to_f\n\t\t\toc_points += v * prob\n\t\t}\n\n\t\toc_points_subtotal = oc_points\n\t\treturn oc_points_subtotal\n\tend",
"title": ""
}
] |
[
{
"docid": "8a9a9ed8f178ca967e19168d7409ada7",
"score": "0.6177207",
"text": "def calculate_points(cards_in_hands)\n points = 0\n cards_without_ace = cards_in_hands.select {|card| card[1] != 'A'}\n cards_with_ace = cards_in_hands.select {|card| card[1] == 'A'}\n cards_without_ace.each do |card|\n if card[0].to_i !=0\n points += card[0].to_i\n else\n points += 10\n end\n end\n if cards_with_ace.empty?\n return points\n else\n ace_sets = [11, 1].repeated_permutation(cards_with_ace.length).to_a\n ace_sets_sum_arr = []\n ace_sets.each do |arr|\n arr_sum = 0\n arr.each {|v| arr_sum = arr_sum + v}\n ace_sets_sum_arr.push(arr_sum)\n end\n ace_sets_sum_arr.sort!.uniq!\n ace_sets_sum_arr.map! {|num| num + points}\n if ace_sets_sum_arr.include?(21)\n points = 21\n return points\n else\n lt_21_arr = ace_sets_sum_arr.select {|v| v < 21}\n gt_21_arr= ace_sets_sum_arr.select {|v| v > 21}\n if lt_21_arr.empty?\n points = gt_21_arr.first\n return points\n else\n points = lt_21_arr.last\n return points\n end\n end\n end\nend",
"title": ""
},
{
"docid": "02c56c6f6699eabba3cce7f18df9a388",
"score": "0.6051108",
"text": "def move_points(hash)\n\n\t\tpoints = Hash.new\n\n\t\tgc_hash = hash.select { |k,v| k.to_s.include?('gc') }\n\t\toc_hash = gc_hash.select { |k,v| v.include?('OC') }\n\n\t\t# Calculate OC count to calculate probablity.\n\t\tpoints[:oc_enumerator] = prob_points(oc_hash)\n\t\tpoints[:oc_probability] = return_rational(points[:oc_enumerator]).to_f\n\t\tpoints[:dc] = calculate_gc_dc_roll_probability(points[:oc_enumerator])\n\n\t\t# Calculate TT Roll in GC\n\t\tpoints[:gc_tt_enumerator] = calculate_gc_tt_roll_probability(hash)\n\t\tpoints[:gc_tt_roll] = return_rational(calculate_gc_tt_roll_probability(hash))\n\t\t\n\t\t# Create Symbols for Points\n\t\tfor i in 2..12 do\n\t\t\tdc_points = \"dc%02d_points\" % i\n\t\t\tpoints[dc_points.to_sym] = 0\n\t\t\ti += 1\n\t\tend\n\t\t\n\t\tpoints[:reverse] = 0\n\t\tpoints[:specialty_roll_probability_in_oc] = 0\n\n \t\tfor i in 1..6 do\n\t\t\ts_points = \"s#{i}_points\"\n\t\t\tpoints[s_points.to_sym] = 0\n\t\t\ti += 1\n\t\tend\n\n \t\tpoints[:s_roll_prob_dq] = 0\n\t\tpoints[:s_roll_prob_pa] = 0\n\t\tpoints[:s_roll_prob_sub] = 0\n\t\tpoints[:s_roll_prob_xx] = 0\n\n\t\t# TODO: Refactor this into one method\n\t\tfor i in 2..12 do\n\t\t\toc_points = \"oc%02d_points\" % i\n\t\t\tpoints[oc_points.to_sym] = 0\n\t\t\ti += 1\n\t\tend\n\n\t\t# TODO: Refactor this into one method\n\t\tfor i in 2..12 do\n\t\t\toc_dq = \"oc%02d_dq\" % i\n\t\t\tpoints[oc_dq.to_sym] = 0\n\t\t\ti += 1\n\t\tend\n\n\t\t# TODO: Refactor this into one method\n\t\tfor i in 2..12 do\n\t\t\toc_pa = \"oc%02d_pa\" % i\n\t\t\tpoints[oc_pa.to_sym] = 0\n\t\t\ti += 1\n\t\tend\n\n\t\t# TODO: Refactor this into one method\n\t\tfor i in 2..12 do\n\t\t\toc_sub = \"oc%02d_sub\" % i\n\t\t\tpoints[oc_sub.to_sym] = 0\n\t\t\ti += 1\n\t\tend\n\n\t\t# TODO: Refactor this into one method\n\t\tfor i in 2..12 do\n\t\t\toc_xx = \"oc%02d_xx\" % i\n\t\t\tpoints[oc_xx.to_sym] = 0\n\t\t\ti += 1\n\t\tend\n\t\t\n \t\tpoints[:oc_ropes_roll_probability] = 0\n \t\tpoints[:ropes_s_roll_probability] = 0\n\n \t\t# TODO: Refactor this into one method\n \t\tfor i in 2..12 do\n\t\t\tr_points = \"ro%02d_points\" % i\n\t\t\tpoints[r_points.to_sym] = 0\n\t\t\ti += 1\n\t\tend\n\n\t\t# TODO: Refactor this into one method\n\t\tfor i in 2..12 do\n\t\t\tr_dq = \"ro%02d_dq\" % i\n\t\t\tpoints[r_dq.to_sym] = 0\n\t\t\ti += 1\n\t\tend\n\n\t\t# TODO: Refactor this into one method\n\t\tfor i in 2..12 do\n\t\t\tr_pa = \"ro%02d_pa\" % i\n\t\t\tpoints[r_pa.to_sym] = 0\n\t\t\ti += 1\n\t\tend\n\n\t\t# TODO: Refactor this into one method\n\t\tfor i in 2..12 do\n\t\t\tr_sub = \"ro%02d_sub\" % i\n\t\t\tpoints[r_sub.to_sym] = 0\n\t\t\ti += 1\n\t\tend\n\n\t\t# TODO: Refactor this into one method\n\t\tfor i in 2..12 do\n\t\t\tr_xx = \"ro%02d_xx\" % i\n\t\t\tpoints[r_xx.to_sym] = 0\n\t\t\ti += 1\n\t\tend\n\n\t\tpoints[:sub_numerator] = 0\n\t\tpoints[:tag_save_numerator] = 0\n\n\t\t# Determine Points for DC Rolls\n\t\tdc_hash = hash.select { |k,v| k.to_s.include?('dc') }\n\t\tdc_hash.each { | k,v|\n\t\t\tif v == \"A\"\n\t\t\t\tpoints[\"#{k}_points\".to_sym] = DC_A\n\t\t\telsif v == \"C\"\n\t\t\t\tpoints[\"#{k}_points\".to_sym] = DC_C\n\t\t\telse\n\t\t\t\tpoints[\"#{k}_points\".to_sym] = DC_B\n\t\t\tend\n\t\t}\n\n\t\t# Calculate Reverse Roll in DC\n\t\treverse_roll = 0\n\t\tr_hash = hash.select { |k,v| k.to_s.include?('dc') && v.downcase.include?('reverse') }\n\t\tpoints[:reverse] = prob_points(r_hash)\n\n\t\t# Determine (S) Points\n\t\tpoints[:s1_points] = hash[:s1].split[0].to_i\n \t\tpoints[:s2_points] = hash[:s2].split[0].to_i\n \t\tpoints[:s3_points] = hash[:s3].split[0].to_i\n \t\tpoints[:s4_points] = hash[:s4].split[0].to_i\n \t\tpoints[:s5_points] = hash[:s5].split[0].to_i\n \t\tpoints[:s6_points] = hash[:s6].split[0].to_i\n\n \t\to_moves = hash.select { |k,v| k.to_s.include?('oc') }\n \t\to_moves.each { |k,v|\n \t\t\tkey = \"#{k}_points\".to_sym\n \t\t\tm = remove_move(v)\n \t\t\tpoints[key] = m\n \t\t}\n\n \t\tr_moves = hash.select { |k,v| k.to_s.include?('ro') }\n \t\tr_moves.each { |k,v|\n \t\t\tkey = \"#{k}_points\".to_sym\n \t\t\tm = remove_move(v)\n \t\t\tpoints[key] = m\n \t\t}\n\n \t\t# Get Specialty Roll Numerator in OC\n \t\ts = hash.select { |k,v| k.to_s.include?('oc') && v.include?('(S)') }\n \t\tpoints[:specialty_roll_enumerator_in_oc] = prob_points(s)\n \t\tpoints[:specialty_roll_probability_in_oc] = return_rational(points[:specialty_roll_enumerator_in_oc])\n\n \t\t# Get Specialty Roll Probability-DQ (x/6)\n \t\tpoints[:s_roll_prob_dq] = get_s_extra_values(hash, '(DQ)')\n \t\tpoints[:s_roll_prob_pa] = get_s_extra_values(hash, 'P/A')\n\t\tpoints[:s_roll_prob_sub] = get_s_extra_values(hash, '*')\n\t\tpoints[:s_roll_prob_xx] = get_s_extra_values(hash, '(xx)')\n \t\t\t\n\t\t# Find DQ, P/A, * and XX Values in OC and Ropes\n\t\t\n \t\tdq_hash = create_value_hash(hash, \"(DQ)\")\n \t\tpa_hash = create_value_hash(hash, \"P/A\")\n \t\tsub_hash = create_value_hash(hash, \"*\")\n \t\txx_hash = create_value_hash(hash, \"(xx)\")\n\n \t\tdq_hash.each { |k,v| \n \t\t\tkey = k.to_s + \"_dq\"\n \t\t\tpoints[key.to_sym] = 1\n \t\t}\n\n\t\tpa_hash.each { |k,v| \n \t\t\tkey = k.to_s + \"_pa\"\n \t\t\tpoints[key.to_sym] = 1\n \t\t} \t\n\n \t\tsub_hash.each { |k,v| \n \t\t\tkey = k.to_s + \"_sub\"\n \t\t\tpoints[key.to_sym] = 1\n \t\t}\n\n \t\txx_hash.each { |k,v| \n \t\t\tkey = k.to_s + \"_xx\"\n \t\t\tpoints[key.to_sym] = 1\n \t\t}\n\n \t\t# Determine Ropes Roll Enumerator\n \t\toc_ropes_hash = hash.select { |k,v| v == 'Ropes' }\n\n \t\tpoints[:oc_ropes_roll_probability] = prob_points(oc_ropes_hash)\n\n \t\t# Determine Enumerator of (S) rolls in Ropes\n \t\tropes_s_hash = hash.select { |k,v| k.to_s.include?(\"ro\") && v.include?('(S)') }\n \t\tpoints[:ropes_s_roll_probability] = prob_points(ropes_s_hash)\n\n \t\tpoints[:prioritys] = hash[:prioritys].to_i\n \t\tpoints[:priorityt] = hash[:priorityt].to_i\n\n \t\tpoints[:sub_numerator] = sub_tag_numerator(hash[:sub])\n \t\tpoints[:tag_save_numerator] = sub_tag_numerator(hash[:tag])\n\n \t\tpoints[:sub_prob] = return_rational(points[:sub_numerator]).to_f\n \t\tpoints[:tag_prob] = return_rational(points[:tag_save_numerator]).to_f\n\n\t\treturn points\n\tend",
"title": ""
},
{
"docid": "0251be052258652852e1afe054469dfc",
"score": "0.60448503",
"text": "def prob(x, u, o)\n f = (1/(Math.sqrt(2*Math::PI)*o.to_f))*(Math::E)**((((x.to_f - u.to_f)**2)/(2*o.to_f**2))*-1)\nend",
"title": ""
},
{
"docid": "0251be052258652852e1afe054469dfc",
"score": "0.60448503",
"text": "def prob(x, u, o)\n f = (1/(Math.sqrt(2*Math::PI)*o.to_f))*(Math::E)**((((x.to_f - u.to_f)**2)/(2*o.to_f**2))*-1)\nend",
"title": ""
},
{
"docid": "9ca2055e8f4f18a19819f291a8b9bd05",
"score": "0.6026681",
"text": "def calculate_probability_distribution\n\t\t\tnumber_of_possible_combinations = (@sides**@count)\n\t\t\t#puts \"Number of possible combinations: #{number_of_possible_combinations}\"\n\t\t\tresult = {}\n\t\t\t# weep softly: http://mathworld.wolfram.com/Dice.html\n\t\t\t(min..max).each { |p|\n\t\t\t\tif p > (max + min) / 2\n\t\t\t\t\tresult[p] = result[max - p + min]\n\t\t\t\telse\n\t\t\t\t\tthing = (BigDecimal.new(p - @count) / BigDecimal.new(@sides)).floor\n\n\t\t\t\t\tc = BigDecimal.new(0)\n\t\t\t\t\t((0..thing).each { |k|\n\t\t\t\t\t\tn1 = ((-1)**k) \n\t\t\t\t\t\tn2 = BigDecimal.new(Internal_Utilities::Math_Utilities.Choose(@count, k))\n\t\t\t\t\t\tn3 = BigDecimal.new(Internal_Utilities::Math_Utilities.Choose(p - (@sides * k) - 1, @count - 1))\t\t\t\t\t\t\n\t\t\t\t\t\tt = BigDecimal.new(n1 * n2 * n3)\n\n\t\t\t\t\t\tc += t\n\t\t\t\t\t})\n\n\t\t\t\t\t#result = result.abs\n\n\t\t\t\t\tresult[p] = BigDecimal.new(c) / BigDecimal.new(number_of_possible_combinations)\n\t\t\t\tend\n\n\t\t\t\t#puts \"\\tProbability of #{p}: #{@probability_distribution[p].add(0, 5).to_s('F')}\" \n\t\t\t}\n\t\t\t@probability_distribution = result\n\t\t\t#puts \"Sum of probability_distribution: \" + (@probability_distribution.inject(BigDecimal.new(0)) {|total, (k,v)| BigDecimal.new(total + v) }).add(0, 5).to_s('F')\n\t\tend",
"title": ""
},
{
"docid": "4dee985f8f9e9345ac82ee8bf017b99e",
"score": "0.60139036",
"text": "def calculate_points(master_pics, scoring_system = ScoringSystems.default)\n @points = 0\n pics.correct(master_pics).each do |pic|\n @points += pic.point_worth(scoring_system)\n end\n @points\n end",
"title": ""
},
{
"docid": "1dcb4ab9ea4c3780d4f82a889029a0b0",
"score": "0.59366477",
"text": "def points_payment\n\t\t(points || 0) * amount / 100\n\tend",
"title": ""
},
{
"docid": "95ffd6a827c256cd82b99ebd33c6571d",
"score": "0.5925271",
"text": "def calculate_dc_points_per_round_subtotal(hash, dc_prob)\n\t\t\t\n\t\t\t# Return sum of points per roll in DC\n\t\t\tx = 0\n\t\t\thash.each { |k,v|\n\t\t\t\tk = remove_attribute_from_key(k)\n\t\t\t\tx += v.to_f * calculate_probability(symbol_to_integer(k))/36.to_f\n\t\t\t}\n\n\t\t\t# Return Points per DC Roll * DC Roll Probability\n\t\t\treturn x\n\tend",
"title": ""
},
{
"docid": "2d313621a13cd5a719de8e0bacc2384f",
"score": "0.5874904",
"text": "def prob(nC,cC,temp)\n deltaE = nC - cC\n return Math.exp(-(deltaE)/temp)\nend",
"title": ""
},
{
"docid": "afa1942e5332917f3064c9763e6efca9",
"score": "0.58579475",
"text": "def score(dice)\n points = 0\n if straight?(dice)\n 1500\n elsif three_pairs?(dice)\n 750\n else\n points += three_of_kind2(dice)\n points += ones2(dice)\n points += fives2(dice)\n end\n end",
"title": ""
},
{
"docid": "30ed49bca498f54681b8f376dffc6053",
"score": "0.5837597",
"text": "def probability_of_success\n experience / 5.0\n end",
"title": ""
},
{
"docid": "eb3f9d99e8565522eafcbc9870048fe7",
"score": "0.57972795",
"text": "def change_from_plus2_probability(card)\n p = @stack.select { |c| c.figure == :wild4 || c.figure == :plus2 || c.figure == :reverse && c.color == card.color }.length.to_f\n @prob_cache[3000 + card.code] ||= has_card_with_property p\n end",
"title": ""
},
{
"docid": "4a55c0355737edf4ae9cde3c5c3dcae4",
"score": "0.57770294",
"text": "def obp \n\t\t# prevent divide by zero\n\t\tif (self[:at_bats] != 0)\t\t\n\t\t\t((self[:hits] + self[:walks] + self[:hit_by_pitch])/(self[:at_bats] + self[:walks] + self[:hit_by_pitch] + self[:sacrifice_flies].to_f)).round(3)\n\t\telse\n\t\t\t0\n\t\tend\n\tend",
"title": ""
},
{
"docid": "cb2851e957e3a3786e72a7ff36f7fa56",
"score": "0.5740926",
"text": "def point_scoring(structure)\n return structure.map { |key, values| eval(values[:assessment]) }.sum\n end",
"title": ""
},
{
"docid": "4ded5c0b3da4b6aa70f5edcf8280f635",
"score": "0.5735437",
"text": "def points\n\t\tpoints = 0\n\t\tassignments.each do |assignment|\n\t\t\tpoints += assignment.worth\n\t\tend\n\t\treturn points\n\tend",
"title": ""
},
{
"docid": "e666a23e5eabea31f3c9157ba63fb856",
"score": "0.572366",
"text": "def hw11_3()\n p = [0, 2]\n q = [15, 6]\n n = 23\n a = 1\n current = {:r => p, :a => 1, :b => 0}\n for i in (0..20)\n print \"$R_#{i}$ & (#{current[:r][0]}, #{current[:r][1]}) & #{current[:a]} & #{current[:b]} \\\\\\\\\\n\"\n if current[:r][1] < 9\n if current[:r][0] == p[0] && current[:r][1] == p[1]\n current[:r] = ec_double_point(current[:r][0], current[:r][1], n, a)\n else\n current[:r] = ec_add_point(current[:r][0], current[:r][1], p[0], p[1], n)\n end\n current[:a] += 1\n elsif current[:r][1] < 17\n current[:r] = ec_add_point(current[:r][0], current[:r][1], q[0], q[1], n)\n current[:b] += 1\n else\n current[:r] = ec_double_point(current[:r][0], current[:r][1], n, a)\n current[:a] *= 2\n current[:b] *= 2\n end\n end\n\n puts 27 * 4 % 29\n print ec_multiply_point(11, 9, 23, 1, 7)\n print \"\\n\"\n print ec_multiply_point(15, 6, 23, 1, 3)\nend",
"title": ""
},
{
"docid": "eda7b92b6807d398e641fc730bc1df3b",
"score": "0.56781507",
"text": "def calcScore(hand)\n return hand.inject(0) { |sum, n| sum + n.points }\nend",
"title": ""
},
{
"docid": "83d2f78ae68120eb3c911168f2868fba",
"score": "0.56739885",
"text": "def figure_change_probability(card)\n @prob_cache[card.color] + has_wild_probability - @prob_cache[card.color] * has_wild_probability\n end",
"title": ""
},
{
"docid": "4b820b8edc7d24aa301ab088d966006c",
"score": "0.5654847",
"text": "def check_points(cards)\n points = []\n point = 0\n\n cards.each do |card|\n if %w(J K Q).include?(card[:value])\n point += 10\n elsif card[:value] == 'A'\n point += 11\n else\n point += card[:value].to_i\n end\n end\n\n points << point if point <= 21\n\n cards.select { |ele| ele[:value] == 'A' }.count.times do\n point -= 10\n points << point if point <= 21\n end\n\n points\nend",
"title": ""
},
{
"docid": "4dbf3648d8f64b7977350ee6f44b980a",
"score": "0.56540203",
"text": "def pmt(pv, n, r)\n (pv*r)/(1.0 - 1/(1.0+r)**n)\nend",
"title": ""
},
{
"docid": "6ac3315eb45064d50748ef4f1e0802ce",
"score": "0.56455994",
"text": "def probA1(bit, sampleSum, remainingSamples, geneSum, remainingGenes, mutsRemaining, bitsRemaining)\n\n ar = sampleSum.to_f/remainingSamples.to_f\n ac = geneSum.to_f/remainingGenes.to_f\n a = mutsRemaining.to_f/bitsRemaining.to_f\n\n prob = nil\n if a == 1 #avoid division by zero problem in prob calculation\n prob = 1\n else\n prob = (ar*ac)/(a*(((1-ar)*(1-ac)/(1-a))+(ar*ac/a)))\n end\n\n #avoid division by zero problem in d calculation\n if prob == 1 \n prob = 0.999999\n elsif prob == 0\n prob = 0.000001\n end\n\n if bit == 1 \n return prob\n end\n return 1-prob\nend",
"title": ""
},
{
"docid": "49d21fc83c06e1e3c2e77d3be8a052bc",
"score": "0.5637413",
"text": "def probA0(bit)\n\n # not quite zero, to avoid paying infinitely large\n # penalty when calculating score (div by zero)\n if bit == 0\n return 0.999999\n else #bit == 1\n # This value can be used to tweak coverage vs\n # exclusivity of modules\n return 0.000005\n end\nend",
"title": ""
},
{
"docid": "129e7b00d8acc2490610f6805de63cd3",
"score": "0.5632811",
"text": "def pd\n if @pd.nil?\n @[email protected]{ [0] * @nc}\n [email protected]{ [0] * @nc}\n @nr.times do |i|\n @nc.times do |j|\n \n if i==@nr-1 and j==@nc-1\n @pd[i][j]=1.0\n else\n a=(i==@nr-1) ? 100: alpha[i]\n b=(j==@nc-1) ? 100: beta[j]\n #puts \"a:#{a} b:#{b}\"\n @pd[i][j]=Distribution::BivariateNormal.cdf(a, b, rho)\n end\n pc[i][j] = @pd[i][j]\n @pd[i][j] = @pd[i][j] - pc[i-1][j] if i>0\n @pd[i][j] = @pd[i][j] - pc[i][j-1] if j>0\n @pd[i][j] = @pd[i][j] + pc[i-1][j-1] if (i>0 and j>0)\n end\n end\n end\n @pd\n end",
"title": ""
},
{
"docid": "e1b699b407f7ac4880ea24a7f75ba7a9",
"score": "0.56281406",
"text": "def probability_of_pair r1, r2\n\t\tdistribution[r1] * distribution[r2]\n\tend",
"title": ""
},
{
"docid": "bd403e0abb77ddb37069b12ac464ece1",
"score": "0.5623113",
"text": "def probability\n return @probability\n end",
"title": ""
},
{
"docid": "73c5885d6424f99c923afd96bcb7f415",
"score": "0.56211716",
"text": "def points(prog); @points[@progs[prog]]; end",
"title": ""
},
{
"docid": "1414050bdaa2fb20c68ca7a552435f09",
"score": "0.5618003",
"text": "def points() \n\t\t(self.wins()*3+self.draws()) \n\tend",
"title": ""
},
{
"docid": "edb56488ce3928f7fdcf80c6ff027237",
"score": "0.5614685",
"text": "def points_formula(coeficient,number_of_teams,position, opponents)\n if position == 0\n return 0\n end\n opponent_rating = 0\n opponents.each do |opponent|\n opponent_rating += opponent.rating\n end\n opponent_rating /= Player.all_ratings\n \tp = (\n coeficient.to_f * number_of_teams.to_f / position * opponent_rating.to_f\n ).round 2\n p*100\n end",
"title": ""
},
{
"docid": "b2fefdb6d402bfdc6ee10a0e1da4726b",
"score": "0.5590953",
"text": "def calc_pv()\n i = @i / 100.0\n #Initial contribution\n pvf = @fv / ((1 + i) ** @n)\n #Present value of annuity\n pva = (@pmt/i) * (1-(1/((1+i)**@n)))\n @pv = (pvf + pva) * (-1)\n #Round\n @pv = (@pv*100).round / 100.0\n end",
"title": ""
},
{
"docid": "cd8f407cdd669b687d9d5dc551f17fd4",
"score": "0.55570805",
"text": "def points\n @puntos = 0\n students.each do |s| \n @puntos += s.points\n end\n @puntos += house_points\n end",
"title": ""
},
{
"docid": "0f1fb3fde5f9da188097500dfc610b46",
"score": "0.5555666",
"text": "def update_points(dealer_cards, player_cards, no_of_games = 0, points = [0, 0])\n player = 0\n dealer = 1\n result = detect_result(dealer_cards, player_cards)\n case result\n when :player_busted\n points[dealer] += 1\n when :dealer_busted\n points[player] += 1\n when :player\n points[player] += 1\n when :dealer\n points[dealer] += 1\n end\n\n points\nend",
"title": ""
},
{
"docid": "9d5b494d30607f99c74532453c0fe9f4",
"score": "0.5551674",
"text": "def simple_points(frames)\n all_rolls(frames).sum\n end",
"title": ""
},
{
"docid": "d9754282f21f6a32d851d2c7ee8f9d40",
"score": "0.55446476",
"text": "def por_prote\n\t\t\t(@proteinas/suma_gramos)*100\n\t\tend",
"title": ""
},
{
"docid": "dee9621c6156290a0a79f19de6d913e6",
"score": "0.5542052",
"text": "def pEstimate(sentence)\n probability = 1\n tokens = sentence.split\n (2..(tokens.size-1)).to_a.each do |i|\n probability *= q(tokens[i-2..i])\n end\n probability\n end",
"title": ""
},
{
"docid": "dee90215cca381e327f1114586ec653b",
"score": "0.5540599",
"text": "def adjourn_points_giocataend\r\n # at the end of the game remain to calculate the primiera\r\n player1 = @players[0]\r\n player2 = @players[1]\r\n hand1 = @carte_prese[player1.name]\r\n hand2 = @carte_prese[player2.name]\r\n prim_res_arr = calculate_primiera(hand1, hand2)\r\n @log.debug(\"Primiera of #{player1.name}:#{prim_res_arr[0]}, #{player2.name}: #{prim_res_arr[1]}\")\r\n # update points on all players\r\n ix = 0\r\n [player1, player2].each do |pl|\r\n points_info = @points_curr_segno[pl.name]\r\n points_info[:primiera] = prim_res_arr[ix]\r\n #calculate total\r\n tot = 0\r\n points_info.each do |k,v|\r\n next if k == :tot\r\n tot += v\r\n end\r\n points_info[:tot] = tot\r\n ix += 1\r\n end\r\n end",
"title": ""
},
{
"docid": "bed2236e3c8f65578ae7068c4851c1de",
"score": "0.55345213",
"text": "def assign_Prob(sign,parameters,probability)\n if @parents.length > 1\n lookArray = Array.new(parameters.split(',').length)\n parameters.split(',').each do |par_name|\n parSign = par_name[0]\n parName = par_name.gsub(/\\+/,'').gsub(/-/,'')\n Nodes.length.times do |nodePosition|\n if Nodes[nodePosition].get_Name == parName\n if parSign == '+'\n lookArray[nodePosition] = 1;\n else\n lookArray[nodePosition] = 0;\n end\n end\n end\n end\n end\n if @parents.length == 1\n parameters.split(',').each do |par_name|\n parSign = par_name[0]\n parName = par_name.gsub(/\\+/,'').gsub(/-/,'')\n Nodes.length.times do |nodePosition|\n if Nodes[nodePosition].get_Name == parName\n if parSign == '+'\n lookArray= 1;\n else\n lookArray= 0;\n end\n end\n end\n end\n end\n (2**@parents.length).times do |caso|\n f=true\n if @parents.length > 1\n @parents.length.times do |i|\n if @parMap[caso][i].to_i != lookArray[i].to_i\n f = false\n end\n end\n end\n if @parents.length == 1\n if @parMap[caso][0].to_i != lookArray.to_i\n f = false\n end\n end\n if f\n if sign=='+'\n @prob[caso][0]=probability\n @prob[caso][1]=(1.0 -probability).round(3)\n else\n @prob[caso][0]=1.0 -(probability).round(3)\n @prob[caso][1]=probability\n end\n end\n end\n #puts @prob\n #puts @name\n end",
"title": ""
},
{
"docid": "53edc5cf46768a7f20197c2185017fd2",
"score": "0.5532238",
"text": "def calculate\n player.combine_cards\n player.deck.each do |card|\n if card.is_a? Victory\n @points += card.points player\n end\n end\n self\n end",
"title": ""
},
{
"docid": "4de973d33015c608bc7c8d3900cde27c",
"score": "0.5524887",
"text": "def harrys_house_points(points_awarded, points_deducted)\n p \"Gryffindor has received #{points_awarded}.\"\n p \"However Gryffindor has lost #{points_deducted}.\"\n p \"Gryffindor has a total of #{points_awarded + points_deducted}!\"\nend",
"title": ""
},
{
"docid": "a96475941a4765f1c5921ea93baa3f8e",
"score": "0.55206585",
"text": "def conditional_probability\nend",
"title": ""
},
{
"docid": "7550db7d5ef2a23278251778b131e44b",
"score": "0.5512717",
"text": "def pEstimate(sentence)\n probability = 1\n tokens = sentence.split\n (2..(tokens.size-1)).to_a.each do |i|\n probability *= p(tokens[i-2..i])\n end\n probability\n end",
"title": ""
},
{
"docid": "a823e069f659725c66450a6fffd27277",
"score": "0.5509029",
"text": "def curve_points(points)\n cur_page.curve_points(points)\n end",
"title": ""
},
{
"docid": "f9e1a148df0398aac7e8e0c28e1943a3",
"score": "0.5492088",
"text": "def precipChance(info)\n\treturn info[\"currently\"][\"precipProbability\"]*100\nend",
"title": ""
},
{
"docid": "6a53e7f9e28376f25bc7775f0459a88a",
"score": "0.5488561",
"text": "def gain_points\n @score += 1\n end",
"title": ""
},
{
"docid": "e4fc74a4159643560c25a752a385da0e",
"score": "0.5486984",
"text": "def two_pt_pct\n return 0.0 if two_pt.zero? || two_pt_a.zero?\n\n (two_pt.to_f/two_pt_a).round(3)\n end",
"title": ""
},
{
"docid": "adcf47db2f4688a26c2157fa7fc733ec",
"score": "0.54836035",
"text": "def total_points\n if self.has_paid?\n sum = 0\n self.bets.each { |b| sum+=b.points }\n self.answers.each { |a| sum+=a.points }\n sum\n else\n -1\n end\n end",
"title": ""
},
{
"docid": "96df980922e6855ac4d1f9108d112c74",
"score": "0.54631746",
"text": "def pProteina \n\t\tprot = 0\n\t\ttotal = 0\n\t\[email protected] do |alimento|\n\t\t\ttotal += (alimento.proteinas + alimento.lipidos + alimento.carbohidratos)\n\t\t\tprot += alimento.proteinas\n\t\tend\n\t\treturn ((prot/total)*100).round\t\n\tend",
"title": ""
},
{
"docid": "6a57c7a8cecdbdfa3ad42c20ca01c078",
"score": "0.5459892",
"text": "def probability_of(move)\n # Can't move an enemy piece. This is the only rule that the bot knows a\n # priori.\n return 0.0 unless @most_alike_board.square_is_color? move.origin, @color\n\n # Directly return the probability of known moves without calculations.\n if @factor == 1.0\n play = move.plays.first(:board => @most_alike_board, :color => @color)\n if play\n return play.legal? ? 1.0 : 0.0\n end\n end\n\n bayes(move)\n end",
"title": ""
},
{
"docid": "928aaaa0275f476de354a2a9dadc1706",
"score": "0.54501754",
"text": "def points\n ((2 * base_points) / (1 + Math.exp(2 * (correct_answer - answer.to_f).abs))).to_i\n end",
"title": ""
},
{
"docid": "84c59baf6898abe8439d03fa4dbdbb03",
"score": "0.5448172",
"text": "def probability_exact\n\t\t str_format=\"%0#{nr}b\"\n\t\t combinations=2**nr\n\t\t #p str_format\n\t\t total_w=combinations.times.map do |i|\n comb=sprintf(str_format,i)\n w_local=comb.length.times.inject(0) do |ac,j|\n sgn=comb[j]==\"0\" ? -1 : 1\n\t\t\t\t ac+(j+1)*sgn\n end\n\t\t end.sort\n\n \t\t total_w.find_all do |v| \n if @tails==:both\n v<=-w.abs or v>=w.abs\n elsif @tails==:left\n v<=w\n elsif @tails==:right\n \t\t\t\t v>=w\n end\n \t\t end.count/(combinations.to_f)\n end",
"title": ""
},
{
"docid": "014ebb9d54d7a8b53454e1af09639e0a",
"score": "0.5447575",
"text": "def calculate\n # Percentage of understanding is calculated by following\n self.progress_rate = ((sum_of_point.to_f / total_count.to_f) * 100.00).round(2)\n end",
"title": ""
},
{
"docid": "2f30df66a82efabe8e32f967fc170dd0",
"score": "0.5436592",
"text": "def calculate_probability(useful_results, reroll_count)\n return 100.0 * useful_results / ( 6 ** reroll_count )\n end",
"title": ""
},
{
"docid": "15a3e6fb9b861a172917ba9f32348241",
"score": "0.54156214",
"text": "def givepoints \n x = comparison(@player_choice, @opponent_choice)\n if x == -1\n @player_score += 1\n elsif x == 0\n @player_score += 0\n @opponent_score += 0\n elsif x == 1\n @opponent_score += 1\n end \n return x\n end",
"title": ""
},
{
"docid": "54cb4de7a55d59d56f99025a3b7aff9a",
"score": "0.540572",
"text": "def score\n return 0 unless valid?\n 100 * card_value_decimal * 15 ** 5\n end",
"title": ""
},
{
"docid": "0baa0239e13313ed34a92820664d5267",
"score": "0.53967524",
"text": "def calculate_primiera(hand1, hand2)\r\n res = [0,0]\r\n #p hand1\r\n #p hand2\r\n # first get the max card on each suit\r\n max_pt = []\r\n [hand1, hand2].each do |curr_hand|\r\n # reset max\r\n max_pt << {:D => 0, :B => 0, :C => 0, :S => 0 }\r\n curr_hand.each do |lbl|\r\n points = @deck_information.get_card_points(lbl)\r\n suit = @deck_information.get_card_segno(lbl)\r\n if points > max_pt.last[suit]\r\n # max on suit\r\n max_pt.last[suit] = points\r\n end\r\n end\r\n #p max_pt.last\r\n end\r\n # using inject, 0 is the first value of the accumulator sum, tha assume the\r\n # value of the block provided. x assume each value of the max_pt.first\r\n # x becomes a pair like max_pt.first.each{|k,v|}. For example x = [:S, 21]\r\n arr_sum_points = []\r\n max_pt.each do |maxitem|\r\n arr_sum_points << maxitem.inject(0) do |sum, x|\r\n if x[1] > 0 and sum >= 0 \r\n sum + x[1]\r\n else\r\n # this is a particular case, we don't have points on a particular suit\r\n # in this case there is no primiera. Then stay on -1.\r\n sum = -1\r\n end\r\n end\r\n end\r\n #p arr_sum_points\r\n if arr_sum_points[0] > arr_sum_points[1]\r\n #primiera on the first hand\r\n res[0] = 1\r\n res[1] = 0\r\n elsif arr_sum_points[0] == arr_sum_points[1]\r\n # same points, primiera is not assigned\r\n res[0] = 0\r\n res[1] = 0\r\n else\r\n #primiera on the second hand\r\n res[0] = 0\r\n res[1] = 1\r\n end \r\n #p res\r\n return res\r\n end",
"title": ""
},
{
"docid": "5c01aacd07e79a2ea1f8ecd764562702",
"score": "0.5391909",
"text": "def score(dice)\n @num = @points = 0 # Number of points\n dice = dice.sort! # Sort the array\n @len = dice.length\n #puts dice\n #puts @len\n if [] == dice\n #puts \"Score: 0\"\n return 0\n end \n while @num < @len\n @num_curr = dice.count(dice[@num])\n #puts @num_curr\n if 1 == dice[@num]\n if @num_curr >= 3\n @points += 1000 # Add 1000 points\n @points += 100 * (@num_curr - 3) # Add 100x\n else \n @points += 100 * @num_curr # Add 100x\n end\n @num += @num_curr # Push forward num\n elsif 5 == dice[@num]\n if @num_curr >= 3\n @points += 500 # Add 500 points\n @points += 50 * (@num_curr - 3) # Add 50x \n else \n @points += 50 * @num_curr # Add 50x \n end\n @num += @num_curr # Push forward num\n else\n if @num_curr >= 3\n @points += 100*dice[@num] # Add 100*n\n end \n @num += @num_curr # Push forward num\n end \n end \n return @points\nend",
"title": ""
},
{
"docid": "cf8836067f223221bab652762b8b8fa2",
"score": "0.5386971",
"text": "def porcentaje_proteinas\n auxNodo1 = @lista_alimentos.head\n auxNodo2 = @gramos.head\n porcentaje_prot = 0\n while(auxNodo1 != nil && auxNodo2 != nil)\n porcentaje_prot += (auxNodo1.value.proteinas * auxNodo2.value) / 100\n auxNodo1 = auxNodo1.next\n auxNodo2 = auxNodo2.next\n end\n return porcentaje_prot.round(1)\n end",
"title": ""
},
{
"docid": "3e8c7a14adc05954ddc7b235f3c251c6",
"score": "0.53825647",
"text": "def points; end",
"title": ""
},
{
"docid": "dd6308bd7482166f72d84330c49ab92e",
"score": "0.53818345",
"text": "def prize\n return nil if self.performance.category.kimu?\n\n # Try to match points to a prize range for the contest round\n JUMU_PRIZE_POINT_RANGES[self.performance.contest.round - 1].each do |prize, point_range|\n if point_range.include?(self.points)\n return prize\n end\n end\n # Points not found in any prize range\n return nil\n end",
"title": ""
},
{
"docid": "997482f84809ce2d1db1e6ab0069941a",
"score": "0.53814393",
"text": "def calculate_probability\n calculate_probability ||= if @value.positive?\n 100.0 / (@value + 100)\n else\n [email protected]_f / (100 - @value)\n end\n end",
"title": ""
},
{
"docid": "f3307400495c85615d9750629a1d66b8",
"score": "0.53745025",
"text": "def score\n if (@deuce == false && @advantage == false)\n @score[@points]\n elsif @deuce\n 'deuce'\n elsif @advantage\n 'advantage'\n end\n \n end",
"title": ""
},
{
"docid": "564c830f00bb020121d4924c41591fe6",
"score": "0.53713405",
"text": "def score(dice)\n\n points = 0\n \n # iterate through each eye of the dice\n [1, 2, 3, 4, 5, 6].each do |eyes|\n \n count = dice.count(eyes)\n\n case eyes\n when 1\n count >= 3 ? points += 1000 + (100 * (dice.count(1) - 3)) : points += ( dice.count(1) * 100 )\n when 5 \n points += ( 500 + ((count - 3) * 50) ) if count >= 3\n points += (count * 50) if count < 3\n else\n points += (eyes * 100) if count >=3\n end\n end\n\n return points\nend",
"title": ""
},
{
"docid": "4d4c3ff8364f68dabf4966a67fbe4570",
"score": "0.5366421",
"text": "def give_point\n if@current_player == @player1\n @p1_score += 1\n else\n @p2_score += 1\n end\nend",
"title": ""
},
{
"docid": "6e669b8795498d623c6b5102b461f99b",
"score": "0.53662455",
"text": "def probability\n rand(1..100)\n end",
"title": ""
},
{
"docid": "2f81db92ded521494afecd25cf263970",
"score": "0.53591377",
"text": "def score\n return @score if @score != -1\n prod =\n [p_bases_covered, 0.01].max.to_f * # proportion of bases covered\n [p_not_segmented, 0.01].max.to_f * # prob contig has 0 changepoints\n [p_good, 0.01].max.to_f * # proportion of reads that mapped good\n [p_seq_true, 0.01].max.to_f # scaled 1 - mean per-base edit distance\n @score = [prod, 0.01].max\n end",
"title": ""
},
{
"docid": "10e43ec40cbb97f3da35447a554924b3",
"score": "0.53478277",
"text": "def determine_score\n point1 = @player1.points\n point2 = @player2.points\n\n if point1 > 2 and point2 > 2\n if point1 == point2\n @player1.deuce = true\n @player2.deuce = true\n elsif point1 > point2\n @player1.advantage = true\n elsif point2 > point1\n @player2.advantage = true\n end\n end\n end",
"title": ""
},
{
"docid": "d8ae7f8bd2ce54e5522483cb5ba6d2b9",
"score": "0.5346381",
"text": "def has_card_with_property(p_no_of_cards, adversary = nil)\n adversary ||= default_adversary\n k = adversary.card_count\n n = @stack.length\n p = p_no_of_cards\n\n # calculate by inverse probability, i.e. probability that he has no cards with property p\n # 1 - (n-p)/n * (n-1-p)*(n-1) ...\n 1.0 - (0..(k - 1)).reduce(1) { |prod, i| prod * (1.0 * n - p - i) / (1.0 * n - i) }\n end",
"title": ""
},
{
"docid": "f4c4e63dce1442bf850fb7bbba2ac8d6",
"score": "0.53421915",
"text": "def calculate_total(cards_of_player, cards_of_dealer)\n total_points=[]\n total_points[0] = calculate_points(cards_of_player)\n total_points[1] = calculate_points(cards_of_dealer)\n total_points\nend",
"title": ""
},
{
"docid": "6a5bff5c7dd31747280a19e857a13a3e",
"score": "0.5340552",
"text": "def output_scores (p1, p2) \n puts \"P1: #{p1.remaining_lives} / 3 VS P2: #{p2.remaining_lives} / 3\"\n end",
"title": ""
},
{
"docid": "39d0eaadc8924fdff93e45a539960173",
"score": "0.5337507",
"text": "def prob(n)\n n = n\n x = n/2\n as, ae = fact_sig_exp(n)\n bs, be = fact_sig_exp(x)\n bs *= bs\n be *= 2\n cs, ce = power_sig_exp(2, n)\n\n s = as / bs / cs\n e = ae - be - ce\n s*10**e\nend",
"title": ""
},
{
"docid": "3cfa988320e1bcef6e03a6c6178ed20a",
"score": "0.53323305",
"text": "def get_gpa(current_qps: , current_gpa_hours:, remaining_grade_distribution:)\n #Add more grades if neccessary\n grade_transitions = {A: 16, Aminus: 14.668, Bplus: 13.332, B: 12}\n remaining_gpa_hours = remaining_grade_distribution.length * 4\n sum_of_new_grades = 0\n remaining_grade_distribution.each {|x| sum_of_new_grades+= grade_transitions[x]}\n\n # \"+ 4\" quality points and \"+1\" gpa hours for eloquent presenter assuming a get an A --> I removed this\n print((current_qps + sum_of_new_grades)/(current_gpa_hours + remaining_gpa_hours))\nend",
"title": ""
},
{
"docid": "079de4b1390b81ebb1f313b4852e773f",
"score": "0.53303045",
"text": "def poisson_calc(expected, prng) #expected number of occurences\n\t\tl = Math.exp(-expected) #(P|X = 0) \n\t\tk = 0.0 #(number of occurences)\n\t\tp = 1.0 #The product of the urandoms\n\t\tk = 1.0 unless p > l # need because 1.0 !> 1.0\n\t\twhile p > l \n\t\t\tu = prng.rand\n\t\t\tp *= u\n\t\t\tk += 1 \n\t\tend\n\t (k - 1)\n\tend",
"title": ""
},
{
"docid": "3cb54536f955d4a6f72abb9a94c23305",
"score": "0.53215146",
"text": "def calc_obp\n obp = (hits.to_f + walks.to_f + hbp.to_f) / (bats.to_f + walks.to_f + hbp.to_f+ sf.to_f)\n self.obp = obp\n end",
"title": ""
},
{
"docid": "3c4b719381c0f7440e26b30ed83213fc",
"score": "0.5320716",
"text": "def compute_performance_points(standard_points, decimals)\n score_calculator = ScoreCalculator.new(@season, @gender_type, @category_type, @pool_type, @event_type)\n score_calculator.get_custom_score(@meeting_individual_result.get_timing_instance, standard_points, decimals)\n end",
"title": ""
},
{
"docid": "129a51db821fa6d352142f942756dac3",
"score": "0.5318758",
"text": "def current_pts\n self.score\n end",
"title": ""
},
{
"docid": "479c8e360027999c1f8684df1df1af88",
"score": "0.53136647",
"text": "def score(for_frames:)\n simple_points(for_frames) + total_bonus(for_frames)\n end",
"title": ""
},
{
"docid": "6d4ed67eac7b04217b886b0d53075f08",
"score": "0.5305461",
"text": "def get_protein_probability(protein_node)\n\n\t\t#MS:1002403\n\t\tis_group_representative=(self.get_cvParam(protein_node,\"MS:1002403\")!=nil)\n\t\tif is_group_representative\n\t\t\treturn \tself.get_cvParam(protein_node.parent,\"MS:1002470\").attributes['value'].to_f*0.01\n\t\telse\n\t\t\treturn 0\n\t\tend\n\tend",
"title": ""
},
{
"docid": "37c6aaebd48e61648fa4d86645e4e5ee",
"score": "0.53029335",
"text": "def points\n return 0 if event.trial? || event.trialed?\n\n points_if_not_trial\n end",
"title": ""
},
{
"docid": "cdf95bf05468a859675c14fac6a93b62",
"score": "0.53012043",
"text": "def points\n 1\n end",
"title": ""
},
{
"docid": "56d05fed37a3792e9a945a7b728bfdff",
"score": "0.5289495",
"text": "def probability_for_side(side)\n equal_sides = sides.select { |s| s == side }\n\n equal_sides.map(&:weight).reduce(:+).to_f / weight.to_f\n end",
"title": ""
},
{
"docid": "5bc70c3fb399a9b8f6707376845195fb",
"score": "0.52852714",
"text": "def my_points(distances,paths,x_s,subroutines=nil)\n if distances.uniq == distances\n sorted = distances.sort\n end\n points = Array.new(x_s.count){0}\n\n i = 0\n my_dists = []\n my_points = []\n while points != Array.new(x_s.count){2} && sorted[i] != nil\n p1, p2 = paths[distances.index(sorted[i])]\n \n usable = true\n if subroutines\n subroutines.each do |sub|\n if sub.has_how_many_points_in(my_points) >= (sub.count - 1)\n usable = false\n end\n end\n end\n \n if points[p1] < 2 && points[p2] < 2 && usable\n my_dists << sorted[i]\n my_points << [p1,p2]\n points[p1] += 1\n points[p2] += 1\n p points\n p my_points\n puts\n end\n if (i + 1) < sorted.count\n i += 1\n else\n i = 0\n end\n end\n [my_points, my_dists]\nend",
"title": ""
},
{
"docid": "b77d9d1c7c955102d6848e7fe1cfcbd7",
"score": "0.52822876",
"text": "def dna_profile_probability(dna, profile)\n # Given the profile matrix, figure out the probability of a given DNA string\n # Profile\n # A: .2 .2 0 0 0 0 .9 .1 .1 .1 .3 0 \n # C: .1 .6 0 0 0 0 0 .4 .1 .2 .4 .6 \n # G: 0 0 1 1 .9 .9 .1 0 0 0 0 0 \n # T: .7 .2 0 0 .1 .1 0 .5 .8 .7 .3 .4 \n\n # Consensus \n # T C G G G G A T T T C C \n\n # Pr(TCGGGGATTTCC | Profile) = 0.7 · 0.6 · 1.0 · 1.0 · 0.9 · 0.9 · 0.9 · 0.5 · 0.8 · 0.7 · 0.4 · 0.6 = 0.0205753 \n\n # Lets have a row index map for quick access in the matrix\n dna_to_row = {\"A\" => 0, \"C\" => 1, \"G\" => 2, \"T\" => 3}\n\n prob = 1.0\n (0..(dna.length-1)).each do |j|\n # puts dna[j]\n # puts dna_to_row[dna[j]]\n prob *= profile.element(dna_to_row[dna[j]],j)\n end\n\n return prob\n end",
"title": ""
},
{
"docid": "c896810d869903a39fb994f23ce03b19",
"score": "0.5266643",
"text": "def compute_point(order, point, producers)\n # Optimisation: This is order-dependent; it requires that always-on\n # producers are before the transient producers, otherwise \"remaining\"\n # load will not be correct.\n #\n # Since this method is called a lot, being able to handle always-on and\n # transient producers in separate loops allows us to skip calling\n # #always_on? in every iteration. This accounts for a 20% reduction in\n # the calculation runtime.\n\n if (remaining = demand(order, point)) < 0\n raise SubZeroDemand.new(point, remaining)\n end\n\n producers.always_on(point).each do |producer|\n remaining -= producer.max_load_at(point)\n end\n\n # Ignore the possibility for a Resortable to be delivered as the third\n # method argument. We're going to resort the transients anyway.\n transients = order.participants.transients(point)\n .sort_by { |transient| Convergence.producer_cost(transient, point) }\n\n while producer = transients.shift do\n max_load = producer.max_load_at(point)\n\n # Optimisation: Load points default to zero, skipping to the next\n # iteration is faster then running the comparison / load_curve#set.\n next if max_load.zero?\n\n current = producer.load_curve.get(point)\n headroom = max_load - current\n chunk = producer.output_capacity_per_unit\n remaining = 0 if remaining < 1e-10\n\n next if headroom.zero?\n\n if headroom <= remaining && headroom < chunk\n # Strangely the producer has less than one unit of capacity left. We\n # assign it to the maximum load.\n add_load(producer, point, headroom)\n remaining -= headroom\n elsif remaining > chunk\n # Assign load equal to the size of one plant.\n add_load(producer, point, chunk)\n remaining -= chunk\n\n # Add the plant back to the collection. Determining the index of the\n # first producer which is more expensive -- and inserting before\n # that producer -- is 2x faster than resorting the list entirely.\n insert_at = transients.index do |other|\n Convergence.producer_cost(other, point) >=\n Convergence.producer_cost(producer, point)\n end\n\n transients.insert(insert_at || transients.length, producer)\n else\n # There is less total load remaining to be assigned than the\n # capacity of a new plant.\n add_load(producer, point, remaining) if remaining > 0\n\n assign_price_setting(order, producer, point)\n\n # Optimisation: If all of the demand has been accounted for, there\n # is no need to waste time with further iterations and expensive\n # calls to Producer#max_load_at.\n break\n end\n end\n end",
"title": ""
},
{
"docid": "e07fba5cb7f38cfd913b4a63412ace59",
"score": "0.5264443",
"text": "def calculate_player_points\n # Sort the teams by points in descending order. This way, the output will\n # follow the teams' finishing order, which will be easier to read.\n @teams.sort_by(&:points).reverse_each do |team|\n puts \"Awarding #{team.points} points to #{team.name}: \" +\n @players[team.id].map(&:to_s).join(\", \")\n\n @players[team.id].each do |player|\n player.points = team.points\n end\n end\n end",
"title": ""
},
{
"docid": "9e57ba10a1dfb252285ea09e54143a0f",
"score": "0.5256405",
"text": "def score votes, prior=DEFAULT_PRIOR\n posterior = votes.zip(prior).map { |a, b| a + b }\n sum = posterior.inject { |a, b| a + b }\n puts sum\n posterior.\n map.with_index { |v, i| (i + 1) * v }.\n inject { |a, b| a + b }.\n to_f / sum\nend",
"title": ""
},
{
"docid": "2e7101478c93e76826c870cb2048c100",
"score": "0.5255116",
"text": "def competitor_placing_points(competitor, judge_type)\n sc = scoring_calculator\n if sc.nil?\n 0\n else\n sc.total_points(competitor, judge_type)\n end\n end",
"title": ""
},
{
"docid": "678ef65aa7341cf58fea3dfaab37aaff",
"score": "0.5253085",
"text": "def point_value\n return 500 if flush?\n return 300 if three_kind?\n return 200 if two_kind?\n return highest_card.numeric_rank\n end",
"title": ""
},
{
"docid": "6018f2ae210c8c4c0fd6a58b10b99050",
"score": "0.52518636",
"text": "def probability_z\n\t\t (1-Distribution::Normal.cdf(z))*(@tails==:both ? 2:1)\n end",
"title": ""
},
{
"docid": "7c9f7437c08de2d28451836ccd15a372",
"score": "0.5249921",
"text": "def points\n deal_points = tricks_points @tricks\n\n if not deal_points.inside? bid_said_by_team\n deal_points.add_points_to(bid_said_by_team, MatchPoints::VALAT_BONUS) if valat?\n\n if not @mode.is_a? DoubleMode\n @mode.match_points deal_points\n else\n Points.zeros[bid_said_by_team] = doubling_points deal_points, @mode\n end\n elsif deal_points.inside? bid_said_by_team\n deal_points.add_points_to(opposing_team, MatchPoints::VALAT_BONUS) if valat?\n\n Points.zeros[opposing_team] = doubling_points deal_points, @mode\n elsif deal_points.hanging?\n if not @mode.is_a? DoubleMode\n @mode.match_points deal_points\n else\n doubled_points = doubling_points deal_points, @mode\n\n result = Points.zeros\n result[bid_said_by_team] = doubled_points / 2\n resutl[opposing_team] = doubled_points / 2\n\n result\n end\n end\n end",
"title": ""
},
{
"docid": "a06cc79053282776fdb3815c6eca0157",
"score": "0.52457875",
"text": "def points\n made? ? (made_contract_points + overtrick_points + bonus) : undertrick_points\n end",
"title": ""
},
{
"docid": "d5d887fe17feaf8038def808fa910c61",
"score": "0.5244471",
"text": "def calculate_joint_factor(singlePV,spousePV,jointPV,js_type,js_pct)\n case js_type\n when 0.0\n singlePV\n when 1.0\n singlePV + js_pct * (spousePV - jointPV)\n when 2.0\n (js_pct * singlePV) + (js_pct * spousePV) + ((1.0-(2.0* js_pct)) * jointPV)\n when 3.0\n singlePV + js_pct * singlePV * (spousePV - jointPV) / jointPV\n when 4.0\n jointPV\n else\n singlePV\n end\n end",
"title": ""
},
{
"docid": "a7619ebd38d2731865df0443a276fda4",
"score": "0.5243727",
"text": "def test(points, r1, r2)\n points = points.map do |pair, response|\n [response[:asks][0][\"price\"], response[:bids][0][\"price\"]]\n end.flatten\n\n puts \"UEBU correct\" if r1 == 1000 / points[0] * points[3] * points[5]\n puts \"UBEU correct\" if r2 == 1000 / points[4] / points[2] * points[1]\n end",
"title": ""
},
{
"docid": "d8e3dc28fb517ea3b928d64eec0daf80",
"score": "0.5242521",
"text": "def score\n\t\tpontos = 0\n\t\tindex = 0\n\t\twhile (index < 20 && @rolls[index]) do\n\t\t\tif strike? index\n\t\t\t\tpontos += pontosStrike (index)\n\t\t\telsif spare? index\n\t\t\t\tpontos += pontosSpare (index)\n\t\t\telsif @rolls[index + 1]\n\t\t\t\tpontos += @rolls[index] + @rolls[index + 1]\n\t\t\telse\n\t\t\t\tpontos += @rolls[index]\n\t\t\tend\n\t\t\tindex += 2\n\t\tend\n\t\tpontos\n\tend",
"title": ""
},
{
"docid": "34bc9839b1fa6fc9a1f741914bd87a82",
"score": "0.52406424",
"text": "def probability_of_collision k, n\n 1 - Math.exp((-k**2.0) / (2.0 * n))\n end",
"title": ""
},
{
"docid": "c044a020788b99d99567251a9be0e746",
"score": "0.523305",
"text": "def calculate_probability\n @value.denominator.fdiv(@value.denominator + @value.numerator)\n end",
"title": ""
},
{
"docid": "ff95dd95a18a85767951aa787e04e6f6",
"score": "0.52287245",
"text": "def collision_probability(n)\n count = 2 ** n\n\n (count - 2)/count.to_f\nend",
"title": ""
},
{
"docid": "804e650138962819de304c65ee7e4eaa",
"score": "0.52269286",
"text": "def score\n # make a local array that will disappear when not in this method\n tally = []\n # for each of the cards in the hand, add their score to the tally from points\n @hand.each do |card|\n tally.push(@points[card])\n end\n # return the tally of the scores\n return tally.sum\nend",
"title": ""
},
{
"docid": "2e4b04f07641c72e0fba93341b22e5b0",
"score": "0.52227664",
"text": "def prot\n\t\tgrtotal = 0\n\t\tsum = 0\n\t\t#itera en las dos listas a la vez para poder calcular las\n\t\t#proteinas dependiendo de la cantidad y tambien suma\n\t\t#todas las cantidades para poder calcular el porcentaje\n\t\t#despues\n\t\[email protected](@listagr).each do |normal, gr|\n\t\t\tgrtotal += gr\n\t\t\tcant = gr/1000.0\n\t\t\tsum += normal.prot*cant \n\t\tend\n\t\t(sum*100)/grtotal\n\tend",
"title": ""
},
{
"docid": "b2cdde46f0293549b26d1b0763e7216f",
"score": "0.52129704",
"text": "def points\n return 0 if match.invalid_result?\n return 4 if self.score == match.score\n return 3 if self.goals_diff == match.goals_diff\n return 2 if self.winner == match.winner\n return 0\n end",
"title": ""
},
{
"docid": "bcdd95d21eb4e0933b798282abfc32ca",
"score": "0.5211766",
"text": "def points\n self.votes.inject(0) { |points, vote| points + vote.value }\n end",
"title": ""
},
{
"docid": "bcdd95d21eb4e0933b798282abfc32ca",
"score": "0.5211766",
"text": "def points\n self.votes.inject(0) { |points, vote| points + vote.value }\n end",
"title": ""
},
{
"docid": "4c19182b44cab3c277eef99b2562bacd",
"score": "0.5207012",
"text": "def probability_s\n return @probability_s\n end",
"title": ""
}
] |
122a8fe36cdf5fc9ec3efc32cbecb0f6
|
POST /official_identities POST /official_identities.json
|
[
{
"docid": "10ab00c084fd45a13fc4d925c5918554",
"score": "0.6723793",
"text": "def create\n @official_identity = OfficialIdentity.new(official_identity_params)\n\n respond_to do |format|\n if @official_identity.save\n format.html { redirect_to @official_identity, notice: 'Official identity was successfully created.' }\n format.json { render :show, status: :created, location: @official_identity }\n else\n format.html { render :new }\n format.json { render json: @official_identity.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "fabe317f43fdfd3f315cc910d2bdc191",
"score": "0.64103466",
"text": "def index\n @official_identities = OfficialIdentity.all\n end",
"title": ""
},
{
"docid": "18b67780753362a8a39bde15ca235604",
"score": "0.59002614",
"text": "def set_official_identity\n @official_identity = OfficialIdentity.find(params[:id])\n end",
"title": ""
},
{
"docid": "52a821dcac8c29b4df09e194d8c2fdd1",
"score": "0.57985276",
"text": "def update\n respond_to do |format|\n if @official_identity.update(official_identity_params)\n format.html { redirect_to @official_identity, notice: 'Official identity was successfully updated.' }\n format.json { render :show, status: :ok, location: @official_identity }\n else\n format.html { render :edit }\n format.json { render json: @official_identity.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "85a0ac5af220c5eb1c3e788956c3915c",
"score": "0.56476396",
"text": "def create\n @official = Official.new(params[:official])\n\n respond_to do |format|\n if @official.save\n format.html { redirect_to @official, notice: 'Official was successfully created.' }\n format.json { render json: @official, status: :created, location: @official }\n else\n format.html { render action: \"new\" }\n format.json { render json: @official.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "85a0ac5af220c5eb1c3e788956c3915c",
"score": "0.56476396",
"text": "def create\n @official = Official.new(params[:official])\n\n respond_to do |format|\n if @official.save\n format.html { redirect_to @official, notice: 'Official was successfully created.' }\n format.json { render json: @official, status: :created, location: @official }\n else\n format.html { render action: \"new\" }\n format.json { render json: @official.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7df7e4fc510992ebf3ab200f05883fdc",
"score": "0.56359607",
"text": "def official_identity_params\n params.require(:official_identity).permit(:user_id, :name, :note, :edited_by, :image1)\n end",
"title": ""
},
{
"docid": "4c597d16f051052aefcc6676ac713554",
"score": "0.5617506",
"text": "def create\n @official = Official.new(official_params)\n\n respond_to do |format|\n if @official.save\n format.html { redirect_to @official, notice: 'Official was successfully created.' }\n format.json { render :show, status: :created, location: @official }\n else\n format.html { render :new }\n format.json { render json: @official.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "07125fd4daef9a4766df221ada53d2fc",
"score": "0.5498823",
"text": "def create\n @individual_identity = IndividualIdentity.new(individual_identity_params)\n\n respond_to do |format|\n if @individual_identity.save\n format.html { redirect_to @individual_identity, notice: 'Individual identity was successfully created.' }\n format.json { render :show, status: :created, location: @individual_identity }\n else\n format.html { render :new }\n format.json { render json: @individual_identity.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4fc1cc8b692326ae63b151670f140b78",
"score": "0.54052126",
"text": "def create\n @company = current_user.create_company(company_params)\n industry_id = company_params[:industry_ids]\n \n if industry_id.empty? || industry_id.nil?\n @company.valid?\n render :action => \"new\"\n return\n else\n @company.industries << Industry.find(company_params[:industry_ids])\n end\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to your_solutions_company_path(@company), notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2d0f10d7e53c750859aa8fea29e847a8",
"score": "0.5400799",
"text": "def create\n \t@user = User.find(params[:user_id])\n @identity = @user.identities.new(params[:identity])\n authorize! :create, @identity\n\n respond_to do |format|\n if @identity.save\n format.html { redirect_to @user, notice: 'Identity was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @identity.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8d3f60ea9a83e4ad49e0b3e431bad61b",
"score": "0.5340744",
"text": "def create\n @authorized_representative = current_user.authorized_representatives\n .build(authorized_representative_params)\n\n respond_to do |format|\n if @authorized_representative.save\n format.html { redirect_to corporate_applications_personnel_url,\n notice: 'Authorized representative was successfully created.' }\n format.json { render :show, status: :created, location: @authorized_representative }\n else\n format.html { render :new }\n format.json { render json: @authorized_representative.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4d90e22dbeb9eefe97c79c2402da268c",
"score": "0.5322321",
"text": "def identification_params\n params.require(:identification).permit(:foid_type, :foid, :notes, \n :profile_id, :date_issued, :expiration_date, :issued_by, :description,\n :country, :sub_type, :visa_type, :entry_date, :max_stay, :doc_image)\n end",
"title": ""
},
{
"docid": "348df7fecee9b407c8acfe3db43b4696",
"score": "0.52998865",
"text": "def oenologist_params\n params.require(:oenologist).permit(:name, :age, :nationality, :editor, :writer, :reviewer, magazine_ids: [])\n end",
"title": ""
},
{
"docid": "ebf516b183347c0cb93333ef72ca68d0",
"score": "0.52625513",
"text": "def create\n @registration = Registration.new(registration_params)\n\n respond_to do |format|\n if @registration.save\n @registration.company.update_industries(params[:company_industries])\n format.html { redirect_to @registration, notice: 'Registration was successfully created.' }\n format.json { render action: 'show', status: :created, location: @registration }\n else\n format.html { render action: 'new' }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "58240c70dcbc6203177a455834524cd4",
"score": "0.52337426",
"text": "def create\n #parse tag_ids\n params[:incident][:tag_ids] = params[:incident][:tag_ids].split(\",\");\n @incident = Incident.new(params[:incident])\n @incident.creator_id = current_user.id #set incident creator\n\n respond_to do |format|\n if @incident.save\n format.html { redirect_to @incident, notice: 'Incident was successfully created.' }\n format.json { render json: @incident, status: :created, location: @incident }\n \n else\n format.html { render action: \"new\" }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "664b1ef76798601f19d66deb90229d93",
"score": "0.52303493",
"text": "def new\n @user = User.find(params[:user_id])\n @identity = @user.identities.new\n authorize! :new, @identity\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @identity }\n end\n end",
"title": ""
},
{
"docid": "6da59822809697df805e56dab54c2531",
"score": "0.52214116",
"text": "def create\n encounter_id, obs_archetypes = params.require %i[encounter_id observations]\n\n encounter = Encounter.find(encounter_id)\n\n observations = obs_archetypes.collect do |archetype|\n obs, _child_obs = service.create_observation(encounter, archetype.permit!)\n obs\n end\n\n render json: observations, status: :created\n end",
"title": ""
},
{
"docid": "e17c069637daf3d7d52b2e4d5ea0bf43",
"score": "0.52208793",
"text": "def create\n @resident = current_business.residents.new(resident_params)\n @resident.author_id = current_user.id\n\n respond_to do |format|\n if @resident.save\n format.html { redirect_to app_residents_path, notice: 'Resident was successfully created.' }\n format.json { render :show, status: :created, location: @resident }\n else\n format.html { render :new }\n format.json { render json: @resident.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d2b11c215c279d38637b2c4232b57b0e",
"score": "0.52174413",
"text": "def create\n @organization_innovation = OrganizationInnovation.new(organization_innovation_params)\n\n if @organization_innovation.save\n render json: @organization_innovation.to_json(:include => :innovations)\n else\n render json: @organization_innovation.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "5859f814c346db4594e15493b9098595",
"score": "0.52040845",
"text": "def create\n @oid = Oid.new(oid_params)\n\n respond_to do |format|\n if @oid.save\n format.html { redirect_to @oid, notice: 'Oid was successfully created.' }\n format.json { render action: 'show', status: :created, location: @oid }\n else\n format.html { render action: 'new' }\n format.json { render json: @oid.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "527a7278139628c360ea1bc1e8d30187",
"score": "0.51931113",
"text": "def create\n Rails.logger.info \"==========================\"\n Rails.logger.info request.raw_post\n Rails.logger.info \"==========================\"\n data = JSON.parse(request.raw_post).symbolize_keys\n ignore = [\"victims\", \"offenders\", \"attachments\"]\n incident_params = data[:incident]\n incident_params = incident_params.except(*ignore)\n @incident = Incident.new(incident_params)\n @incident.status = \"pending\"\n @incident.offender = \"N/A\"\n if @user\n @incident.user_id = @user.id\n end\n if @incident.save\n data[:incident][\"victims\"].each do |record|\n victim = Victim.new(record)\n victim.incident_id = @incident.id\n victim.save\n end\n data[:incident][\"offenders\"].each do |record|\n offender = Offender.new(record)\n offender.incident_id = @incident.id\n oc = Offendercategory.find_by_id(offender.offendercategory_id)\n if !oc\n Offendercategory.create(name: \"General\",id: offender.offendercategory_id)\n end\n offender.save\n end\n json_response(@incident)\n else\n render json: @incident.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "00388245b5b38e774da51ab191559dac",
"score": "0.51919514",
"text": "def destroy\n @official_identity.destroy\n respond_to do |format|\n format.html { redirect_to official_identities_url, notice: 'Official identity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f67a2e7b30ccf5496e6fe1db7b03ea71",
"score": "0.51904255",
"text": "def create\n @ag_resident = Ag::Resident.new(ag_resident_params)\n\n respond_to do |format|\n if @ag_resident.save\n format.html { redirect_to @ag_resident, notice: 'Resident was successfully created.' }\n format.json { render :show, status: :created, location: @ag_resident }\n else\n format.html { render :new }\n format.json { render json: @ag_resident.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0fae6ef9d544129f6d8c5186188aa497",
"score": "0.5183592",
"text": "def create\n @identifier = Identifier.new(params[:identifier])\n\n if @identifier.save\n # render json: @identifier, status: :created, location: @identifier\n render json: @identifier, status: :created\n else\n render json: @identifier.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "eb2b0f2346ee3130e9caa41518497ff7",
"score": "0.5166941",
"text": "def create\n @incident = Incident.new(incident_params)\n @user = User.joins(:userareas).where(\"userareas.area_id = #{@incident.area_id}\").sample\n respond_to do |format|\n if @incident.save!\n @incidentmanagement = Incidentmanagement.create(user: @user, incident: @incident)\n format.html { redirect_to incidents_path(@incident), notice: 'Incident was successfully created.' }\n format.json { render :show, status: :created, location: @incident }\n else\n format.html { render :new }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "096c8e055d6b1b5321f06f94cc72b23d",
"score": "0.5151069",
"text": "def create\n encounter_id, obs_archetypes = params.require %i[encounter_id observations]\n\n encounter = Encounter.find(encounter_id)\n\n observations = obs_archetypes.collect do |archetype|\n create_observation(archetype, encounter)[0]\n end\n\n render json: observations, status: :created\n end",
"title": ""
},
{
"docid": "779c10a65e2895864104f85cbe1a352b",
"score": "0.5150912",
"text": "def newincident\n @n = params[:name]\n @l = params[:location]\n\n @i = Incident.create(name: @n, location: @l, managers: current_user.id.to_s)\n\n @u = current_user\n @u.incident = @i.id\n\n @u.save\n @i.save\n end",
"title": ""
},
{
"docid": "8ed89a9dd9ce516169cb95051c3a97d4",
"score": "0.51487356",
"text": "def list_identities_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: IdentityApi.list_identities ...'\n end\n if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"per_page\"]\" when calling IdentityApi.list_identities, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'per_page'].nil? && opts[:'per_page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"per_page\"]\" when calling IdentityApi.list_identities, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling IdentityApi.list_identities, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/admin/identities'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'credentials_identifier'] = opts[:'credentials_identifier'] if !opts[:'credentials_identifier'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Array<Identity>'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['oryAccessToken']\n\n new_options = opts.merge(\n :operation => :\"IdentityApi.list_identities\",\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: IdentityApi#list_identities\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "2f5ce71be10d7d0eea22037fb9db1f5e",
"score": "0.5142952",
"text": "def identities=(value)\n @identities = value\n end",
"title": ""
},
{
"docid": "d0a444e795c811c3cd869e7245b1e905",
"score": "0.51396704",
"text": "def nonprofit_orgs_register\n end",
"title": ""
},
{
"docid": "e043835265357ffa64e6d6fae301165f",
"score": "0.51225674",
"text": "def official_params\n params.require(:official).permit(:official_first_name, :official_middle_name, :official_last_name, :official_position)\n end",
"title": ""
},
{
"docid": "b5bf0e465556f9c4b87ad19ee43ad0d8",
"score": "0.5110715",
"text": "def create\n @incident_investigator = IncidentInvestigator.new(params[:incident_investigator])\n\n respond_to do |format|\n if @incident_investigator.save\n format.html { redirect_to @incident_investigator, notice: 'Incident investigator was successfully created.' }\n format.json { render json: @incident_investigator, status: :created, location: @incident_investigator }\n else\n format.html { render action: \"new\" }\n format.json { render json: @incident_investigator.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0180f5538bb3c3cc697b21ac604e655b",
"score": "0.5104972",
"text": "def create_complete_incident(num_civilians = 1, num_officers = 1, general_info = {})\n create_partial_incident(:review, num_civilians, num_officers, general_info)\n expect(current_path).to end_with('/review')\n find_button('Send for review').click\n end",
"title": ""
},
{
"docid": "38cac6a533d593bdbea5f76cd07ebbe8",
"score": "0.51006895",
"text": "def users_resident_search terms={}\n call_path = \"users/residentSearch\"\n data = build_post_data(terms.to_json)\n perform_post(build_url(call_path), data)\n end",
"title": ""
},
{
"docid": "63b1d01147374b71a4905a677b292dd2",
"score": "0.51003784",
"text": "def openid_associate(request); end",
"title": ""
},
{
"docid": "34c15a1ea71050b7dea0c5b5653745e3",
"score": "0.50921726",
"text": "def create\n @official = Official.new(params[:official],:as => :admin)\n\n respond_to do |format|\n if @official.save\n format.html { redirect_to @official, notice: 'Official was successfully created.' }\n format.json { render json: @official, status: :created, location: @official }\n else\n format.html { render action: \"new\" }\n format.json { render json: @official.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8de96f8fe4bc6b137f24e0c94a92d514",
"score": "0.5070551",
"text": "def create\n @oenologist = Oenologist.new(oenologist_params)\n\n respond_to do |format|\n if @oenologist.save\n format.html { redirect_to @oenologist, notice: \"Oenologist was successfully created.\" }\n format.json { render :show, status: :created, location: @oenologist }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @oenologist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1ac78731416afa573d878905da10fde9",
"score": "0.5031426",
"text": "def create\n @incident = Incident.new(params[:incident])\n # probably will necessitate substantial json hacking around\n end",
"title": ""
},
{
"docid": "1fb7a925235aeb8eecfa17e9cbf53612",
"score": "0.50217736",
"text": "def create\n @resident = Resident.new(params[:resident])\n\n respond_to do |format|\n if @resident.save\n format.html { redirect_to @resident, notice: 'Resident was successfully created.' }\n format.json { render json: @resident, status: :created, location: @resident }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resident.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aea4d7fb23c8708ef096a3bfe0cd7204",
"score": "0.5018135",
"text": "def create\n @nationality = Nationality.new(nationality_params)\n\n respond_to do |format|\n if @nationality.save\n format.html { redirect_to @nationality, notice: 'Nationality was successfully created.' }\n format.json { render :show, status: :created, location: @nationality }\n else\n format.html { render :new }\n format.json { render json: @nationality.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1b2dd626781897d4671e62f693cda8e5",
"score": "0.5017204",
"text": "def create\n @industry = Industry.new(industry_params)\n\n respond_to do |format|\n if @industry.save\n format.html { redirect_to @industry, notice: 'Industry was successfully created.' }\n format.json { render :show, status: :created, location: @industry }\n else\n format.html { render :new }\n format.json { render json: @industry.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4400b48c66ca1126a3eda97d0d107633",
"score": "0.5016227",
"text": "def create\n @industry = Industry.new(params[:industry])\n\n respond_to do |format|\n if @industry.save\n format.html { redirect_to @industry, notice: 'Industry was successfully created.' }\n format.json { render json: @industry, status: :created, location: @industry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @industry.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4400b48c66ca1126a3eda97d0d107633",
"score": "0.5016227",
"text": "def create\n @industry = Industry.new(params[:industry])\n\n respond_to do |format|\n if @industry.save\n format.html { redirect_to @industry, notice: 'Industry was successfully created.' }\n format.json { render json: @industry, status: :created, location: @industry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @industry.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "41e5e93bb4bdf8fcb89479fa6867654b",
"score": "0.5016216",
"text": "def create\n @nationality = Nationality.new(params[:nationality])\n\n respond_to do |format|\n if @nationality.save\n format.html { redirect_to @nationality, notice: 'Nationality was successfully created.' }\n format.json { render json: @nationality, status: :created, location: @nationality }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nationality.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c72a03a4189044dbbd12dc323b9339dd",
"score": "0.50126696",
"text": "def create\n @universidade = Universidade.new(universidade_params)\n respond_to do |format|\n if @universidade.save\n format.html { redirect_to @universidade, notice: 'IES cadastrada com sucesso!' }\n format.json { render :show, status: :created, location: @universidade }\n else\n format.html { render :new }\n format.json { render json: @universidade.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a90c0427289f313a3a9a42d5223b80a6",
"score": "0.50086814",
"text": "def create\n @official_neighborhood = OfficialNeighborhood.new(params[:official_neighborhood])\n\n respond_to do |format|\n if @official_neighborhood.save\n format.html { redirect_to @official_neighborhood, :notice => 'Official neighborhood was successfully created.' }\n format.json { render :json => @official_neighborhood, :status => :created, :location => @official_neighborhood }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @official_neighborhood.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c5d837297add15f4a3336ae0f340a72d",
"score": "0.49995205",
"text": "def create(attrs, user = @@default_user)\n @attributes = send_request('organizations', :post) do |req|\n req.body = {\n organization: attrs,\n auth_token: user.auth_token\n }\n end\n end",
"title": ""
},
{
"docid": "b976b5d5be9cdff167fbd37d7585b023",
"score": "0.49994165",
"text": "def create\n @official_profile = OfficialProfile.new(params[:official_profile])\n\n respond_to do |format|\n if @official_profile.save\n format.html { redirect_to @official_profile, notice: 'Official profile was successfully created.' }\n format.json { render json: @official_profile, status: :created, location: @official_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @official_profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4d2b92e9f810acc007d72b1721d1079d",
"score": "0.49909616",
"text": "def create\n @organization = Organization.new(organization_params)\n\n if @organization.save\n save_innovations\n render json: @organization.to_json(:include => :innovations)\n else\n render json: @organization.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "c1cfd20aec061bfef28813a08608f22f",
"score": "0.4981936",
"text": "def create\n itinerary = current_user.itineraries.create!(itinerary_params)\n itinerary_id = current_user.itineraries.last\n \n events = params[:events]\n events.each do |event|\n itinerary_id = current_user.itineraries.last[:id]\n EventsItinerary.create(itinerary_id: itinerary_id, event_id: event[\"id\"])\n end\n render json: itinerary, status: 201 # , location: [:api, itineraries]\n end",
"title": ""
},
{
"docid": "aa83d00e194130f995dc7ac4e33e8ccb",
"score": "0.49693063",
"text": "def index\n @individual_identities = IndividualIdentity.all\n end",
"title": ""
},
{
"docid": "769f16c3561d6cd60dfebac6e6d74a57",
"score": "0.49659383",
"text": "def create\n @incident = Incident.new(incident_params)\n # Hard Coding is not a good practise but with db:seed we are generating anonymous user as first user\n # and querying db everytime won't be good idea. That will remain same always.\n # or we can initialize anonymous user id as constant to use application wide.\n @incident.user_id = 1 if incident_params[:submit_anonymously] == \"1\"\n\n respond_to do |format|\n if @incident.save\n puts \"============redirecting as well\"\n format.html { redirect_to @incident, notice: 'Thanks for submitting incident report.' }\n format.json { render :show, status: :created, location: @incident }\n else\n puts \"===============render new\"\n format.html { render :new }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "53636021baa4f57294d9ef7855c7fba0",
"score": "0.49563342",
"text": "def create\n @junior_enterprise = JuniorEnterprise.new(junior_enterprise_params)\n @junior_enterprise.logo = junior_enterprise_params[\"logo\"]\n\n if @junior_enterprise.save\n user = User.find(junior_enterprise_params[\"user_id\"])\n user.junior_enterprise = @junior_enterprise\n user.save\n\n render json: @junior_enterprise, status: :created, location: @junior_enterprise\n else\n render json: @junior_enterprise.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "66d4e2a268093825c860ab95d2a48cf1",
"score": "0.495228",
"text": "def create\n\n @medical = get_medical\n @case = @medical.case\n primary_injury = false\n\n #set primary to true before creating an injury if there are no existing injuries\n if [email protected]?\n primary_injury = true \n end\n\n @injury = @medical.injuries.create(injury_params)\n @injury.firm = @firm\n @injury.primary_injury = primary_injury\n\n respond_to do |format|\n if @injury.save\n format.html { redirect_to case_medical_path(@case, @medical), notice: 'Injury was successfully created.' }\n format.json { render :show, status: :created, location: [@case, @medical] }\n else\n format.html { render :new }\n format.json { render json: @injury.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "09fc26860b085c7e499551a9523b5fcc",
"score": "0.49486452",
"text": "def associate_with_edu_org( staff_url, edu_org_url )\n staff = JSON.parse RestClient.get staff_url, headers\n staff_id = staff['id']\n \n edu_org = JSON.parse RestClient.get REST_URL + \"educationOrganizations\", headers\n edu_org_id = edu_org[0]['id']\n\n staff_class = \"Other\"\n begin_date = \"2013-05-01\" \n \n assoc = staff_education_organization_association( staff_id, edu_org_id, staff_class, begin_date)\n # logger.info \"Assoc: \" + assoc.to_json\n\n url = REST_URL + \"staffEducationOrgAssignmentAssociations\"\n\n response = RestClient.post url, assoc.to_json, headers\n # logger.info \"Staff-EduOrg Association Location: \" + response.headers[:location]\n return response.headers[:location]\n end",
"title": ""
},
{
"docid": "9fa9a80922d7962d82111a949f0f8154",
"score": "0.49474302",
"text": "def create\n @interested_university = InterestedUniversity.new(params[:interested_university])\n\n respond_to do |format|\n if @interested_university.save\n format.html { redirect_to @interested_university, notice: 'Interested university was successfully created.' }\n format.json { render json: @interested_university, status: :created, location: @interested_university }\n else\n format.html { render action: \"new\" }\n format.json { render json: @interested_university.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d74c136c9574ba094309b46d2f6e7a56",
"score": "0.49443394",
"text": "def create_for_association\n @survey = current_organization.sponsored_surveys.find(params[:survey_id])\n @organizations = params[:organizations].split(\",\")\n @invitations = []\n\n @organizations.each do |organization_id|\n invitation = invite_organization(organization_id.to_s)\n invitation.save\n @invitations << invitation if invitation.valid?\n end\n \n respond_to do |wants|\n wants.js\n end\n end",
"title": ""
},
{
"docid": "10b74ce30e377c1cedf04bf25d3ee352",
"score": "0.49441805",
"text": "def create\n @constituency = Constituency.new(constituency_params)\n region_id = @constituency.region_id\n region = RegionMaster.where(\"region_id=? AND active_status=true\",region_id).first\n region_code = region.region_code\n @constituency.constituency_id = Constituency.gen_assigned_code(region_code)\n\n respond_to do |format|\n if @constituency.save\n format.html { redirect_to @constituency, notice: \"Constituency was successfully created.\" }\n format.json { render :show, status: :created, location: @constituency }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @constituency.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3bc1c446b26d89deda89503cf2a069e1",
"score": "0.49375707",
"text": "def individual_identity_params\n params.require(:individual_identity).permit(:user_id, :fullname, :sex_id)\n end",
"title": ""
},
{
"docid": "c75adc2c3e58dd1483dabde93a639b76",
"score": "0.493014",
"text": "def create\n @identity = Identity.new(identity_params)\n\n respond_to do |format|\n if @identity.save\n format.html { redirect_to @identity, notice: 'Identity was successfully created.' }\n format.json { render :show, status: :created, location: @identity }\n else\n format.html { render :new }\n format.json { render json: @identity.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c75adc2c3e58dd1483dabde93a639b76",
"score": "0.493014",
"text": "def create\n @identity = Identity.new(identity_params)\n\n respond_to do |format|\n if @identity.save\n format.html { redirect_to @identity, notice: 'Identity was successfully created.' }\n format.json { render :show, status: :created, location: @identity }\n else\n format.html { render :new }\n format.json { render json: @identity.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bc6aff3e8c5eb2dcb5e83eaa1dfe84b4",
"score": "0.4928488",
"text": "def index\n @identifications = Identification.all\n\n end",
"title": ""
},
{
"docid": "4e5130bd869c88fc3cc2dd2012c8d1c4",
"score": "0.49273312",
"text": "def create\n identity_url = params[:openid_identifier]\n auth(identity_url) do |status, url, reg|\n session[:openid] = url\n if session[:change_openid]\n change_openid(url)\n else\n start_login(url, reg[\"email\"])\n end\n end\n end",
"title": ""
},
{
"docid": "827fa23372e661c4a8ad7899f904c36d",
"score": "0.49235687",
"text": "def create\n @party_affiliation = PartyAffiliation.new(party_affiliation_params)\n\n respond_to do |format|\n if @party_affiliation.save\n format.html { redirect_to @party_affiliation, notice: 'Party affiliation was successfully created.' }\n format.json { render :show, status: :created, location: @party_affiliation }\n else\n format.html { render :new }\n format.json { render json: @party_affiliation.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a7d1d3fa8c117cae39ef8195f2b6883e",
"score": "0.4914134",
"text": "def create\n occasion = Occasion.get_or_create(params[:occasion].only(\"name\").merge(params[:location]||{}).merge(:user_id => current_user_id))\n render :json => occasion_attributes_for_app_with_thumbnail(occasion, current_user)\n end",
"title": ""
},
{
"docid": "63e883be507001f499e1a9d180907d2f",
"score": "0.4913843",
"text": "def list_identities_with_http_info(organization_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: IdentitiesApi.list_identities ...'\n end\n # verify the required parameter 'organization_id' is set\n if @api_client.config.client_side_validation && organization_id.nil?\n fail ArgumentError, \"Missing the required parameter 'organization_id' when calling IdentitiesApi.list_identities\"\n end\n if @api_client.config.client_side_validation && !opts[:'count'].nil? && opts[:'count'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"count\"]\" when calling IdentitiesApi.list_identities, must be smaller than or equal to 100.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'count'].nil? && opts[:'count'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"count\"]\" when calling IdentitiesApi.list_identities, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/{organization-id}/identities'.sub('{' + 'organization-id' + '}', CGI.escape(organization_id.to_s).gsub('%2F', '/'))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'where_provider'] = opts[:'where_provider'] if !opts[:'where_provider'].nil?\n query_params[:'where_user'] = opts[:'where_user'] if !opts[:'where_user'].nil?\n query_params[:'where_first_name'] = opts[:'where_first_name'] if !opts[:'where_first_name'].nil?\n query_params[:'where_last_name'] = opts[:'where_last_name'] if !opts[:'where_last_name'].nil?\n query_params[:'where_registered_by'] = opts[:'where_registered_by'] if !opts[:'where_registered_by'].nil?\n query_params[:'where_fiscal_code'] = opts[:'where_fiscal_code'] if !opts[:'where_fiscal_code'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'InlineResponse2001' \n\n # auth_names\n auth_names = opts[:auth_names] || ['ApiKeyAuth']\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: IdentitiesApi#list_identities\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "2057be163253fecdeacc543761f57cba",
"score": "0.49110675",
"text": "def create\n @enrollment = @person.enrollments.new(enrollment_params)\n @enrollment.save\n\n respond_with(@institution, @person, @enrollment)\n end",
"title": ""
},
{
"docid": "93f67d1b65829ed23bc805713b959e90",
"score": "0.49029374",
"text": "def enologist_params\n params.require(:enologist).permit(:name, :age, :nationality, \n positions_attributes[:magazine_id, :name, :enologist_id])\n end",
"title": ""
},
{
"docid": "7d18763e2ae70c08d4ecd0ffd82e2de0",
"score": "0.49017063",
"text": "def create\n @beneficial_owner = current_user.beneficial_owners\n .build(beneficial_owner_params)\n\n respond_to do |format|\n if @beneficial_owner.save\n format.html { redirect_to corporate_applications_personnel_url,\n notice: 'Beneficial owner was successfully created.' }\n format.json { render :show, status: :created, location: @beneficial_owner }\n else\n format.html { render :new }\n format.json { render json: @beneficial_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7fa55f0329e7f0a678124cbc7e3dda6d",
"score": "0.49001586",
"text": "def intro_call_registrants(occurrence_id = nil)\n params = occurrence_id.present? ? {occurrence_id: occurrence_id} : {}\n call(endpoint: \"webinars/#{INTRO_WEBINAR_ID}/registrants\", params: params) \n end",
"title": ""
},
{
"docid": "d297a2ef2f38b0349fe7f343884a05b0",
"score": "0.48919904",
"text": "def create\n rendered_time, referer, user = tracking_info\n assessment_result = user.assessment_results.create!(\n assessment_id: params[:assessment_id],\n eid: params[:eid],\n src_url: params[:src_url],\n external_user_id: params[:external_user_id],\n identifier: params['identifier'],\n rendered_datestamp: rendered_time,\n referer: referer,\n ip_address: request.ip,\n session_status: 'initial')\n\n assessment_result.keyword_list.add(params[:keywords], parse: true) if params[:keywords]\n assessment_result.objective_list.add(params[:objectives], parse: true) if params[:objectives]\n assessment_result.save! if params[:objectives] || params[:keywords]\n respond_with(:api, assessment_result)\n end",
"title": ""
},
{
"docid": "ec0a763791ee130b14b8bdf041830933",
"score": "0.489192",
"text": "def create\n @education = Education.new(education_params.merge!(user: current_user))\n\n respond_to do |format|\n if @education.save\n format.html { redirect_to inside_path, notice: 'Education was successfully created.' }\n format.json { render :show, status: :created, city: @education }\n else\n format.html { render :new }\n format.json { render json: @education.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f0da188f1903d5cb0fb491a693fab17b",
"score": "0.48841286",
"text": "def get_identity\n refresh_tokens\n @housing = Housing.find(@profil.housing_id)\n @usage_point_id = @housing.enedis_usage_point_id #!! @profil.housing.enedis_usage_point_id ne fonctionne pas\n\n link = \"https://gw.hml.api.enedis.fr/v3/customers/identity\"\n response = RestClient::Request.execute(\n method: 'GET',\n url: link,\n headers: {\n accept: 'application/json',\n authorization: \"Bearer #{@profil.enedis_access_token}\",\n params: {usage_point_id: \"#{@housing.enedis_usage_point_id}\" }\n }\n )\n identity_response = JSON.parse(response)\n @firstname = identity_response[0]['customer']['identity']['natural_person']['firstname']\n @lastname = identity_response[0]['customer']['identity']['natural_person']['lastname']\n @profil.firstname = @firstname\n @profil.lastname = @lastname\n @profil.save\n puts '---> Identité récupérée (Prénom, Nom)'\n end",
"title": ""
},
{
"docid": "4bad5aa95a6b2b5df384340f4e05bee0",
"score": "0.48826328",
"text": "def create\n return unless representsCompany?\n\n @industry = Industry.new(params[:industry])\n\n respond_to do |format|\n if @industry.save\n format.html { redirect_to edit_company_path(current_user.company), notice: 'Industry was successfully created.' }\n format.json { render json: @industry, status: :created, location: @industry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @industry.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0f45dffcb4fa2d435b743a66de243178",
"score": "0.4876289",
"text": "def create\n # @entrepreneur = Entrepreneur.new(entrepreneur_params)\n @entrepreneur = current_user.entrepreneurs.new(entrepreneur_params)\n if @entrepreneur.save\n render :json => {entrepreneur: @entrepreneur}, status: :created\n else\n render :json => { errors: @entrepreneur.errors}, status: :unprocessable_entity\n end\n\n end",
"title": ""
},
{
"docid": "9c8c5af84e06780a57352288242a3526",
"score": "0.48737532",
"text": "def create\n @organization = Organization.find_by_code(params[:individual][:code])\n @individual = Individual.new(individual_params)\n\n respond_to do |format|\n if @individual.save\n format.html { redirect_to @individual, notice: 'Individual was successfully created.' }\n format.json { render :show, status: :created, location: @individual }\n else\n format.html { render :new }\n format.json { render json: @individual.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5ea632df92220f309e4950f581942b6f",
"score": "0.4872961",
"text": "def create\n @novelity = CMS::Novelity.new(novelity_params)\n @novelity.author = current_user.try(:person)\n\n respond_to do |format|\n if @novelity.save\n format.html { redirect_to cms_novelities_path, notice: \"Entry was successfully created.\" }\n format.json { render :show, status: :created, location: @novelity }\n else\n format.html { render :new }\n format.json { render json: @novelity.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0791dd0e9cc0b12b7e17b18498ad16bc",
"score": "0.48686594",
"text": "def resident_params\n params.require(:resident).permit(\n :real_first_name,\n :real_last_name,\n :kana_first_name,\n :kana_last_name,\n :birthday,\n :zip_code,\n :prefecture,\n :city_name,\n :house_number,\n :building_name,\n :phone_number\n ).merge(user_id: current_user.id)\n end",
"title": ""
},
{
"docid": "17bee1761a1cd41298918aaba2ec9d63",
"score": "0.4868128",
"text": "def industry_params\n params.require(:industry).permit(:user_id, :name, :address, :phone, :email, :website, :stem_foci, :description, :blurb, :active, :show_info, :negotiations)\n end",
"title": ""
},
{
"docid": "5b2a739bcf7d2547c98d577495abd50a",
"score": "0.48649096",
"text": "def index\n @identities = Identity.all\n end",
"title": ""
},
{
"docid": "74f8ebafb437126a88dd4e7786a79eaf",
"score": "0.4864901",
"text": "def create\n @organization = Organization.create(params[:organization])\n @organization.approved = false\n @organization.sectors = Sector.find(params[:sector_ids]) if params[:sector_ids]\n if @organization.save\n Contacthistory.create(user_id: current_user.id, organization_id: @organization.id, start_date: Date.today, end_date: nil)\n flash[:success] = \"Organization created! You are now an admin of this organization. Your organization will not show up in search results until it has been approved by the GPEN administration.\"\n redirect_to @organization\n else\n render 'organizations/new'\n end\n end",
"title": ""
},
{
"docid": "da4a1be40303e00ea5420eb2d4fb2a58",
"score": "0.48548037",
"text": "def create\n @official_qualifier = OfficialQualifier.new(params[:official_qualifier])\n\n respond_to do |format|\n if @official_qualifier.save\n format.html { redirect_to @official_qualifier, notice: 'Official qualifier was successfully created.' }\n format.json { render json: @official_qualifier, status: :created, location: @official_qualifier }\n else\n format.html { render action: \"new\" }\n format.json { render json: @official_qualifier.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "534b5a1567b38b7673f8ef94ec2b0b41",
"score": "0.4854642",
"text": "def create\n @enologist = Enologist.new(enologist_params)\n\n respond_to do |format|\n if @enologist.save\n format.html { redirect_to @enologist, notice: 'Enologist was successfully created.' }\n format.json { render :show, status: :created, location: @enologist }\n else\n format.html { render :new }\n format.json { render json: @enologist.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0a7f0c29f6b21c4b7c4a63b88ff57c85",
"score": "0.4854455",
"text": "def create\n @ubiquitous_term = UbiquitousTerm.new(ubiquitous_term_params)\n respond_to do |format|\n if @ubiquitous_term.save\n format.html { redirect_to ubiquitous_terms_url, notice: 'registered' }\n format.json { render :show, status: :created, location: @ubiquitous_term }\n else\n format.html { render :new }\n format.json { render json: @ubiquitous_term.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d0194524712894d5ddc8b1039328e31a",
"score": "0.4854076",
"text": "def postOrganization(name, displayName, desc, website)\n\n\thash = Hash.new\n\thash[:name] = name\n\thash[:displayName] = displayName\n\thash[:desc] = desc\n\thash[:website] = website\t\n\thash[:key] = $key\n\thash[:token] = $token\n\n\tresponse = RestClient.post \"https://api.trello.com/1/organizations/\", hash \n\tresponse = JSON.parse(response)\t\nend",
"title": ""
},
{
"docid": "4b748a6a41b0b4766e5b4974f83a7bc3",
"score": "0.48498192",
"text": "def create\n @organization.assign_attributes(organization_params)\n @user_organization_capability = UserOrganizationCapability.new(\n organization: @organization,\n user: @current_user,\n capabilities: :admin\n )\n\n respond_to do |format|\n begin\n @organization.save!\n format.html { redirect_to @organization, notice: 'Organization was successfully created.' }\n format.json { render :show, status: :created, location: @organization }\n rescue ActiveRecord::RecordNotUnique => e\n format.html {\n flash.alert = \"Organization with name #{@organization.name} already exists.\"\n render :new\n }\n format.json { render json: [e], status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "520744a6182a76cae9903d70fe5c2fe1",
"score": "0.48463023",
"text": "def identify(*identifications)\n uri = URI(TRACK_URI_STRING)\n Net::HTTP.post_form(uri, identify_body(identifications))\n end",
"title": ""
},
{
"docid": "0e2e09402118ab8872e80434b4ed8674",
"score": "0.48392817",
"text": "def create\n @resident = Resident.create(resident_params)\n redirect_to '/residents'\n end",
"title": ""
},
{
"docid": "9960e93eed6947d1c0870ebb57350083",
"score": "0.48373622",
"text": "def identify_body(*identifications)\n identification_body = identifications.flatten.map(&:to_hash)\n\n {\n api_key: Amplitude.configuration.api_key,\n identification: JSON.generate(identification_body)\n }\n end",
"title": ""
},
{
"docid": "c6986af2444faa54da4aea8070c3227b",
"score": "0.48365033",
"text": "def new\n @official = Official.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @official }\n end\n end",
"title": ""
},
{
"docid": "c6986af2444faa54da4aea8070c3227b",
"score": "0.48365033",
"text": "def new\n @official = Official.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @official }\n end\n end",
"title": ""
},
{
"docid": "c6986af2444faa54da4aea8070c3227b",
"score": "0.48350164",
"text": "def new\n @official = Official.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @official }\n end\n end",
"title": ""
},
{
"docid": "2d2e967b97ccfc5f8b8615e5ed7c61eb",
"score": "0.48348737",
"text": "def create\n @designated_national_authority = DesignatedNationalAuthority.new(params[:designated_national_authority])\n\n respond_to do |format|\n if @designated_national_authority.save\n format.html { redirect_to @designated_national_authority, notice: 'Designated national authority was successfully created.' }\n format.json { render json: @designated_national_authority, status: :created, location: @designated_national_authority }\n else\n format.html { render action: \"new\" }\n format.json { render json: @designated_national_authority.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0186820719e25d42f83bc8cbe128b125",
"score": "0.48328695",
"text": "def index\n @api_universities = University.all\n end",
"title": ""
},
{
"docid": "2159f79cb6362eddf84453f7feff3e54",
"score": "0.48250335",
"text": "def create\n omniauth = request.env[\"omniauth.auth\"]\n provider = Provider.find_by_name(omniauth['provider'])\n @identity = Identity.find_by_provider_id_and_email(provider.id, omniauth['uid'].to_s)\n\n if @identity \n @identity.user = current_user\n else\n @identity = Identity.new(:user => current_user, :provider => provider, :email => omniauth['uid'].to_s)\n end\n\n @identity.apply_omniauth omniauth\n respond_to do |format|\n if @identity.save\n\n if provider.id == 4\n client = FBGraph::Client.new(:client_id => FACEBOOK_ID, :secret_id => FACEBOOK_SECRET, :token => @identity.token)\n @identity.import_facebook(client.selection.me.info!)\n end\n\n if provider.id == 6\n client = LinkedIn::Client.new(LINKED_IN_ID, LINKED_IN_SECRET)\n client.authorize_from_access(@identity.token, @identity.secret)\n @identity.import_linked_in(client.profile(:fields => [:location, :headline, :summary, :positions, :educations]))\n end\n\n format.html { redirect_to(identities_url, :notice => 'Identity was successfully added.') }\n format.xml { render :xml => @identity, :status => :created, :location => @identity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @identity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fc38c6628e78d12ab42b28d4a29cedba",
"score": "0.48232576",
"text": "def create\n @organisation = Organisation.new(params[:organisation])\n\[email protected]_id = current_user.id\n\t\n respond_to do |format|\n if @organisation.save\n format.html { redirect_to @organisation, notice: 'Organisation was successfully created.' }\n format.json { render json: @organisation, status: :created, location: @organisation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @organisation.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "95f2eaed497fdd37e3e04431a5e61d46",
"score": "0.48200145",
"text": "def create\n @accident = Accident.new(accident_params)\n\n respond_to do |format|\n if @accident.save\n format.html { redirect_to @accident, notice: 'Unfall erstellt.' }\n format.json { render :show, status: :created, location: @accident }\n else\n format.html { render :new }\n format.json { render json: @accident.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d94e158cf018e2d9c77b756ba4d26b0e",
"score": "0.48096716",
"text": "def create\n @accident = Accident.new(params[:accident])\n\n respond_to do |format|\n if @accident.save\n format.html { redirect_to @accident, notice: 'Accident was successfully created.' }\n format.json { render json: @accident, status: :created, location: @accident }\n else\n format.html { render action: \"new\" }\n format.json { render json: @accident.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ced318a06f04ba1743e3f184a44c3487",
"score": "0.47983283",
"text": "def create\n @api_v1_initiative_invitee = Api::V1::InitiativeInvitee.new(api_v1_initiative_invitee_params)\n\n respond_to do |format|\n if @api_v1_initiative_invitee.save\n format.html { redirect_to @api_v1_initiative_invitee, notice: 'Initiative invitee was successfully created.' }\n format.json { render :show, status: :created, location: @api_v1_initiative_invitee }\n else\n format.html { render :new }\n format.json { render json: @api_v1_initiative_invitee.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "569d6b34eee01e7f1665846a93c58b14",
"score": "0.4797028",
"text": "def create\n @innovation = current_user.innovations.new(innovation_params)\n respond_to do |format|\n if @innovation.save && @innovation.create_tags(params)\n format.html { redirect_to @innovation, notice: 'Innovation was successfully created.' }\n format.json { render json: @innovation, status: :created, location: innovation_path(@innovation) }\n else\n format.html { render :new }\n format.json { render json: @innovation.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
592a4bd9f51ebb648f54cb84ead4eb6e
|
===================================================== extract csv file and return array of game data
|
[
{
"docid": "61cdcf199d0b2c02513c33842d3b6763",
"score": "0.65151536",
"text": "def export_csv(filename)\n game_matchups = []\n CSV.foreach(filename, headers: true) do |row|\n game_matchups << row.to_hash\n end\n game_matchups\nend",
"title": ""
}
] |
[
{
"docid": "08abb6945d5c07ffc55d2900e4481232",
"score": "0.7090718",
"text": "def load_csv(csv_filepath)\n gifts = []\n CSV.foreach(csv_filepath) do |row|\n gifts << row[0] # Nosso csv só tem uma coluna\n end\n return gifts\nend",
"title": ""
},
{
"docid": "aa4fcb39e8dffb52e4fba301cf2bdaf4",
"score": "0.6676673",
"text": "def read_scores_from\n teams_data = []\n\n CSV.foreach('scores.csv', headers: true, header_converters: :symbol) do |row|\n teams_data << row.to_hash\n end\n teams_data\nend",
"title": ""
},
{
"docid": "af1576eef544b816a3310a002f837f6e",
"score": "0.66507614",
"text": "def getFiles(player)\n # Gets List of CSV to seed database with\n files = Array.new\n csv_list = Dir.glob(\"csv/*\")\n csv_list.each do |csv_filename|\n csv_text = File.read(csv_filename)\n csv = CSV.parse(csv_text, :headers => true, :encoding => 'ISO-8859-1')\n csv.each do |row|\n csv_player = row.to_hash['Player']\n if csv_player && csv_player.downcase == player.downcase\n files.push(csv_filename)\n break\n end\n end\n end\n # puts files\nend",
"title": ""
},
{
"docid": "ac39c8cf42aeb7b3ee0ddc1db24115cc",
"score": "0.6624698",
"text": "def read_in_csv_data(csv_file_name)\n begin\n CSV.foreach(csv_file_name, headers: true) do |row|\n @songs << Song.new(row['name'], row['location'])\n end\n rescue Exception\n @songs = nil\n end\n @songs\n end",
"title": ""
},
{
"docid": "7ff1a1cf665b1d79a5b752bae3624842",
"score": "0.6585086",
"text": "def parse_csv(file_path)\n record_list = []\n header = []\n is_header = true\n \n CSV.foreach(file_path) do |row|\n if (is_header)\n\theader = row\n\tis_header = false\n else\n\trecord = Record.new\n\trecord.create(header, row)\n\trecord_list.push(record)\n end\n end\n return record_list\n end",
"title": ""
},
{
"docid": "9711d6fa3ed463e4ad1dc4ee42b81cdb",
"score": "0.6574108",
"text": "def load_data(file_name)\n\t\tindata = []\n\t\t#csv reader as shown in class; typecasted because I ran into some weird bugs\n\t\tCSV.foreach(\"#{file_name}\", col_sep: \"\\t\") do |row| \n\t\t\tindata.push({\"user_id\"=>row[0].to_i, \"movie_id\"=>row[1].to_i, \"rating\" => row[2].to_i, \"timestamp\" => row[3].to_i})\n\t\tend\n\t\treturn indata\n\tend",
"title": ""
},
{
"docid": "92c39537b565d31a7faeb52bc77b96a9",
"score": "0.65536153",
"text": "def load_data(filename)\n athlete_array = []\n CSV.read(filename, headers: true).each do |athlete|\n athlete_array << athlete.to_h\n end\n return athlete_array\nend",
"title": ""
},
{
"docid": "87589563d6702ca35d3af058fdb6fdbe",
"score": "0.6522083",
"text": "def get_data(file_name)\n @all_data=[]\n\n CSV.foreach(file_name, :headers => true) do |row|\n first=row[\"first_name\"]\n last=row[\"last_name\"]\n position=(row[\"position\"]).tr(\" \",\"_\")\n team=(row[\"team\"]).tr(\" \",\"_\")\n\n @all_data.push( {:Team => team, :First_Name => first, :Last_Name => last, :Position => position} )\n end\n @all_data\nend",
"title": ""
},
{
"docid": "9fa74002edc5c78dd9857d8ed8054158",
"score": "0.64877886",
"text": "def load_csv (csv_file)\n\tret = []\n\tFile.open(csv_file, \"r\") do |f|\n\t\tf.each_line do |line|\n\t\t\t#puts line\n\t\t\tret << line.split(';')\n\t\tend\n\tend\n\treturn ret\nend",
"title": ""
},
{
"docid": "579a671b1fedcc846e4bf6dd65d3772d",
"score": "0.64767766",
"text": "def parse_csv_file\n csv_data = CSV.read(\"../artists_for_seed_data.csv\")\n csv_data.shift\n # iterate over each element and send back a hash\n # need to shift again at the beginning to get rid of id on the row\n painter_object_array = []\n csv_data.each do |painter_row_arr|\n \n painter_row_arr.shift\n painter_object = {\n :name => painter_row_arr[0],\n :years => painter_row_arr[1],\n :genre => painter_row_arr[2],\n :nationality => painter_row_arr[3],\n :bio => painter_row_arr[4],\n :painter_num => painter_row_arr[6]\n }\n painter_object_array.push(painter_object)\n end\n painter_object_array.flatten\nend",
"title": ""
},
{
"docid": "d104083e463d18b99a6945b63cd48a26",
"score": "0.6462543",
"text": "def csv_convert(file)\n data_rows = []\n f = File.open(file, 'r')\n f.each_line do |line|\n data_rows.push line.chomp.split(',')\n end\n f.close\n return data_rows\nend",
"title": ""
},
{
"docid": "51c213b372357cb19ec1dfbbcfb724f9",
"score": "0.6458945",
"text": "def import_from_csv(file_name)\n kanbanery_tickets = extract_kanbanery_tickets_from_csv(file_name)\n @cards = extract_cards(kanbanery_tickets)\n end",
"title": ""
},
{
"docid": "94544c6bd13008a5673bea55d213e3b3",
"score": "0.64464986",
"text": "def getData()\n CSV.foreach(\"SkaterProjections.csv\", :headers => true) do |row|\n @skater_data.push(row)\n end\n \n CSV.foreach(\"GoalieProjections.csv\", :headers => true) do |row|\n @goalie_data.push(row)\n end\nend",
"title": ""
},
{
"docid": "37e20c354285c37f050b5d3e60cced42",
"score": "0.6423441",
"text": "def parse_csv\n if self.csv_file.present?\n csv_text = Paperclip.io_adapters.for(self.csv_file).read\n csv = CSV.parse(csv_text, :headers => false)\n\n csv_columns = ['l', 'r', 'units']\n\n csv_to_save = {}\n\n csv.each_with_index do |row, i|\n if i == 0\n csv_to_save['weight'] = row[1].split(':')[1] # string is like Weight:201, only want the number\n csv_to_save['shoe_size'] = row[2].split(':')[1] # string is like Shoe Size:9\n elsif i >= 3\n row.each_with_index do |field, j|\n if j >= 1 and !field.blank?\n csv_to_save[generate_csv_row_key(csv_columns, row, i, j)] = field\n end\n end\n end\n end\n\n # Check to see if any of the fields are nil, then we must have not received the correct file\n is_clean = true\n csv_to_save.each do |key, val|\n if val.nil?\n is_clean = false\n break\n end\n end\n\n CsvFile.create!(csv_to_save) if is_clean\n end\n end",
"title": ""
},
{
"docid": "a61863a29f42590a5fb85236b5725b7d",
"score": "0.6407458",
"text": "def players(team)\n field= []\n CSV.foreach(\"teams.csv\", headers:true,header_converters: :symbol) do |row|\n if row[:team] == team\n field << row.to_hash\n end\n end\n field\nend",
"title": ""
},
{
"docid": "0adc4b470666f25d90b400473caa595b",
"score": "0.63845897",
"text": "def parse\r\n\t\tCSV.foreach(self.filepath) {|row| @list << row}\r\n\t\[email protected]!\r\n\tend",
"title": ""
},
{
"docid": "494c84330626071a3df2f0bae1d50046",
"score": "0.63808405",
"text": "def load_students(filename = \"students.csv\")\n # CSV.open(filename, \"r\") {|file|\n CSV.foreach(filename) do |line| # contains name, cohort\n # file.readlines.each do |line|\n name, cohort = line\n student_into_array(name, cohort.to_sym)\n end\n\nend",
"title": ""
},
{
"docid": "72a073b1386cbc6c40c0d7f9196d2052",
"score": "0.63716537",
"text": "def get_csv_data(csv_data)\r\n csv_file = nil\r\n\r\n #Get the path and name of the CSV file\r\n if csv_data.to_s.include? '.csv'\r\n csv_file = File.join(File.dirname(__FILE__), \"../venture/config/csv_data/#{csv_data}\")\r\n elsif (\r\n csv_file = File.join(File.dirname(__FILE__), \"../venture/config/csv_data/#{csv_data}.csv\")\r\n )\r\n end\r\n\r\n csv_arr = CSV.read( csv_file, {:headers => true, :header_converters => :symbol, :encoding => 'UTF-8'} )\r\n keys = csv_arr.headers.to_a\r\n # read attribute example => csv[index][:column1]\r\n return csv_arr.to_a.map {|row| Hash[ keys.zip(row) ] }\r\nend",
"title": ""
},
{
"docid": "ac2a2ca3a914113e15f98a86a79b8264",
"score": "0.6342079",
"text": "def parse\n data = CSV.parse(@input_data)\n data.shift # remove header row\n headers = [:player_key, :year, :team_id, :game, :at_bats, :runs, :hits, :doubles, :triples, :home_runs, :runs_batted_in, :stolen_bases, :caught_stealing]\n data.map {|row| Hash[ *(headers.zip(row).flatten) ] }\n end",
"title": ""
},
{
"docid": "4fef7f3c5248beb03a9607e1f511ecd6",
"score": "0.63390696",
"text": "def load_students(filename = \"students.csv\")\n file = File.open(filename, \"r\")\n file.readlines.each do |line|\n name, cohort, hobby, country = line.chomp.split(\",\")\n add_student_to_array(name, cohort, hobby, country)\n end\n file.close\nend",
"title": ""
},
{
"docid": "b18b6b10820afdd0b7a77d72a6d7e3b8",
"score": "0.6338012",
"text": "def csv_to_array(file)\n @recipes = []\n CSV.foreach(file){|row| @recipes << Recipe.new(row[0], row[1].to_i, row[2].to_i, row[3].to_i)}\n end",
"title": ""
},
{
"docid": "05497fe65b6541c3810f7527983d3f58",
"score": "0.6331022",
"text": "def parse\n\t\tresults = []\n\t\tif !self.csv_file_file_name.blank? &&\n\t\t\t\tFile.exists?(self.csv_file.path)\n\t\t\t(f=CSV.open( self.csv_file.path, 'rb',{\n\t\t\t\t:headers => true })).each do |line|\n\n\t\t\t\ticf_master_tracker = IcfMasterTracker.find_or_create_by_master_id(\n\t\t\t\t\tline['master_id'],\n\t\t\t\t\t:master_tracker_date => self.master_tracker_date )\n\n\t\t\t\tsuccessfully_updated = icf_master_tracker.update_attributes!(\n\t\t\t\t\tline.to_hash.delete_keys!(\n\t\t\t\t\t\t'master_id').merge(\n\t\t\t\t\t\t:master_tracker_date => self.master_tracker_date) )\n\n\t\t\t\tresults.push(icf_master_tracker)\n\t\t\tend\t#\t(f=CSV.open( self.csv_file.path, 'rb',{ :headers => true })).each\n\t\tend\t#\tif !self.csv_file_file_name.blank? && File.exists?(self.csv_file.path)\n\t\tresults\t#\tTODO why am I returning anything? will I use this later?\n\tend",
"title": ""
},
{
"docid": "ec6877da726fd95ba220618fef5e2c4e",
"score": "0.63209844",
"text": "def get_csv_data(csv_file)\n\t\tcsv_file = File.read(csv_file)\n\t\tcsv = CSV.parse(csv_file, :headers => true)\t\n\t\tcsv\n\tend",
"title": ""
},
{
"docid": "34e42ab09d334aee25ba1a2629bbd461",
"score": "0.6316807",
"text": "def parse_csv(file)\n\t\tdata = []\n\t\t# Break open CSV and go through rows\n\t\tbegin\n\t\t\tdata = CSV.read(file, :headers => true,:skip_blanks => true,:header_converters => :symbol, :encoding => 'UTF-8')\n\t\trescue\n\t\t\t# Convert to UTF-8 if necessary\n\t\t\tdata = CSV.read(file, :headers => true,:skip_blanks => true,:header_converters => :symbol, :encoding => 'Windows-1252:UTF-8')\n\t\tend\n\t\tdata\n\tend",
"title": ""
},
{
"docid": "cb8cc000eda736249c71db8dfb6ead80",
"score": "0.6314997",
"text": "def load_data(filename)\n return CSV.read(filename, headers: true).map { |line| line.to_h }\nend",
"title": ""
},
{
"docid": "5f329ef6aef7122c8e23fe2f4463ac9f",
"score": "0.63069016",
"text": "def csv_to_array(csv); end",
"title": ""
},
{
"docid": "b0c4c75206a19239bf33f0ebd6587a51",
"score": "0.6284527",
"text": "def getMinivanTestFile(url)\n\tarray_of_records = []\n\tinput_csv = open(url)\n\twhile !input_csv.eof?\n\t\tline = input_csv.readline.delete(\"\\n\")\n\t\tarray_of_records.push(line.split(',')[1..-1])\n\tend\n\treturn array_of_records\nend",
"title": ""
},
{
"docid": "709054440f79cf105a900056daabb1e4",
"score": "0.6275447",
"text": "def parse_csv_file(delim, file_name) \n \n temp_array = Array.new #Create an array\n file = File.open(file_name, \"r\") #Open a file for reading\n \n \n #Iterate file, parse strings and store\n file.each_line do |line|\n temp_array.push(parse_line(delim, line))\n end\n\n #Close resource\n file.close\n \n return temp_array\nend",
"title": ""
},
{
"docid": "65c897e15e95f5c0a1919afbe5530f80",
"score": "0.62732965",
"text": "def import_csv_full\n \n end",
"title": ""
},
{
"docid": "813ee3562fe2b801dca354ca9c574da8",
"score": "0.6265846",
"text": "def csv(csv_file)\n Slacker.get_csv(csv_file)\n end",
"title": ""
},
{
"docid": "eb2af891985af3fcfe1e890059b704bd",
"score": "0.62631667",
"text": "def import_csv\n @records = CSV.read(@filename, :headers => true, :row_sep => :auto)\n unless @records.blank?\n @linenum = 0\n if @filename.index('att') || @filename.index('Att')\n @school_year = Time.parse(@records[0][\"AbsenceDate\"]).year\n end\n @records.each { |rec |\n @linenum += 1\n @record = rec\n next unless check_record(@record)\n seed_record(@record)\n process_record(@record, rec2attrs(@record)) if rec2attrs(@record) != false\n }\n end \n end",
"title": ""
},
{
"docid": "53b775cdc61fbfcf0858ccbc9c23b938",
"score": "0.62533075",
"text": "def parse_painter_csv_file\n csv_data = CSV.read(\"db/painter_seed_data.csv\")\n csv_data.shift\n # iterate over each element and send back a hash \n # need to shift again at the beginning to get rid of id on the row\n painter_object_array = []\n csv_data.each do |painter_row_arr|\n painter_row_arr.shift\n painter_object = {\n :name => painter_row_arr[0],\n :years => painter_row_arr[1],\n :genre => painter_row_arr[2],\n :nationality => painter_row_arr[3],\n :bio => painter_row_arr[4],\n :painting_num => painter_row_arr[6],\n :portrait => painter_row_arr[7]\n }\n painter_object_array.push(painter_object) \n end\n painter_object_array.flatten\nend",
"title": ""
},
{
"docid": "a1501a78e24c7381fc685c30a2d1da09",
"score": "0.6248041",
"text": "def from_csv(filename)\n @successes = []\n @problems = []\n @unfound_vita_partners = []\n\n @headers = CSV.foreach(filename).first\n return unless headers_aligned? == true\n\n data = CSV.read(filename, headers: true)\n\n state_routing_pairs = generate_state_routing_pairs(data)\n\n create_records_for_state_routing_pairs(state_routing_pairs)\n\n print_script_messages\n true\n end",
"title": ""
},
{
"docid": "7ae071fcff39c69b8e2b95c58da40df6",
"score": "0.6242932",
"text": "def read_from_roster(csv)\n players = []\n CSV.foreach(csv, headers: true, header_converters: :symbol) do |player|\n players << player.to_hash\n end\n players\nend",
"title": ""
},
{
"docid": "6d948faa33fcbdc8fc715b766b46db84",
"score": "0.6238464",
"text": "def load_data(filename)\n data = CSV.open(filename, 'r', headers: true).map do |line|\n line.to_h\n end\n return data\nend",
"title": ""
},
{
"docid": "5911c5fd268d902e1c7e7a1317eef1f3",
"score": "0.62374425",
"text": "def readCSV(filename)\n resultArray = Array.new\n\n # read csv file\n File.open(filename) { |file|\n while line = file.gets\n row = CSV.parse_line( Kconv::kconv(line, Kconv::UTF8, Kconv::SJIS) )\n resultArray.push( row )\n end\n }\n\n return resultArray\nend",
"title": ""
},
{
"docid": "914f34fd2d30cd131dad874f8252cdb7",
"score": "0.62339574",
"text": "def load_csv\n # read each line frmo csv and append to recipes collection\n CSV.foreach(@csv_file) do |row|\n # puts \"#{row[0]} | #{row[1]}\"\n @recipes << Recipe.new(name: row[0], description: row[1], cooking_time: row[2], difficulty: row[3], tested: row[4])\n end\n end",
"title": ""
},
{
"docid": "16ac5a8716826b678d28c4ee15dfaa56",
"score": "0.6220627",
"text": "def load_file (filename = \"students.csv\")\n CSV.foreach(filename) do |row|\n name, cohort, food = row.map{ |element| element.chomp}\n add_student(name, cohort, food)\n end\nend",
"title": ""
},
{
"docid": "624f65089f486a0ce317ce456e1abb34",
"score": "0.62019944",
"text": "def csv_to_array(csv_name)\n\tCSV.read(csv_name)\nend",
"title": ""
},
{
"docid": "d8ff2c26d6695159c3e44c48d7a8d076",
"score": "0.61856735",
"text": "def parse_participant_import(csv_file, options, program, session, division)\n \n # This was initially designed to have a previewable import of participants\n # We are bypassing this step and going directly to import\n \n csv_data = FasterCSV.parse(csv_file.read)\n column_indices = map_importable_columns(csv_data[0])\n importable_participants = Array.new\n csv_data[1..csv_data.size-1].each do |csv_data_row|\n importable_participant = Hash.new\n IMPORTABLE_COLUMNS.each_with_index do |column_name, i|\n importable_participant[column_name.to_sym] = csv_data_row[column_indices[i]]\n end\n unless importable_participant[:name].blank?\n unless program.blank?\n importable_participant[:program] = program\n end\n unless session.blank?\n importable_participant[:session] = session\n end\n unless division.blank?\n importable_participant[:division] = division\n end\n importable_participants << importable_participant\n if options == \"load\"\n imported_participant = Participant.create_from_confirm_import(@hub, importable_participant)\n end\n end\n end\n importable_participants \n end",
"title": ""
},
{
"docid": "8103849aa1026d8636753f64117c563b",
"score": "0.6153824",
"text": "def load_data(filename)\n data = CSV.read(filename, headers: true).map(&:to_h)\n return data\nend",
"title": ""
},
{
"docid": "7b87b8b7306c5065869b87072a642630",
"score": "0.6140956",
"text": "def load_csv\n CSV.foreach(@csv_file_path) do |row|\n @recipes << Recipe.new(name: row[0], description: row[1], rating: row[2], prep_time: row[3], tried: row[4])\n end\n end",
"title": ""
},
{
"docid": "c7e7cc5f749c17283059065990749709",
"score": "0.6137601",
"text": "def read_csv_data file\n rows = []\n readerIn = CSV.open(file, 'r')\n row = readerIn.shift\n while row!= nil && !row.empty?\n rows << row\n row = readerIn.shift\n end\n readerIn.close\n \n return rows\nend",
"title": ""
},
{
"docid": "789af7e5c2536a047a900e74f6a2c278",
"score": "0.6132747",
"text": "def parse_csv(path)\n require 'csv'\n\n str = Nitro::Template.new.render(File.read(path))\n\n reader = CSV::Reader.create(str)\n header = reader.shift\n\n reader.each_with_index do |row, i|\n data = {}\n row.each_with_index do |cell, j|\n data[header[j].to_s.strip] = cell.to_s.strip\n end\n self[\"#{@name}_#{i+1}\"] = obj = instantiate(data)\n @objects << obj\n end\n end",
"title": ""
},
{
"docid": "ad6a07d7cbef165b2bdf37bcdfb653f9",
"score": "0.6118571",
"text": "def get\n arr = []\n\n process(csv_file).each do |record|\n arr << SOA_CSV_RECORD.new(*record.fields)\n end\n\n arr\n end",
"title": ""
},
{
"docid": "d35c064473eb78774e5480c34e2617e6",
"score": "0.6117202",
"text": "def prepare_csv\n unparsed_file = File.open(csv.path)\n self.parsed_csv_string = \"\"\n string = unparsed_file.readlines()\n string.each_with_index do |line,i|\n parsed_line = line.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '').gsub(/,\\\"\\\"/,'')\n # for some reason the iRacing CSV file is buggy.\n unless parsed_line == \"\\n\"\n if i == 5 or i == 6\n parsed_line = parsed_line.gsub(/\\n/,\"\\r\\n\")\n end\n self.parsed_csv_string << parsed_line\n end\n end\n unparsed_file.close\n end",
"title": ""
},
{
"docid": "90abd2d1270851d372e89ef0fbda9913",
"score": "0.6080846",
"text": "def parsed_data\n @parsed_data ||= begin\n CSV.read(full_filename, col_sep: col_sep, quote_char: quote_char, encoding: encoding)\n rescue => e #CSV::MalformedCSVError => er\n @parse_error = e.to_s\n rows = []\n #one more attempt. If BOM is present in the file.\n begin\n f = File.open(full_filename, \"rb:bom|utf-8\")\n rows = CSV.parse(f.read.force_encoding(\"ISO-8859-1\"))\n ensure\n return rows\n end\n end\n end",
"title": ""
},
{
"docid": "1d4a568c4dd44afd2dea038eb417be01",
"score": "0.60751384",
"text": "def create_item_rows_from_csv \n item_rows = []\n CSV.foreach('./data/items.csv', headers: true, header_converters: :symbol) do |row|\n item_rows << row\n end \n return item_rows\n end",
"title": ""
},
{
"docid": "195be2245701bd50e85dc98b9cb00795",
"score": "0.6070806",
"text": "def get_data(file_name)\n @all_data=[]\n\n CSV.foreach(file_name, :headers => true) do |row|\n id=row[\"id\"]\n title=(row[\"title\"]).tr(\" \",\"_\")\n year=row[\"year\"]\n synopsis=row[\"synopsis\"]\n rating=row[\"rating\"]\n genre=row[\"genre\"]\n studio=row[\"studio\"]\n\n @all_data.push( {:ID => id, :Title => title, :Year => year, :Synopsis => synopsis, :Rating => rating, :Genre => genre, :Studio => studio} )\n end\n @all_data\nend",
"title": ""
},
{
"docid": "98a89622141dc1afb241347664429106",
"score": "0.6065418",
"text": "def loadCSVFile(filePath)\n data = []\n CSV.foreach(filePath, :headers => true) do |row|\n row = row.to_h\n row.each do |k, v|\n v = v.to_s\n row[k] = v\n end\n data << row\n end\n data\n end",
"title": ""
},
{
"docid": "1d61ebcae2a335a671f6808393fc4abb",
"score": "0.6045837",
"text": "def load(gifts)\n CSV.foreach('gifts.csv') do |row|\n name = row[0]\n price = row[1].to_i\n bought = row[2] == 'true'\n gift = { name: name, price: price, bought: bought }\n gifts << gift\n end\nend",
"title": ""
},
{
"docid": "4f1eebb9c90a39d2432e55d6826a7888",
"score": "0.60305125",
"text": "def read_1d_csv_file(state_table_path) \r\n rows_read=0\r\n\t\tstate_transition_list= Array.new\r\n\t\tignore_first_row = true\r\n\r\n\t\tCSV::Reader.parse(File.open(state_table_path, 'r').read.gsub(/\\r/,\"\\n\")) do |row_array|\r\n\t\t\t# First row should be the header\r\n\t\t\tif ignore_first_row\r\n\t\t\t\tignore_first_row=false\r\n\t\t\telse\r\n\t\t\t\ttransition = TransitionHolder.new(row_array[STATE1].to_s,row_array[ACTION].to_s,row_array[STATE2].to_s)\r\n\t\t\t\tputs_debug \"Read in transitions: #{transition}\"\r\n\t\t\t\tstate_transition_list.push transition \r\n\t\t\tend # if first row\r\n\t\t\trows_read +=1\r\n\t\tend # end csv block\r\n\r\n raise \"CSV File Empty\" if rows_read==0\r\n raise \"Missing Data in CSV File\" if rows_read==1\r\n \r\n\t\t# return state table, its a raw list of transition objects\r\n\t\treturn state_transition_list\r\n\r\n\tend",
"title": ""
},
{
"docid": "5c1b8db8e7eba2e9ba52297536503781",
"score": "0.60146123",
"text": "def csv_import(the_file)\n import_list = []\n CSV.foreach(the_file, headers: true) do |row|\n import_list << row.to_hash\n end\n import_list\n end",
"title": ""
},
{
"docid": "49512a6be35ead6a7aa6d8f32a732848",
"score": "0.6013244",
"text": "def rows\n csv.rows.map { |row_array|\n Row.new(header: header, row_array: row_array).to_a\n }\n end",
"title": ""
},
{
"docid": "a0eaa14c50eca8aa097fb2a1599ec40e",
"score": "0.60113394",
"text": "def read_csv(file, movie_array)\n CSV.foreach(file, :headers => true) do |row|\n title = row['movie_title']\n begin\n p title\n movie = imdb.find_by_title(row['movie_title'])\n if movie.imdb_id\n movie_array.push(Movie.new({\n 'movie_title' => movie.title,\n 'imdb_id' => movie.imdb_id\n }))\n end\n rescue\n puts \"Can not find movie: #{row['movie_title']}\"\n movie_array.push(Movie.new({\n 'movie_title' => row['movie_title']\n }))\n end\n end\nend",
"title": ""
},
{
"docid": "0d52f50f19aac795f0ff81403086bfb5",
"score": "0.6010486",
"text": "def load_data\n @data ||= CSV.read(@file)\n end",
"title": ""
},
{
"docid": "c48a8b41ee867dc032bb7f5dc01db5b1",
"score": "0.6005092",
"text": "def csvfile_to_array(csv_f, header=true)\n arr_of_arrs = FasterCSV.read(csv_f)\n #puts arr_of_arrs.inspect()\n arr_of_arrs.shift() if header\n arr_of_arrs.flatten!\n\n return arr_of_arrs\n end",
"title": ""
},
{
"docid": "2c54b463623c46cd7316aba98f56651a",
"score": "0.60032016",
"text": "def read_vote_csv(file_name)\n begin\n # @type [Array<Array<String>>]\n csv = CSV.read(file_name)\n rescue Errno::ENOENT\n warn format('Sorry, the file %<File>s does not exist', File: file_name)\n exit 1\n end\n csv.delete_if { |line| line.join('') =~ /^\\s*$/ } # delete blank lines\n csv\nend",
"title": ""
},
{
"docid": "055ffc6a7a5c40c7292a0a7d992e07db",
"score": "0.59926295",
"text": "def parse\n data = CSV.parse(@input_data)\n data.shift # remove header row\n headers = [:player_key, :birth_year, :first_name, :last_name]\n data.map {|row| Hash[ *(headers.zip(row).flatten) ] }\n end",
"title": ""
},
{
"docid": "e916961be14c71d637b96027e60bfcde",
"score": "0.599098",
"text": "def parseCSV(csvfile)\n begin\n if csvfile != nil\n file_ext = File.extname(csvfile.original_filename)\n if file_ext == \".csv\"\n content = File.read(csvfile.tempfile)\n arr_of_arrs = CSV.parse(content)\n return arr_of_arrs, 0\n else\n return nil, 4\n end\n else\n return nil, 1\n end\n rescue ArgumentError\n return nil, 2\n rescue CSV::MalformedCSVError\n return nil, 3\n end\n end",
"title": ""
},
{
"docid": "72d544126646ad2f4f204e8774f22aa0",
"score": "0.5989579",
"text": "def load_report(path)\n plain_data = CSV.parse(File.read(path))\n # PP.pp plain_data, $stderr\n csv_data = []\n # do some debug logging of csv_data\n\n plain_data.each do |row|\n csv_data_row = {}\n row.each_with_index do |column,index|\n csv_data_row[@columns[index]] = column\n end\n if csv_data_row.has_key?('idx')\n csv_data.push csv_data_row\n end\n end\n csv_data\nend",
"title": ""
},
{
"docid": "1fa619b9dde268661138773d7e5becb5",
"score": "0.598549",
"text": "def import(file_path)\n array = import_ori(file_path)\n counts = array.shift\n cell_counts = get_cell_counts(counts)\n array_splitted = array.map {|a| a.split(\",\")} \n array_transpose = array_splitted.transpose\n return array_splitted, array_transpose, cell_counts\n end",
"title": ""
},
{
"docid": "5d449f799a0af3a15c4de57789fdc70f",
"score": "0.5984833",
"text": "def import_from_csv(file_name)\r\n #implementation goes here\r\n csv_text = File.read(file_name)\r\n csv = CSV.parse(csv_text, headers: true, skip_blanks: true)\r\n # #8 iterate over table rows, create hash for each, then convert to Entry using 'add_entry' method\r\n csv.each do |row|\r\n row_hash = row.to_hash\r\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\r\n end #end csv.each loop\r\n end",
"title": ""
},
{
"docid": "00646a1ce52557b688506d79550dd378",
"score": "0.5977104",
"text": "def parse\n\t\tresults = []\n\t\tif !self.csv_file_file_name.blank? &&\n\t\t\t\tFile.exists?(self.csv_file.path)\n\t\t\t(f=FasterCSV.open( self.csv_file.path, 'rb',{\n\t\t\t\t:headers => true })).each do |line|\n\n#\t\"Masterid\",\"Motherid\",\"Record_Owner\",\"Datereceived\",\"Lastatt\",\"Lastdisp\",\"Currphone\",\"Vacauthrecd\",\"Recollect\",\"Needpreincentive\",\"Active_Phone\",\"Recordsentformatching\",\"Recordreceivedfrommatching\",\"Sentpreincentive\",\"Releasedtocati\",\"Confirmedcaticontact\",\"Refused\",\"Deceasednotification\",\"Eligible\",\"Confirmationpacketsent\",\"Catiprotocolexhausted\",\"Newphonenumreleasedtocati\",\"Pleanotificationsent\",\"Casereturnedtoberkeleyfornewinf\",\"Casereturnedfromberkeley\",\"Caticomplete\",\"Kitmothersent\",\"Kitinfantsent\",\"Kitchildsent\",\"Kitadolescentsent\",\"Kitmotherrefusedcode\",\"Kitchildrefusedcode\",\"Noresponsetoplea\",\"Responsereceivedfromplea\",\"Senttoinpersonfollowup\",\"Kitmotherrecd\",\"Kitchildrecvd\",\"Thankyousent\",\"Physrequestsent\",\"Physresponsereceived\"\n\n#\n#\tThe IcfMasterTracker will include an after_save or something that will\n#\tdetermine what has changed and update appropriately. It may also\n#\tcreate OperationalEvents to document the data changes. As it is\n#\ttheoretically possible that the Masterid does not exist in the identifiers\n#\ttable, perhaps add a successfully_updated_models flag which could\n#\tbe used?\n#\n\t\t\t\ticf_master_tracker = IcfMasterTracker.find_or_create_by_Masterid(line['Masterid'])\n\t\t\t\t#\tNO BANG. Don't want to raise any errors.\n\t\t\t\tsuccessfully_updated = icf_master_tracker.update_attributes(line.to_hash)\n#\n#\terrors = icf_master_tracker.errors.full_messages.to_sentence\n#\tThese won't be validation errors as there shouldn't be any.\n#\tPerhaps \"no column by that name\" errors if csv file changes?\n#\n#\tAdd successfully_updated value?\n#\t\ticf_master_tracker.update_attribute(:sucessfully_updated, successfully_updated)\n#\twill the above include the line's attributes?\n#\n#\tAdd update_errors column?\n#\t\ticf_master_tracker.update_attribute(:update_errors, errors)\n#\n\n\t\t\t\tresults.push(icf_master_tracker)\n\n\t\t\tend\t#\t(f=FasterCSV.open( self.csv_file.path, 'rb',{ :headers => true })).each\n\t\tend\t#\tif !self.csv_file_file_name.blank? && File.exists?(self.csv_file.path)\n\t\tresults\t#\tTODO why am I returning anything? will I use this later?\n\tend",
"title": ""
},
{
"docid": "1bc551ac76e2fe85312aec7c5bd9b244",
"score": "0.597626",
"text": "def sample_from_csv(csv_uploads)\n parts = []\n csv = CSV.parse(csv_upload) if debug\n csv_uploads.each do |upload|\n csv = CSV.read(open(upload.url))\n\n first_row = csv.first\n first_row[0][0] = ''\n\n id_idx = first_row.find_index(CSV_HEADERS[0])\n loc_idx = first_row.find_index(CSV_HEADERS[1])\n csv.drop(1).each do |row|\n collection = Collection.find(row[id_idx])\n part = part_alpha_num(collection, row[loc_idx])\n parts.push(part)\n end\n end\n parts.group_by(&:containing_collection)\n end",
"title": ""
},
{
"docid": "88c59ea080ad7105bda8b051a57c4354",
"score": "0.5968448",
"text": "def read_data\n\t\tindex = 0\n\t\torders = []\n\t\tCSV.parse(@data_file.read()) do |row|\n\t\t\tif index == 0\n\t\t\t\t#header row\n\t\t\t\t@columns = parse_columns(row[0])\n\t\t\t\t# p @columns\n\t\t\telse\n\t\t\t\t# p row[0]\n \t\t\tdata = row[0].split(\"\\t\")\n \t\t\torders << parse_order(data) \n\t\t\tend\n \t\tindex += 1\n\t\tend\n\t\treturn orders\n\tend",
"title": ""
},
{
"docid": "8dc5eee51418a058ed3399aa13eb120b",
"score": "0.5961171",
"text": "def create_league(csv)\n league = []\n CSV.foreach(csv, headers: true, header_converters: :symbol) do |row|\n hash = Hash[row]\n league << hash\n end\n league\n\nend",
"title": ""
},
{
"docid": "f0d5860c113f5a9cc53c261a164d3110",
"score": "0.59572387",
"text": "def parse_csv(csv_file)\n\n # Loop through all entries in CSV file\n CSV.foreach(csv_file, :quote_char => \"\\\"\") do |row|\n next if row[0] == \"From\" && row[1] == \"To\"\n next if row[0].nil?\n\n # [0, 1] refers to the 2 addresses in the csv file\n [0, 1].each do |i|\n add_location(row[i])\n end\n\n add_journey(row)\n end\nend",
"title": ""
},
{
"docid": "abd61c8496ee3031829cd183dacef922",
"score": "0.5950835",
"text": "def loadStructure(file)\n csv_text = File.read(file)\n return CSV.parse(csv_text, :headers => true)\n \nend",
"title": ""
},
{
"docid": "d354416a4785c07af7f9da93b0c786ee",
"score": "0.5950237",
"text": "def load_genre(file_name)\n\t\tindata = []\n\t\tCSV.foreach(\"#{file_name}\", col_sep: \"|\") do |row|\n\t\t\tgenre_for_movie = [row[5].to_i,row[6].to_i,row[7].to_i,row[8].to_i,row[9].to_i,row[10].to_i,row[11].to_i,row[12].to_i,row[13].to_i,row[14].to_i,row[15].to_i,row[16].to_i,row[17].to_i,row[18].to_i,row[19].to_i,row[20].to_i,row[21].to_i,row[22].to_i,row[23].to_i ]\n\t\t\tindata.push({\"movie_id\"=>row[0].to_i,\"genres\"=>genre_for_movie})\n\t\tend\n\t\treturn indata\n\tend",
"title": ""
},
{
"docid": "c4c29c9a45a694462c4987982f1212a6",
"score": "0.5948957",
"text": "def parseCSV(csvfile)\n begin\n if csvfile != nil && csvfile != \"\"\n file_ext = File.extname(csvfile.original_filename)\n if file_ext == \".csv\"\n content = File.read(csvfile.tempfile)\n arr_of_arrs = CSV.parse(content)\n return arr_of_arrs, 0\n else\n return nil, 4\n end\n else\n return nil, 1\n end\n rescue ArgumentError\n return nil, 2\n rescue CSV::MalformedCSVError\n return nil, 3\n end\n end",
"title": ""
},
{
"docid": "2380e6990c842289a0d5d8e2ab406759",
"score": "0.594738",
"text": "def loadCSV\n csvFile = File.open(\"app/assets/csv/test.csv\", \"r\") #Open file with readpermissions\n if csvFile #if file was successfully opened \n csvRowArray = IO.readlines(csvFile) # Turn each row into an array element\n rowId=1 #0 is the Header Row, 1 is the first dataset.\n recordsArray = Array.new(csvRowArray.size-1)\n while csvRowArray[rowId] do #for each row that exists \n rowEntry = csvRowArray[rowId]\n rowEntry.gsub!(/\"/,'') # Remove all the '\"'s\n wordArr = rowEntry.split(\",\") #Split the array on ','s into a new array \n newRecord = Record.new\n newRecord.REF_DATE = wordArr[0]\n newRecord.GEO = wordArr[1]\n newRecord.DGUID = wordArr[2]\n newRecord.Sex = wordArr[3]\n newRecord.Age_group = wordArr[4]\n newRecord.Student_response = wordArr[5]\n newRecord.UOM = wordArr[6]\n newRecord.UOM_ID = wordArr[7]\n newRecord.SCALAR_FACTOR = wordArr[8]\n newRecord.SCALAR_ID = wordArr[9]\n newRecord.VECTOR = wordArr[10]\n newRecord.COORDINATE = wordArr[11]\n newRecord.VALUE = wordArr[12]\n newRecord.STATUS = wordArr[13]\n newRecord.SYMBOL = wordArr[14]\n newRecord.TERMINATED = wordArr[15]\n newRecord.DECIMALS = wordArr[16]\n newRecord.save\n puts rowId\n rowId = rowId+1 \n end\n return recordsArray\n else #file not opened\n puts \"Unable to open file\" \n return \n end \n end",
"title": ""
},
{
"docid": "992e71501bae37954dc0ccf6a65350f7",
"score": "0.59472543",
"text": "def parse_csv_file\n file = ARGV[0]\n @menu = []\n csv_contents = CSV.read(file)\n p @target = csv_contents[0][0][1..-1].to_f\n temp_menu = csv_contents[1..-1]\n temp_menu.each do |item|\n item[1] = item[1][1..-1].to_f\n end\n temp_menu.each do |fooditem|\n @menu << FoodItem.new(fooditem[0], fooditem[1])\n end\nend",
"title": ""
},
{
"docid": "fd539f205a0073a5c1808580d326f166",
"score": "0.59431356",
"text": "def csv_data\n case\n when google_key || url then Curl::Easy.perform(uri).body_str\n when file then File.open(uri).read\n end\n end",
"title": ""
},
{
"docid": "ec6551a6f491f9ee71b4eb2e24f25007",
"score": "0.5941757",
"text": "def read_data\n\t\t@testers_data = CSV.read(\"data/testers.csv\")\n\n\t\t@testers_device_data = CSV.read(\"data/tester_device.csv\")\n\n\t\t@devices_data = CSV.read(\"data/devices.csv\")\n\n\t\t@bugs_data = CSV.read(\"data/bugs.csv\")\n\tend",
"title": ""
},
{
"docid": "b565b79d5c01956be99545a34c63fd63",
"score": "0.59353894",
"text": "def load_csv\n CSV.foreach(@file_path) do |row|\n # Our CSV stores strings only - so we must initialize all our recipes\n recipe = Recipe.new(row[0],row[1])\n # We push them into the cookbook recipes array\n @recipes << recipe\n end\n end",
"title": ""
},
{
"docid": "45a257e11248881d7f9ed6662b766db8",
"score": "0.59271014",
"text": "def parse_to_load_file(csv)\n csv.each_with_index do |student, index|\n student = {month: csv[index][0] , name: csv[index][1], city: csv[index][2], hobby: csv[index][3]}\n @students << student\n end\nend",
"title": ""
},
{
"docid": "bbca301bfde4f5217b0e76a0189d78ea",
"score": "0.59153116",
"text": "def read_csv_data_from_file(full_file_path)\n data = []\n CSV.open(full_file_path, \"r\") do |csv|\n data = csv.readlines\n end\n data\n end",
"title": ""
},
{
"docid": "96f7343bf0c6aece84a02cdb01747fd1",
"score": "0.59140635",
"text": "def parse_file\n if @csv_source == \"siteimprove\"\n column_seperator = \"\\t\" \n # If using CharlockHolmes Encoding Detector, uncomment this\n #detection = CharlockHolmes::EncodingDetector.detect(contents)\n #@csv_encoding = detection[:encoding]\n @csv_encoding = \"UTF-16LE\"\n elsif @csv_source == \"google\" \n column_seperator = \",\"\n # If using CharlockHolmes Encoding Detector, uncomment this \n #detection = CharlockHolmes::EncodingDetector.detect(contents)\n #@csv_encoding = detection[:encoding]\n @csv_encoding = \"ISO-8859-1\"\n end\n contents = File.read(@csv_filename)\n output_encoding = @csv_encoding + \":UTF-8\"\n arr_csv_contents = CSV.read(@csv_filename, { :encoding => output_encoding, :headers => true, :col_sep => column_seperator, :skip_blanks => true })\n if @csv_source == \"siteimprove\"\n @site_name = \"Graduate Research\"\n @site_addr = \"http://gradresearch.unimelb.edu.au\"\n arr_csv_contents.each { |row| \n @arr_of_titles << row[0]\n @arr_of_urls << row[1]\n } \n # delete the first two rows of the array\n @arr_of_titles = @arr_of_titles.drop(2)\n @arr_of_urls = @arr_of_urls.drop(2) \n elsif @csv_source == \"google\" \n #@site_name = \"Grainger Museum\"\n @site_name = \"Varied-Sample\"\n @site_addr = \"http://www.unimelb.edu.au/\"\n arr_csv_contents.each { |row| \n @arr_of_titles << row[0]\n @arr_of_urls << row[7] #1 for grainger\n } \n end\n end",
"title": ""
},
{
"docid": "06c25b1c3dc7c1a9e062e21d3c31f7fc",
"score": "0.59101444",
"text": "def csv\n @csv_table ||= begin\n csv_raw = File.read(CSV_PATH)\n CSV.parse(csv_raw, headers: true)\n end\n\nend",
"title": ""
},
{
"docid": "6d06b678f6c5cd355f7b68ab3f8c58da",
"score": "0.59049803",
"text": "def load_students\n puts \"Which file do you want to load?\"\n file = STDIN.gets.chomp\n CSV.foreach(file) do |row|\n @name, cohort = row.shift\n write_students\n end\nend",
"title": ""
},
{
"docid": "339eb44e24eaedc16c3d0e83f5d1e104",
"score": "0.5901673",
"text": "def initPlayerNameMetaData(csvfile)\n\t\t@playerFirstName = []\n\t\t@playerSecondNameMale = []\n\t\t@playerSecondNameFemale = []\n\t\tallRows = CSV.read(csvfile,{:col_sep=>\";\"})\n\t\tif allRows and not allRows.empty?\n\t\t\ttitle = nil\n\t\t\tallRows.each_with_index do |row,i|\n\t\t\t\tif i > 1\n\t\t\t\t\[email protected](row[0]) unless row[0] == nil\n\t\t\t\t\[email protected](row[1]) unless row[1] == nil\n\t\t\t\t\[email protected](row[2]) unless row[2] == nil\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "b2f96f1dc5eb34ed7bfea2334f5bf43d",
"score": "0.5897053",
"text": "def load(path)\n if File.exists?(path)\n @data = CSV.read(path)\n @data.shift(1)\n else\n log.warning \"No data file found at #{path}\"\n @data = []\n end\n @data\n end",
"title": ""
},
{
"docid": "ae0b2f75f39f6d4112b056db333c2e50",
"score": "0.58870965",
"text": "def datat_read\n \n #Read in the csv file\n @@datat_array = CSV.read(@@datat_path_specific)\n \n #Delete the row which contains the database title.\n @@datat_array.delete_at(0)\n \n ######################################\n #puts @@datat_array[2]\n #Verify the conversion has taken place\n #puts @database + \" CSV file converted\"\n ######################################\n \n end",
"title": ""
},
{
"docid": "730c8a4022b957d20202a5189f3b33e8",
"score": "0.588588",
"text": "def getAbundants()\n\t#open file\n\tf = File.open(\"abundants.csv\", \"r\")\n\t#initialize array\n\tabs = []\n\tf.each_line do |line|\n\t\t#remove line escape\n\t\tline = line.strip\n\t\t#split into array at ,'s\n\t\tabs = line.split(',').map(&:to_i)\n\tend\n\t#close file\n\tf.close\n\t#return array\n\treturn abs\nend",
"title": ""
},
{
"docid": "ab5ce53ab2823c962c01c98b49310b9f",
"score": "0.58807874",
"text": "def read_csv_file(csv_table_path)\r\n \r\n table_dimensions = detect_state_table_dim(csv_table_path)\r\n \r\n if table_dimensions==:one_d\r\n return read_1d_csv_file(csv_table_path)\r\n elsif table_dimensions==:two_d\r\n return read_2d_csv_file(csv_table_path)\r\n else\r\n raise \"Error: CSV File dimensions: #{table_dimensions}\"\r\n end # end if else \r\n \r\n end",
"title": ""
},
{
"docid": "fd898c57805c22f03b30596361746c8d",
"score": "0.5867105",
"text": "def extract_the_data(skip)\n skip = skip\n success = true\n data_lines = 0\n data_records = []\n @array_of_lines.each_with_index do |line, n|\n next if n < skip\n\n @project.write_messages_to_all(\"Warning: line #{n} is empty.<br>\", true) if line[0..24].all?(&:blank?)\n next if line[0..24].all?(&:blank?)\n\n @record = CsvRecord.new(line, @csvfile, @project)\n success, message, result = @record.extract_data_line(n)\n if result[:birth_place_flag].present? || result[:deleted_flag].present? || result[:individual_flag].present? || result[:location_flag].present? ||\n result[:name_flag].present? || result[:occupation_flag].present? || result[:address_flag].present? || result[:deleted_flag].present?\n result[:flag] = true\n else\n result[:flag] = false\n end\n result[:record_valid] = 'true' unless result[:error_messages].present? || result[:warning_messages].present? || result[:flag]\n data_records << result\n @csvfile.total_errors = @csvfile.total_errors + 1 if result[:error_messages].present?\n @csvfile.total_warnings = @csvfile.total_warnings + 1 if result[:warning_messages].present?\n @csvfile.total_info = @csvfile.total_info + 1 if result[:info_messages].present?\n @project.write_messages_to_all(message, true) unless success\n success = true\n data_lines = data_lines + 1\n end\n [success, data_lines, data_records]\n end",
"title": ""
},
{
"docid": "a6d648293289f27e1537b6b11c6d69ba",
"score": "0.5857004",
"text": "def import_from_csv(file_name)\n csv_text = File.read(file_name)\n csv = CSV.parse(csv_text, headers: true)\n # Iterate over the table object's rows\n csv.each do |row|\n # Create a hash for each row\n row_hash = row.to_hash\n # Convert each row_hash to an Entry by using add_entry method\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\n end\n\n # Get the number of items parsed by calling the count method\n return csv.count\n end",
"title": ""
},
{
"docid": "e8e4283097ecae0564f434dc0922fe06",
"score": "0.5855226",
"text": "def load_students (filename = \"students.csv\")\n #open the filename or students.csv as default\n File.open(filename, \"r\") do |file|\n #iterate over each line in the file\n file.readlines.each do |line|\n #split at the comma and parallel assign name to the first value, cohort to the second\n name, cohort = line.chomp.split(\",\")\n #create a hash and push to the @students array using method\n @students << {name: name, cohort: cohort}\n end\n end\nend",
"title": ""
},
{
"docid": "7dcd5af3a8255c183086440d7fbf3f23",
"score": "0.5851176",
"text": "def preprocess_data(file_name = \"votes-train.csv\")\n classified_data = []\n File.open(file_name, \"r\") do |f|\n f.each_line do |line|\n next if line.chomp.empty?\n partition = line.partition(\",\")\n classified_data << [partition.last.chomp.split(\",\").map(&:to_f), partition.first.to_f]\n end\n end\n classified_data\nend",
"title": ""
},
{
"docid": "0f544d76c3462af8407d56eef657e8df",
"score": "0.58436316",
"text": "def get_variable(variable)\n\n survey_name = Survey.find(variable.survey_id).original_filename\n values_array = Array.new\n #open the dataset\n csvfile = FCSV.open( 'filestore/datasets/' + survey_name, :headers => true, :return_headers => true,:col_sep => \"\\t\")\n #skip past first line with the headers\n csvfile.gets\n #add the header as the first value of the array\n values_array.push(variable.name)\n #read each line of values\n while (line = csvfile.gets!=nil)\n #current value for this particular variable\n values_array.push(line.field[variable.name])\n end\n csvfile.close\n return values_array\n\n end",
"title": ""
},
{
"docid": "bc559484afecc2d3c6705ff44b6c641d",
"score": "0.58430517",
"text": "def load_csv\n options = { headers: :first_row, header_converters: :symbol }\n\n CSV.foreach(@csv_path, options) do |row|\n row[:id] = row[:id].to_i\n row[:price] = row[:price].to_i\n @elements << Meal.new(row)\n end\n @next_id = @elements.empty? ? 1 : @elements.last.id + 1\n end",
"title": ""
},
{
"docid": "7f2d77538587d008a05720aedbbe3287",
"score": "0.5833551",
"text": "def get_zips\n zips = CSV.read('./zips.csv', :headers => true)\n return zips\nend",
"title": ""
},
{
"docid": "0d77016f4bdcb18dd96c70687e3da723",
"score": "0.58104134",
"text": "def read_data(options={})\n orig_data = CSV.read(@filename, :skip_blanks => true)\n num_lines = orig_data.length\n if num_lines % @num_lines_per_linegroup == 0\n num_line_groups = num_lines / @num_lines_per_linegroup\n else\n raise \"ERROR: Invalid number of lines in file!\"\n end\n \n# puts \"Num Lines: #{num_lines}\"\n# puts \"************************\\n\"\n \n # array for final data\n @final_data = []\n \n # go through each line group\n num_line_groups.times do |i|\n \n # init a temp hash\n temp_hashes = []\n @data_columns.each do |col|\n temp_hashes[col] = {}\n end\n \n # grab data per linegroup\n @num_lines_per_linegroup.times do |j|\n line = orig_data[i*@num_lines_per_linegroup + j]\n field_name = @input_data_rows[j]\n # parse columns within a line\n @data_columns.each do |col|\n data = line[col]\n temp_hashes[col][field_name] = data\n # puts \" #{line[col]}\" if !line[col].nil?\n end\n end\n \n # push grabbed data onto master hash array\n temp_hashes.each do |record|\n if !record.nil?\n @final_data << record\n end\n end\n \n end # per line groups\n \nend",
"title": ""
},
{
"docid": "43a1406e78224db7328126074ac97b67",
"score": "0.5807242",
"text": "def convert_csv_file_to_object\n begin\n CSV.foreach(@file_name) do |row|\n @csv_object.push(row)\n end \n rescue => exception\n raise FileReadError, exception\n end\n end",
"title": ""
},
{
"docid": "97901e2c11508f8aa545fe0c327b7259",
"score": "0.58046955",
"text": "def parse\n results = []\n\n CSV.parse(read_data).each do |row|\n row = parse_row(row)\n keep = block_given? ? yield(row) == true : true\n results << row if keep\n end\n\n results\n end",
"title": ""
},
{
"docid": "005f5a5f322e362f239db974c221b4dd",
"score": "0.57988316",
"text": "def import_from_csv(file_name)\n csv_text = File.read(file_name)\n csv = CSV.parse(csv_text, headers: true, skip_blanks: true)\n # #8 iterate over the CSV::Table rows then create a hash for each row, convert each row_hash\n #to an Entry by using the add_entry method\n csv.each do |row|\n row_hash = row.to_hash\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\n end\n end",
"title": ""
},
{
"docid": "419b456cff5e23abe1a3afde2033789c",
"score": "0.5795851",
"text": "def import_from(file)\n raise 'File not found' unless File.exist?(file)\n CSV.foreach(file, headers: true) do |row|\n extract_streaks_data(row)\n end\n # Handle the parsed data\n [@habits, @entries]\n end",
"title": ""
},
{
"docid": "d5f72a6bc3c0e27522dcd47b1d0345d4",
"score": "0.57814205",
"text": "def load_csv(csv_path)\n raise Error::InvalidCSV unless File.exist? csv_path\n begin\n vals = CSV.read(csv_path)\n rescue CSV::MalformedCSVError\n raise Error::InvalidCSV\n end \n\n raise Error::BlankCSV if vals.length == 0\n raise Error::InvalidCSV if vals[0].length != 3\n\n # remove optional header\n vals.shift if vals[0][0] == HEADER_VAL\n\n @data = vals.collect do |data|\n {\n \"image_path\" => data[0],\n \"id\" => data[1],\n \"label\" => data[2]\n }\n end\n end",
"title": ""
}
] |
f74c29bdfc4a183e1ec1b91334cd5be2
|
Use callbacks to share common setup or constraints between actions.
|
[
{
"docid": "c514fbd1e99fc5cb8cd1a89745ad9afc",
"score": "0.0",
"text": "def set_trainer_pokemon\n @trainer_pokemon = TrainerPokemon.find(params[:id])\n end",
"title": ""
}
] |
[
{
"docid": "631f4c5b12b423b76503e18a9a606ec3",
"score": "0.60322535",
"text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end",
"title": ""
},
{
"docid": "7b068b9055c4e7643d4910e8e694ecdc",
"score": "0.6012846",
"text": "def on_setup_callbacks; end",
"title": ""
},
{
"docid": "311e95e92009c313c8afd74317018994",
"score": "0.5923006",
"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.59147197",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.59147197",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "bfea4d21895187a799525503ef403d16",
"score": "0.5898899",
"text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.58905005",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.58905005",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.58905005",
"text": "def actions; end",
"title": ""
},
{
"docid": "352de4abc4d2d9a1df203735ef5f0b86",
"score": "0.58899754",
"text": "def required_action\n # TODO: implement\n end",
"title": ""
},
{
"docid": "8713cb2364ff3f2018b0d52ab32dbf37",
"score": "0.58778226",
"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.5863685",
"text": "def actions\n\n end",
"title": ""
},
{
"docid": "930a930e57ae15f432a627a277647f2e",
"score": "0.58098996",
"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.5740018",
"text": "def setup\n common_setup\n end",
"title": ""
},
{
"docid": "a5ca4679d7b3eab70d3386a5dbaf27e1",
"score": "0.5730792",
"text": "def perform_setup\n end",
"title": ""
},
{
"docid": "ec7554018a9b404d942fc0a910ed95d9",
"score": "0.57159567",
"text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.56995213",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "c85b0efcd2c46a181a229078d8efb4de",
"score": "0.5692253",
"text": "def custom_setup\n\n end",
"title": ""
},
{
"docid": "100180fa74cf156333d506496717f587",
"score": "0.5668434",
"text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend",
"title": ""
},
{
"docid": "2198a9876a6ec535e7dcf0fd476b092f",
"score": "0.5652364",
"text": "def initial_action; end",
"title": ""
},
{
"docid": "b9b75a9e2eab9d7629c38782c0f3b40b",
"score": "0.5649457",
"text": "def setup_intent; end",
"title": ""
},
{
"docid": "471d64903a08e207b57689c9fbae0cf9",
"score": "0.5637111",
"text": "def setup_controllers &proc\n @global_setup = proc\n self\n end",
"title": ""
},
{
"docid": "468d85305e6de5748477545f889925a7",
"score": "0.56268275",
"text": "def inner_action; end",
"title": ""
},
{
"docid": "bb445e7cc46faa4197184b08218d1c6d",
"score": "0.56099206",
"text": "def pre_action\n # Override this if necessary.\n end",
"title": ""
},
{
"docid": "432f1678bb85edabcf1f6d7150009703",
"score": "0.5595526",
"text": "def target_callbacks() = commands",
"title": ""
},
{
"docid": "48804b0fa534b64e7885b90cf11bff31",
"score": "0.55951923",
"text": "def execute_callbacks; end",
"title": ""
},
{
"docid": "5aab98e3f069a87e5ebe77b170eab5b9",
"score": "0.55885196",
"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.55564445",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.55564445",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "482481e8cf2720193f1cdcf32ad1c31c",
"score": "0.5509468",
"text": "def required_keys(action)\n\n end",
"title": ""
},
{
"docid": "353fd7d7cf28caafe16d2234bfbd3d16",
"score": "0.5502921",
"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.5466533",
"text": "def layout_actions\n \n end",
"title": ""
},
{
"docid": "2f6ef0a1ebe74f4d79ef0fb81af59d40",
"score": "0.54644245",
"text": "def on_setup(&block); end",
"title": ""
},
{
"docid": "8ab2a5ea108f779c746016b6f4a7c4a8",
"score": "0.5448076",
"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.5445466",
"text": "def before(action)\n invoke_callbacks *options_for(action).before\n end",
"title": ""
},
{
"docid": "6bd37bc223849096c6ea81aeb34c207e",
"score": "0.54391384",
"text": "def post_setup\n end",
"title": ""
},
{
"docid": "07fd9aded4aa07cbbba2a60fda726efe",
"score": "0.54171526",
"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.54118705",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.54118705",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "9358208395c0869021020ae39071eccd",
"score": "0.5398984",
"text": "def post_setup; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.53935355",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.53935355",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "cb5bad618fb39e01c8ba64257531d610",
"score": "0.53924096",
"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": "a468b256a999961df3957e843fd9bdf4",
"score": "0.53874743",
"text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end",
"title": ""
},
{
"docid": "f099a8475f369ce73a38d665b6ee6877",
"score": "0.5379617",
"text": "def action_run\n end",
"title": ""
},
{
"docid": "2c4e5a90aa8efaaa3ed953818a9b30d2",
"score": "0.53577393",
"text": "def execute(setup)\n @action.call(setup)\n end",
"title": ""
},
{
"docid": "725216eb875e8fa116cd55eac7917421",
"score": "0.53494817",
"text": "def setup\n @controller.setup\n end",
"title": ""
},
{
"docid": "118932433a8cfef23bb8a921745d6d37",
"score": "0.5347875",
"text": "def register_action(action); end",
"title": ""
},
{
"docid": "39c39d6fe940796aadbeaef0ce1c360b",
"score": "0.5346792",
"text": "def setup_phase; end",
"title": ""
},
{
"docid": "bd03e961c8be41f20d057972c496018c",
"score": "0.5344054",
"text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end",
"title": ""
},
{
"docid": "c6352e6eaf17cda8c9d2763f0fbfd99d",
"score": "0.53416806",
"text": "def initial_action=(_arg0); end",
"title": ""
},
{
"docid": "207a668c9bce9906f5ec79b75b4d8ad7",
"score": "0.53265905",
"text": "def before_setup\n\n end",
"title": ""
},
{
"docid": "669ee5153c4dc8ee81ff32c4cefdd088",
"score": "0.53036004",
"text": "def ensure_before_and_after; end",
"title": ""
},
{
"docid": "c77ece7b01773fb7f9f9c0f1e8c70332",
"score": "0.5284624",
"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.5283799",
"text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"title": ""
},
{
"docid": "4ad1208a9b6d80ab0dd5dccf8157af63",
"score": "0.5256181",
"text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end",
"title": ""
},
{
"docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7",
"score": "0.52549016",
"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.52492326",
"text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end",
"title": ""
},
{
"docid": "8945e9135e140a6ae6db8d7c3490a645",
"score": "0.52462375",
"text": "def action_awareness\n if action_aware?\n if [email protected]?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52388823",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52388823",
"text": "def action; end",
"title": ""
},
{
"docid": "7b3954deb2995cf68646c7333c15087b",
"score": "0.52384317",
"text": "def after_setup\n end",
"title": ""
},
{
"docid": "1dddf3ac307b09142d0ad9ebc9c4dba9",
"score": "0.5233074",
"text": "def external_action\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "5772d1543808c2752c186db7ce2c2ad5",
"score": "0.52307343",
"text": "def actions(state:)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "64a6d16e05dd7087024d5170f58dfeae",
"score": "0.52247876",
"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.5221976",
"text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"title": ""
},
{
"docid": "db0cb7d7727f626ba2dca5bc72cea5a6",
"score": "0.52215284",
"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.5215321",
"text": "def pick_action; end",
"title": ""
},
{
"docid": "7bbfb366d2ee170c855b1d0141bfc2a3",
"score": "0.5213458",
"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.5209029",
"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.5206747",
"text": "def ac_action(&blk)\n @action = blk\n end",
"title": ""
},
{
"docid": "4c23552739b40c7886414af61210d31c",
"score": "0.52043396",
"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": "6a98e12d6f15af80f63556fcdd01e472",
"score": "0.5203811",
"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.5202598",
"text": "def create_setup\n \n end",
"title": ""
},
{
"docid": "691d5a5bcefbef8c08db61094691627c",
"score": "0.52015066",
"text": "def performed(action)\n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.51961863",
"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.51961863",
"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.5190015",
"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.5179595",
"text": "def setup(instance)\n action(:setup, instance)\n end",
"title": ""
},
{
"docid": "9f1f73ee40d23f6b808bb3fbbf6af931",
"score": "0.5177569",
"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.51727664",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51727664",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51727664",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "7a0c9d839516dc9d0014e160b6e625a8",
"score": "0.5163597",
"text": "def setup(request)\n end",
"title": ""
},
{
"docid": "e441ee807f2820bf3655ff2b7cf397fc",
"score": "0.51522565",
"text": "def after_setup; end",
"title": ""
},
{
"docid": "1d375c9be726f822b2eb9e2a652f91f6",
"score": "0.51422286",
"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.5142005",
"text": "def code_action_provider; end",
"title": ""
},
{
"docid": "faddd70d9fef5c9cd1f0d4e673e408b9",
"score": "0.5140699",
"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.51397085",
"text": "def setup(params)\n end",
"title": ""
},
{
"docid": "111fd47abd953b35a427ff0b098a800a",
"score": "0.5134159",
"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.5115907",
"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.5113603",
"text": "def setup\n transition_to(:setup)\n end",
"title": ""
},
{
"docid": "4c7a1503a86fb26f1e4b4111925949a2",
"score": "0.51112026",
"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": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110439",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110439",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5110439",
"text": "def action\n end",
"title": ""
},
{
"docid": "63849e121dcfb8a1b963f040d0fe3c28",
"score": "0.51074827",
"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.5105795",
"text": "def block_actions options ; end",
"title": ""
},
{
"docid": "0d1c87e5cf08313c959963934383f5ae",
"score": "0.50995123",
"text": "def on_action(action)\n @action = action\n self\n end",
"title": ""
},
{
"docid": "916d3c71d3a5db831a5910448835ad82",
"score": "0.5096676",
"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": "b2a4ff1f0080ca2a1e6e22f77f907573",
"score": "0.50926304",
"text": "def commit\n if valid?\n callback_process = setup(controller)\n controller.after_filter callback_process, :only => action_name\n controller\n else\n Innsights::ErrorMessage.log(\"#{controller_name} class has no valid method #{action_name}\")\n end\n end",
"title": ""
}
] |
bd46655487e116043045eba954b82754
|
POST /jsons POST /jsons.json
|
[
{
"docid": "d44012b1d30d2477b0a5e7ca342a2227",
"score": "0.6225652",
"text": "def create\n @json = Json.new(json_params)\n\n respond_to do |format|\n if @json.save\n format.html { redirect_to @json, notice: 'Json was successfully created.' }\n format.json { render :show, status: :created, location: @json }\n else\n format.html { render :new }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "234e0cd2c934cd0f44645f586f380f78",
"score": "0.66106015",
"text": "def post_json(url, data)\n JSON.parse(post(url, data, :json, :json))\n end",
"title": ""
},
{
"docid": "a9bcbeb132f75be6f14edcf5169e243b",
"score": "0.6603012",
"text": "def post(json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name].compact.join('/')\n url += \"/\"\n return HTTParty.post(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end",
"title": ""
},
{
"docid": "831d09e32c516f811a9fa4e7e33e3d15",
"score": "0.64950955",
"text": "def post_json(location, json_data)\n response = RestClient::Request.new(\n :method => :post,\n :url => location,\n :user => $username,\n :password => $password,\n :headers => { :accept => :json,\n :content_type => :json},\n :payload => json_data\n ).execute\n results = JSON.parse(response.to_str)\n end",
"title": ""
},
{
"docid": "831d09e32c516f811a9fa4e7e33e3d15",
"score": "0.64950955",
"text": "def post_json(location, json_data)\n response = RestClient::Request.new(\n :method => :post,\n :url => location,\n :user => $username,\n :password => $password,\n :headers => { :accept => :json,\n :content_type => :json},\n :payload => json_data\n ).execute\n results = JSON.parse(response.to_str)\n end",
"title": ""
},
{
"docid": "658751e62138cca8e2a94212c458dc43",
"score": "0.6327889",
"text": "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts JSON.pretty_generate(result)\n result\nend",
"title": ""
},
{
"docid": "d77991258c568a7d5f5a46e91e570906",
"score": "0.6288449",
"text": "def post_json(url, body = nil, headers = nil)\n body = body.to_json\n headers = (headers || {}).merge('Content-Type' => 'application/json')\n post(url, body, headers)\n end",
"title": ""
},
{
"docid": "e925b32b0c711578a640b62a4637b745",
"score": "0.6208879",
"text": "def post_json(path, body)\n uri = build_uri(path)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n result = JSON.parse(response.body)\n puts result\n result\nend",
"title": ""
},
{
"docid": "484ab5cf9c3a31130136ff2f02ee9dbf",
"score": "0.61790925",
"text": "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend",
"title": ""
},
{
"docid": "f1807bc7e1ef96a82829142f59359cd5",
"score": "0.616864",
"text": "def post_json(path, body)\n uri = build_uri(path)\n #puts \"🤖 POST #{path}\"\n #puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n #puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n #puts result[:result]\n result\nend",
"title": ""
},
{
"docid": "31cbf80ef614bf89e74ca0f0a3fe4a2e",
"score": "0.6132781",
"text": "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{uri}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend",
"title": ""
},
{
"docid": "903001ea6efde3b43891012a1db3a141",
"score": "0.61035347",
"text": "def post_json(path, body)\n url = [base_url, path].join\n resp = HTTParty.post(url, headers: standard_headers, body: body.to_json)\n parse_json(url, resp)\n end",
"title": ""
},
{
"docid": "5cd9a347274b149ae208912133c75db6",
"score": "0.60257006",
"text": "def post(path, json, params = {})\n if path.include?('covid19')\n request = Net::HTTP::Post.new(path, @headers)\n else\n request = Net::HTTP::Post.new('/v2' + path, @headers)\n end\n request.add_field('Content-Type', 'application/json')\n request.body = json\n params.each do |k, v|\n request[k] = v\n end\n send_request(request)\n end",
"title": ""
},
{
"docid": "24723552db2d4dfaaa9de94bd684dbbe",
"score": "0.5953365",
"text": "def post(*args)\n super(*wrap_for_json_api(*args))\n end",
"title": ""
},
{
"docid": "537f9e258a43e3d1eb8a90185aa4861e",
"score": "0.59307003",
"text": "def post_accounts(json_hash)\n @options = {:path => '/users.json',\n :body => json_hash[:json]}.merge(@options)\n\n request(\n :expects => 201,\n :method => :post,\n :body => @options[:body]\n )\n end",
"title": ""
},
{
"docid": "c12bac371e5899b0a4f3b3fb0290590e",
"score": "0.5902952",
"text": "def postJSON(path, data)\n response = self.class.post(path, body: data.to_json)\n @response_class ? @response_class.parse(response) : response\n end",
"title": ""
},
{
"docid": "d11567b87d693cd5ddaad8737d9ef13b",
"score": "0.58726823",
"text": "def set_json\n File.open('public/json.json', 'wb') do |f|\n f.write(params[:json])\n end\n\n render json: {response: 'successful'}\n end",
"title": ""
},
{
"docid": "4725e14848f6ffba1a331fc091057521",
"score": "0.58722943",
"text": "def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end",
"title": ""
},
{
"docid": "6d189c3d68db1a35583ca078b053d7c6",
"score": "0.58681947",
"text": "def json_post\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n puts \"json_post: submitting #{params[:path]}\" if @@debug\n path = params[:path]\n if path\n puts \"json_post: path is #{path} l=#{path.length}\" if @@debug\n path = path.split('/').compact()\n path.delete('')\n # you cannot make rooted nodes via json atm... fix? xxx\n if path.length > 1\n name = path.pop\n nodes = Note.make_path @user,path\n puts \"json_post: making at path #{path.join('/')}\" if @@debug\n if nodes\n note = nodes.last.make_child @user,params,name\n puts \"json_post: made child #{note} from #{name} l=#{name.length}\"\n params[:path] = path.join('/') # for call to json_query\n # it is important to do a query rather than returning the note; to get freshest order\n json_query\n return\n #write_json note if note\n end\n end\n end\n render :nothing => true\n end",
"title": ""
},
{
"docid": "ccbe993cec79489b3c2a8eaf7a887bb9",
"score": "0.57633543",
"text": "def post(path, data = {})\n request 'POST', path, body: data.to_json\n end",
"title": ""
},
{
"docid": "cc872a9f662a63ff2f1b4b7ed3d8699f",
"score": "0.57538605",
"text": "def post(url, payload, headers={})\n payload = MultiJson.encode(payload)\n headers = headers.merge({:content_type => 'application/json'})\n request(:post, url, payload, headers)\n end",
"title": ""
},
{
"docid": "7e77fc6f4b958d034801c3148e336197",
"score": "0.57420915",
"text": "def post(url, payload = {}, headers = {})\n http :post, \"#{url}.json\", payload.to_json, headers\n end",
"title": ""
},
{
"docid": "108c340500a41a38c28b343eb095f0de",
"score": "0.57023716",
"text": "def json_params\n params.require(:json).permit(:type, :data)\n end",
"title": ""
},
{
"docid": "29075cfcceab2be9e9a284769fc11ab1",
"score": "0.56996894",
"text": "def postEntityBulkJson( data)\n params = Hash.new\n params['data'] = data\n return doCurl(\"post\",\"/entity/bulk/json\",params)\n end",
"title": ""
},
{
"docid": "93f5cd86276ac82fd4b856b212885a52",
"score": "0.5647409",
"text": "def test_post_sample_traces\n header 'Content-Type', 'application/json'\n\n (0..4).each do |i|\n data = File.read \"sample-traces/#{i}.json\"\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n assert last_response.ok?\n end\n end",
"title": ""
},
{
"docid": "e68624a0fd0baa2e6be5ae5c0c0876a0",
"score": "0.55974054",
"text": "def create\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n @survey = Survey.new(json)\n respond_to do |format|\n if @survey.save\n format.html { redirect_to @survey, notice: 'Survey was successfully created.' }\n format.json { render json: @survey, status: :created, location: @survey }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1696d5d4d22767f1a79db670670b4d3b",
"score": "0.5592463",
"text": "def create\n render json: Post.create(params[\"post\"])\n end",
"title": ""
},
{
"docid": "a3e19672e592c0607c0e0ce3beca4904",
"score": "0.5580578",
"text": "def post_json(url, ls_data)\n uri = URI.parse(url)\n request = Net::HTTP::Post.new(uri.request_uri, HEADER_JSON)\n request.body = ls_data\n request.basic_auth(@nsx_user, @nsx_password)\n response = Net::HTTP.start(uri.host, uri.port, :use_ssl => true,\n :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |https|\n https.request(request)\n end\n return JSON.parse(response.body)['id'] \\\n if check_response(response, 201)\n end",
"title": ""
},
{
"docid": "0bb7467deaf364a9a1c8dd68e95bfbed",
"score": "0.5559394",
"text": "def call method, args = {}\n unless args.is_a? Hash\n raise ArgumentError.new \"argument must be a Hash\"\n end\n\n args.each_key do |key|\n if args[key].is_a?(Array) || args[key].is_a?(Hash)\n args[key] = JSON.dump(args[key])\n end\n end\n\n @faraday.post method, args\n end",
"title": ""
},
{
"docid": "6cbcaa6829a58339fb1a2188a2a29e93",
"score": "0.5532635",
"text": "def post(path, form_data=nil)\n parse_json do |parser|\n @http_client.post(path, form_data) {|chunk| parser << chunk }\n end\n end",
"title": ""
},
{
"docid": "8a1972e283290cd899f5d7627a2afd90",
"score": "0.54961324",
"text": "def post_api(path, params={}, headers={})\n headers.merge!('CONTENT_TYPE' => \"application/json\")\n post path, params, headers\nend",
"title": ""
},
{
"docid": "473b30db0eeb1c776fb1ad24f7a7ecc8",
"score": "0.54917985",
"text": "def post_json(endpoint, payload, username = nil, password = nil, endpoint_stub = API_ENDPOINT)\n uri = URI(\"#{endpoint_stub}#{endpoint}\")\n\n res = ''\n Net::HTTP.start(uri.host, uri.port,\n :use_ssl => uri.scheme == 'https', \n :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|\n req = Net::HTTP::Post.new(uri.request_uri)\n req.basic_auth(username, password) if username && password\n req['Content-Type'] = 'application/json'\n req.body = payload.to_json\n\n res = http.request(req)\n end\n\n JSON.parse(res.body.to_s)\nend",
"title": ""
},
{
"docid": "e96344f06a80544d59d61a9378de8d54",
"score": "0.54803735",
"text": "def create\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Post.new('/offsets.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids','itemids'])\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(','), :amount => params['amount'], :type => params['type']})\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n end",
"title": ""
},
{
"docid": "8a7679375791532542a9a2c78fd2cf6e",
"score": "0.54498553",
"text": "def put_json(url, data)\n JSON.parse(put(url, data, :json, :json))\n end",
"title": ""
},
{
"docid": "37aca872b5c4b71df42d08d463c1629d",
"score": "0.5436671",
"text": "def postBusinessJsonProcess( entity_id, json)\n params = Hash.new\n params['entity_id'] = entity_id\n params['json'] = json\n return doCurl(\"post\",\"/business/json/process\",params)\n end",
"title": ""
},
{
"docid": "96a137e20af5a438cc4d7593c02803b4",
"score": "0.54313004",
"text": "def post(path, data = {}, params = {})\n body = data.to_json\n path = File.join(@prefix, path)\n\n response = @conn.post(path, body) do |req|\n req.params = params\n req.headers['Content-Type'] = 'application/json'\n end\n\n JSON.parse response.body\n end",
"title": ""
},
{
"docid": "993dd5b5001c7b37f8db6d50fce525f9",
"score": "0.53955317",
"text": "def request_json\n @request.headers[\"Content-Type\"] = 'application/json'\n @request.headers[\"Accept\"] = 'application/json'\n end",
"title": ""
},
{
"docid": "112318278b501b9b531be1765dd44ae6",
"score": "0.53861916",
"text": "def post(api, params)\n url2json(:POST, \"#{@endpoint}#{api}\", params)\n end",
"title": ""
},
{
"docid": "f57d6fc8d77bb99eefe2021e73d9257c",
"score": "0.5364466",
"text": "def create\n streak, success = jsonapi_create.to_a\n\n if success\n render_jsonapi(streak, scope: false)\n else\n render_errors_for(streak)\n end\n end",
"title": ""
},
{
"docid": "a92583bffd26a19b687e57ca4d67d729",
"score": "0.53588575",
"text": "def post(url, json_body)\n setup_or_refresh_rest_session\n @session.post(url: url, json_body: json_body)\n end",
"title": ""
},
{
"docid": "48929d3dd4b027fa2ef8d87d09c87a97",
"score": "0.53296286",
"text": "def create(url, data)\n RestClient.post ENV['APIBASE']+url, data, :content_type => :json\nend",
"title": ""
},
{
"docid": "5bad2b1da672142701f467752e4794b3",
"score": "0.5327641",
"text": "def request_with_json(method, url, json)\n unless json.kind_of?(String)\n json = json.to_json\n end\n\n # peeked at the rack implementation to figure out the necessary\n # keys here.\n self.send(method, url, nil,\n 'CONTENT_TYPE' => 'application/json',\n 'CONTENT_LENGTH' => json.length,\n 'rack.input' => StringIO.new(json))\n end",
"title": ""
},
{
"docid": "d5e419c9cacc02ccecc30dadbf9501d5",
"score": "0.52980953",
"text": "def create_multiple\n puts params\n\n @ticker_activities = params[\"_json\"].map do |params_hash|\n # ToDo => whitelisted_params einbauen. Siehe mein Beitrag bei stackoverflow unter http://stackoverflow.com/questions/35082478/handling-json-array-from-android-in-rails\n ticker = TickerActivity.create!(params_hash) \n end\n\n respond_to do |format|\n # Check that all the ticker_activities are valid and can be saved\n if @ticker_activities.all? { |ticker_activity| ticker_activity.valid? }\n # Now we know they are valid save each ticker_activity\n @ticker_activities.each do |ticker_activity|\n ticker_activity.save\n end\n\n # Respond with the json versions of the saved ticker_activites\n format.json { render json: @ticker_activities, status: :created, location: multiple_ticker_locations_url }\n \n else\n # We can't save *all* the ticker_activities so we\n # respond with the corresponding validation errors for the ticker_activities\n @errors = @ticker_activities.map { |ticker_activity| ticker_activity.errors }\n format.json { render json: @errors, status: :unprocessable_entity }\n end\n end\nend",
"title": ""
},
{
"docid": "31410e7bf6fcd9d0223beb33bde6d8fa",
"score": "0.5289442",
"text": "def batch(*requests)\n body = requests.map do |request|\n {method: request[0], params: request[1..-1], jsonrpc: '2.0', id: SecureRandom.uuid}\n end\n parsed_response = parse_response(post(body))\n errors = parsed_response.select{|response| response[:error]}\n raise Error, errors if !errors.empty?\n parsed_response.map{|response| response[:result]}\n end",
"title": ""
},
{
"docid": "d81eaa69ed4e5fa36ba6932d3cee3ee6",
"score": "0.52776104",
"text": "def api_post(action, data)\n api_request(action, data, 'POST')\n end",
"title": ""
},
{
"docid": "0f3639792bcdff513d9e0ad423a0c9cd",
"score": "0.5265987",
"text": "def data_to_api(snack_name, snack_location, snack_optional)\n RestClient.post ENV['NERDERY_API'], { name: snack_name,\n location: snack_location,\n optional: snack_optional\n }.to_json, content_type: :json\n end",
"title": ""
},
{
"docid": "949f4e95eeb6fa7980eea6d6b6114820",
"score": "0.5265395",
"text": "def forward_json(reading_json)\n #uri = URI.parse(\"http://cmu-sensor-network.herokuapp.com/sensors\")\n uri = URI.parse(\"http://209.129.244.9/sensors\")\n post_json_request = Net::HTTP::Post.new(uri.request_uri)\n post_json_request.add_field(\"Content-Type\", \"application/json\")\n post_json_request.body = reading_json\n http = Net::HTTP::new(uri.host, uri.port)\n response = http.request(post_json_request)\n return response\n end",
"title": ""
},
{
"docid": "9bad908ebc0c370837d0da06933277bf",
"score": "0.5261881",
"text": "def add_json(file)\n new_json = parse_json_file(file)\n store_all_cities(new_json)\n store_all_routes(new_json)\n end",
"title": ""
},
{
"docid": "1af70a5d78bc26556c638619f8b8bfd1",
"score": "0.5261689",
"text": "def create\n if json_path = params[:file]\n json = JSON.parse(json_path.read)\n raise StandardError, 'Must be Array' unless json.is_a? Array\n\n ActiveRecord::Base.transaction do\n form = Form.create! name: json_path.original_filename\n json.each do |qa|\n raise StandardError, 'Must be Hash.' unless qa.is_a? Hash\n question = Question.create! text: qa['question'], form_id: form.id\n %w(1 2 3 4).each do |nr|\n Answer.create! text: qa[nr], question_id: question.id\n end\n end\n end\n # there's probably a much better way to to nested model saving than this\n render :json => json\n return\n end\n end",
"title": ""
},
{
"docid": "4b8f75c24085311da8bd6b490427966c",
"score": "0.52539957",
"text": "def with_json(json)\n @headers['Content-Type'] ||= 'application/json'\n with_body(json)\n end",
"title": ""
},
{
"docid": "572a4ff46803fa455ca2688a6bc5294b",
"score": "0.5229765",
"text": "def put_json_in_path(path, json_data)\n res = nil\n uri = URI(@url + path)\n req = Net::HTTP::Post.new(uri)\n req['X-Vault-Token'] = @token\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|\n req.body = if json_data.class == Hash\n json_data.to_json\n else\n json_data\n end\n http.request(req)\n end\n res.code.to_i\n end",
"title": ""
},
{
"docid": "18624d9e08a28406eb270863fc680ca5",
"score": "0.52284783",
"text": "def post(method, args=nil)\n http = new_http\n\n if api_key\n args[:api_key] = api_key\n end\n\n if api_version\n args[:api_version] = api_version\n end\n\n request = Net::HTTP::Post.new('/api/' + method)\n\n if args\n request.set_form_data(args)\n end\n\n result = invoke(http, request)\n JSON.parse(result.body)\n end",
"title": ""
},
{
"docid": "3ba47138e15194b3a88c5997ff500392",
"score": "0.522575",
"text": "def http_post(url, data)\n\turi = URI(url)\n\treq = Net::HTTP::Post.new(uri.path, initheader = {'Content-Type' =>'application/json'})\n req.body = data.to_json\n response = Net::HTTP.new(uri.host, uri.port).start {|http| http.request(req) }\n return response\nend",
"title": ""
},
{
"docid": "4976fcf1427457819182a9c35b1c5202",
"score": "0.52129465",
"text": "def post_data(body)\r\n raise ConfigError, 'no json_records' if body.empty?\r\n # Create REST request header\r\n header = get_header(body.bytesize)\r\n # Post REST request \r\n response = RestClient.post(@uri, body, header)\r\n\r\n return response\r\n end",
"title": ""
},
{
"docid": "9460b17902e05b9651a8d01cd894e7a5",
"score": "0.5201336",
"text": "def test_should_create_post_via_API_JSON\r\n get \"/logout\"\r\n post \"/forum_posts.json\", :api_key=>'testapikey',\r\n :forum_post => {:title=>'API Test Post',\r\n :body=>'Test Post desc',\r\n :user_id=>1}\r\n assert_response :created\r\n topic = JSON.parse(response.body)\r\n assert topic['title'] == 'API Test Post', 'Incorrect topic title'\r\n assert topic['user_id'] == 1, 'Incorrect user id'\r\n assert topic['body'] == 'Test Post desc', 'Incorrect topic description' \r\n end",
"title": ""
},
{
"docid": "72d272ad08cf351b071fa5c3a98ffe97",
"score": "0.51951134",
"text": "def post(request)\n # sure thing!\n json_response(200, { message: \"This dummy POST endpoint didn't do anything.\" })\n end",
"title": ""
},
{
"docid": "6fd6f3b50b2346b832b7b9d83f8aea9c",
"score": "0.5174843",
"text": "def index\n @jsons = Json.all\n\n\n end",
"title": ""
},
{
"docid": "97cdf83cb4269114fac242317aa6e9b4",
"score": "0.5169954",
"text": "def index\n @jsons = Json.all\n end",
"title": ""
},
{
"docid": "719e876e148a862b570e839c5725b7a8",
"score": "0.5164882",
"text": "def create\n @test = Test.create!(test_params)\n\n render json: @test\n end",
"title": ""
},
{
"docid": "1ca5f2c21af5ddfbbcd53b4ca31817a0",
"score": "0.5164037",
"text": "def post(*args)\n request :post, *args\n end",
"title": ""
},
{
"docid": "f1d24b47ecc4c4f869514d22dddb0781",
"score": "0.51506627",
"text": "def putBusinessJson( json, country, timezone, master_entity_id, queue_priority)\n params = Hash.new\n params['json'] = json\n params['country'] = country\n params['timezone'] = timezone\n params['master_entity_id'] = master_entity_id\n params['queue_priority'] = queue_priority\n return doCurl(\"put\",\"/business/json\",params)\n end",
"title": ""
},
{
"docid": "0962039645fba192bc9f2348f47798fb",
"score": "0.51433104",
"text": "def post(*args)\n request(:post, *args)\n end",
"title": ""
},
{
"docid": "7ad13e662a54f7b0e868ae34ee4d0489",
"score": "0.5136749",
"text": "def create\n @prueba_json = PruebaJson.new(prueba_json_params)\n\n respond_to do |format|\n if @prueba_json.save\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully created.' }\n format.json { render action: 'show', status: :created, location: @prueba_json }\n else\n format.html { render action: 'new' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "873ef76d14be177b8c22a29b80545833",
"score": "0.51360893",
"text": "def save_json(dir)\n save_json_one(dir, country_data, 'country')\n save_json_one(dir, us_state_data,'us_state')\n save_json_one(dir, us_metro_data, 'us_metro')\n save_json_one(dir, us_county_data, 'us_county')\n\n bn = File.basename(dir)\n dn = File.dirname(dir)\n\n\n puts \"Uploading json data\"\n Dir[File.join(dir,'*.json')].each do |path|\n bn = File.basename(path)\n dn = File.dirname(path)\n cmd = \"curl -u '[email protected]:Pp[31415926]' --ftp-create-dirs -s -T #{dn}/#{bn} ftp://160.153.91.2/standalone/#{bn}\"\n r = `#{cmd} 2>&1`.chomp\n r = ' - ERRORS: ' + r unless r.empty?\n puts \" #{bn}#{r}\"\n end\n end",
"title": ""
},
{
"docid": "818a668461eacd121f2fc6d20b8482b0",
"score": "0.51306945",
"text": "def post endpoint, data\n do_request :post, endpoint, data\n end",
"title": ""
},
{
"docid": "179a02f5a12e9b9b6d36bdf6fd22242d",
"score": "0.51247036",
"text": "def create\n params[:url_list].each do |url|\n WebUrl.new(:url => url).save\n end\n render :json=>params[:url_list].to_json\n end",
"title": ""
},
{
"docid": "a4fccd3ab7f2fa75c496339e8a9ea7f5",
"score": "0.51125014",
"text": "def json_create(resource_params, resource_model)\n resource_obj = resource_model.new(resource_params)\n if resource_obj.save\n return render json: resource_obj, status: :ok\n else\n return render json: resource_obj.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "ec541d67d805569f6c34c6c1f90438b7",
"score": "0.51112306",
"text": "def create\n # render json: params\n render json: Users.create(params[\"user\"])\n end",
"title": ""
},
{
"docid": "4794c3e6e2db462f4d8769453efddedd",
"score": "0.51084363",
"text": "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end",
"title": ""
},
{
"docid": "a96a80d9e3d715babc1494cd4a40196d",
"score": "0.5108224",
"text": "def create_method\n :put_json\n end",
"title": ""
},
{
"docid": "223cde455faacd2a7a556f079ffc6a33",
"score": "0.5098842",
"text": "def post(*args)\n prepare_request(:post, args)\n @@client.add(:post, @path, *args)\n end",
"title": ""
},
{
"docid": "4714a87ad0c5a705fa8788c80f9a4d03",
"score": "0.5086615",
"text": "def http_post(path, request)\n @http.post(\n :body => JSON(:request => request.to_hash),\n :headers => headers,\n :path => \"/api/v2/#{path}\",\n :expects => [200, 201, 202]\n )\n end",
"title": ""
},
{
"docid": "ccea12c06c2f87afb26b01aa30f56d12",
"score": "0.50778836",
"text": "def make_json_request( opts={} )\n\t\topts = TEST_JSON_REQUEST_OPTS.merge( opts )\n\t\theaders = normalize_headers( opts, TEST_JSON_HEADERS )\n\t\theaders.delete( 'URI' ) # JSON requests don't have one\n\n\t\tMongrel2.log.debug \"JSON request, headers = %p, opts = %p\" % [ headers, opts ]\n\n\t\theaderstring = TNetstring.dump( Yajl::Encoder.encode(headers) )\n\t\tbodystring = TNetstring.dump( Yajl::Encoder.encode(opts[:body] || []) )\n\n\t\t# UUID ID PATH SIZE:HEADERS,SIZE:BODY,\n\t\tdata = \"%s %d %s %s%s\" % [\n\t\t\topts[:uuid],\n\t\t\topts[:id],\n\t\t\topts[:path],\n\t\t\theaderstring,\n\t\t\tbodystring,\n\t\t]\n\t\treturn data.encode( 'binary' )\n\tend",
"title": ""
},
{
"docid": "ccea12c06c2f87afb26b01aa30f56d12",
"score": "0.50778836",
"text": "def make_json_request( opts={} )\n\t\topts = TEST_JSON_REQUEST_OPTS.merge( opts )\n\t\theaders = normalize_headers( opts, TEST_JSON_HEADERS )\n\t\theaders.delete( 'URI' ) # JSON requests don't have one\n\n\t\tMongrel2.log.debug \"JSON request, headers = %p, opts = %p\" % [ headers, opts ]\n\n\t\theaderstring = TNetstring.dump( Yajl::Encoder.encode(headers) )\n\t\tbodystring = TNetstring.dump( Yajl::Encoder.encode(opts[:body] || []) )\n\n\t\t# UUID ID PATH SIZE:HEADERS,SIZE:BODY,\n\t\tdata = \"%s %d %s %s%s\" % [\n\t\t\topts[:uuid],\n\t\t\topts[:id],\n\t\t\topts[:path],\n\t\t\theaderstring,\n\t\t\tbodystring,\n\t\t]\n\t\treturn data.encode( 'binary' )\n\tend",
"title": ""
},
{
"docid": "649b1fdcd44a0b238db00d6a8882342c",
"score": "0.50774115",
"text": "def post(url, resource_name, options = {})\n build_response(resource_name) do\n connection.post do |req|\n req.url url\n req.body = options.to_json\n end\n end\n end",
"title": ""
},
{
"docid": "e211c6c7b53089c1dddd2479e0a1e2e0",
"score": "0.5074263",
"text": "def add_arrays_to_tenant(args = {}) \n post(\"/tenants.json/#{args[:tenantId]}/arrays\", args)\nend",
"title": ""
},
{
"docid": "10623833909a8c1ce3aa8394b5ca188c",
"score": "0.50720936",
"text": "def index\n json = HTTParty.get(\"https://api.typeform.com/v1/form/WaIffL?key=f486f2db8f1249c077a08b582bc3efe0a2617668\").body\n\n @jsontests = JSON.parse(json)\n\n end",
"title": ""
},
{
"docid": "5e381648634b96327e4c3715af1881c7",
"score": "0.5071465",
"text": "def test_should_create_link_via_API_JSON\r\n get \"/logout\"\r\n post \"/links.json\", :api_key => 'testapikey',\r\n :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response :created\r\n link = JSON.parse(response.body)\r\n check_new_link(link) \r\n end",
"title": ""
},
{
"docid": "fb7311736f79622a90bf3034d790259a",
"score": "0.50623435",
"text": "def create(json_file)\n pipeline_json = File.read(json_file)\n @http.pipelines.post pipeline_json\n rescue StandardError => e\n puts \"Error creating pipeline: #{e}\"\n Process.exit(1)\n end",
"title": ""
},
{
"docid": "24f67a01fbe3bcea4a2a538b2446ac56",
"score": "0.50614333",
"text": "def post(data = {})\n call data, method: :post\n end",
"title": ""
},
{
"docid": "2f62a30e6aa37c7ddfde377481e1a165",
"score": "0.50570756",
"text": "def http_post(path, data, content_type = 'application/json')\n http_methods(path, :post, data, content_type)\n end",
"title": ""
},
{
"docid": "c509f63c7e67d3a06897861d13ff3098",
"score": "0.50555086",
"text": "def index\n render 'post'\n respond_to :json\n end",
"title": ""
},
{
"docid": "b92451c2bfb97b501468d1d1d7446034",
"score": "0.5049403",
"text": "def test_all_the_dogs_are_in_one_pack\n @params = {\n packs: [\n {\n dogs: ['Spot', 'Fido', 'Rover'],\n location: 'San Francisco',\n },\n {\n dogs: ['Doggie', 'Lassie'],\n location: 'Canada',\n },\n ],\n }\n\n\n post \"/dogs\", params = @params\n assert_equal 'Spot, Fido, Rover, Doggie, and Lassie are all in one pack. Oh no!', last_response.body\n end",
"title": ""
},
{
"docid": "8b1d710f4150875d136c59ea7ea9b7e6",
"score": "0.5047082",
"text": "def post(path, body = nil, ctype = 'text/plain')\n body = body.to_json unless body.is_a?(String)\n make_call(mk_conn(path, 'Content-Type': ctype,\n 'Accept': 'application/json'),\n :post, nil, body)\n end",
"title": ""
},
{
"docid": "385561fba390ab7f5e3f43b9a24d4fde",
"score": "0.50438535",
"text": "def create_post(params)\n mock_request = Rack::MockRequest.new(APP)\n mock_request.post(new_post_endpoint, { 'router.params' => params, format: :json })\n end",
"title": ""
},
{
"docid": "525ab0ec4ebbcbcbad4f40ad38b27dc4",
"score": "0.5038785",
"text": "def create\n Filter.create! :json_contents => params[:filter]\n\n render json: {\n success: true\n }\n end",
"title": ""
},
{
"docid": "b6e8ab8800619de71953106c2011868a",
"score": "0.50336283",
"text": "def api_post(path, data = {})\n api_request(:post, path, :data => data)\n end",
"title": ""
},
{
"docid": "a734ff744a594bab251145f0add2e754",
"score": "0.5021925",
"text": "def create_albums\n url = 'https://stg-resque.hakuapp.com/albums.json'\n uri = URI(url)\n response = Net::HTTP.get(uri)\n albums = JSON.parse(response)\n\n albums.each do |album|\n Album.create!(album.except('id'))\n end\nend",
"title": ""
},
{
"docid": "7053ea1dcc165e23481f458fa023ba3d",
"score": "0.5019832",
"text": "def json_entry_params\n params.require(:json_entry).permit(:area_id, :data, :name, :verb, :post_body)\n end",
"title": ""
},
{
"docid": "cf117eb4520f5b5fc0465979e4d0d34e",
"score": "0.5017551",
"text": "def submit_report(json, cookbookname)\n data = File.read(json)\n uri = URI.parse($SPEC_ENDPOINT)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = uri.scheme == \"https\"\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(\"/api/reports\")\n request.add_field('Content-Type', 'application/json')\n request.body = {\n :spec_result => data,\n :hostname => `hostname`.chomp,\n :cookbook_name => cookbookname\n }.to_json\n response = http.request(request)\n end",
"title": ""
},
{
"docid": "6a3a278aae3b04738b270f0949778f4c",
"score": "0.5015089",
"text": "def post_params(array_of_objects_to_post)\n #Each object in the array must support to_json\n array_of_objects_to_post.collect{|task| task.to_json}.to_s\n end",
"title": ""
},
{
"docid": "d150a70b29ba6a251519dff4d7479c13",
"score": "0.500967",
"text": "def post(path, **args); end",
"title": ""
},
{
"docid": "19bee4828d930d1149d765cfdd70c9ac",
"score": "0.5009363",
"text": "def create\n render json: Beverage.create!(beverage_post_params), status: :created\n end",
"title": ""
},
{
"docid": "0366e6e8dacebea9c140fd257cef1819",
"score": "0.500809",
"text": "def post\n Salesforce.set_http(session[:accesstoken], session[:accessurl])\n \t@response = Salesforce.create_post(params)\n \trespond_to do |format|\n format.json { render :json => @response.to_json}\n # example of multiple reponses mapped to one object\n # format.json { render :json => {:data => @response, :meta => @describe}.to_json}\n \tend\n end",
"title": ""
},
{
"docid": "5dc3162e0c298425ed6f01663e99d991",
"score": "0.50047314",
"text": "def json_upload(content, credentials)\n upload('json', content, credentials)\n end",
"title": ""
},
{
"docid": "0418fcf680b0445b7b8bb4d09d2ef852",
"score": "0.5004028",
"text": "def post(url, query = {}, payload = {})\n restclient({\n method: :post,\n url: \"#{@scheme}://#{@host}/#{url}\",\n timeout: Timeout,\n open_timeout: OpenTimeout,\n payload: payload.to_json,\n headers: {\n authorization: @auth,\n content_type: :json,\n accept: :json,\n params: query\n }\n })\n end",
"title": ""
},
{
"docid": "8fc3566f265073fbbddcd5617d7edc36",
"score": "0.5002297",
"text": "def post(url)\n response = RestClient::Request.new(\n method: :post,\n url: \"#{ENDPOINT_URL}/#{url}\",\n verify_ssl: false,\n headers: {\n 'Content-Type' => 'application/json',\n 'Authorization' => \"Basic #{authorization_hash}\"\n },\n payload: {user: user, pwd: password}.to_json\n ).execute\n\n # Parse the response to Ruby objects\n JSON.parse(response)\n end",
"title": ""
},
{
"docid": "bf7efd7f2d9405c07ac5d30e9dc1999b",
"score": "0.4999457",
"text": "def create\n collection = Collection.create(collection_params)\n\n render json: collection\n end",
"title": ""
},
{
"docid": "9a38e63e073b0e18266a088b2e8da986",
"score": "0.4994898",
"text": "def json(data = {})\n Rack::Response.new(data.to_json, 200, {\n \"Content-Type\" => \"application/json\",\n })\n end",
"title": ""
},
{
"docid": "1d80834a0412ecf74f8d2ad59079127c",
"score": "0.4989376",
"text": "def post(path, options = {})\n nonce, signature = generate_signature\n options = options.merge(key: @api_key, nonce: nonce, signature: signature)\n result = @connection.post(\"#{path}/\", options).body\n JSON.parse(result)\n end",
"title": ""
},
{
"docid": "ab00d3cd3a5bf7f2e4da6c44520e605e",
"score": "0.49830526",
"text": "def post(resource:, data:, version: :v1)\n if data.is_a? String\n begin\n MultiJson.load data\n rescue MultiJson::ParseError => e\n raise BayPhoto::Exceptions::BadJSON, \"Invalid JSON string: #{e.message}\"\n end\n else\n data = MultiJson.dump data\n end\n\n handle = http_handle(version: version)\n\n req = Net::HTTP::Post.new(uri_path_for(resource: resource, version: version))\n req[\"Content-Type\"] = \"application/json\"\n SET_REQUEST_AUTH_TOKEN.call(req)\n req.body = data\n\n handle_response(handle.request(req))\n end",
"title": ""
}
] |
0f12dfbeb7cfc2c4ad5be4609e3dc91a
|
Creates a start time object
|
[
{
"docid": "1849b12e602dbbdc71ea9e5f5247efd2",
"score": "0.7045201",
"text": "def start\n @start_time = Time.now\n end",
"title": ""
}
] |
[
{
"docid": "9af3f6313d516b5093e8d1213fb8a9bb",
"score": "0.7691116",
"text": "def init\n @start_time = Time.now \n end",
"title": ""
},
{
"docid": "ecfbedd7a8b419a4ed97a9c00bef7d38",
"score": "0.76088333",
"text": "def start_time=(value)\n @start_time = value\n end",
"title": ""
},
{
"docid": "8dc0f03922be5a65e6392e7db623272f",
"score": "0.75882125",
"text": "def make_start_time\n self.starts_at = (self.starts_at.to_date.to_datetime)\n end",
"title": ""
},
{
"docid": "985ccb78061c1b448923746a6aa12332",
"score": "0.75289935",
"text": "def start_time=(value)\n @start_time = value\n end",
"title": ""
},
{
"docid": "985ccb78061c1b448923746a6aa12332",
"score": "0.7528298",
"text": "def start_time=(value)\n @start_time = value\n end",
"title": ""
},
{
"docid": "1f60b9ff454f01ffba7471225b21128d",
"score": "0.75155413",
"text": "def start_time=(value)\n @start_time = value\n end",
"title": ""
},
{
"docid": "1f60b9ff454f01ffba7471225b21128d",
"score": "0.75155413",
"text": "def start_time=(value)\n @start_time = value\n end",
"title": ""
},
{
"docid": "1f60b9ff454f01ffba7471225b21128d",
"score": "0.75155413",
"text": "def start_time=(value)\n @start_time = value\n end",
"title": ""
},
{
"docid": "1f60b9ff454f01ffba7471225b21128d",
"score": "0.75153506",
"text": "def start_time=(value)\n @start_time = value\n end",
"title": ""
},
{
"docid": "1f60b9ff454f01ffba7471225b21128d",
"score": "0.7515278",
"text": "def start_time=(value)\n @start_time = value\n end",
"title": ""
},
{
"docid": "d931778843a133827871d05edacf2799",
"score": "0.7508495",
"text": "def start_time\n @start_time ||= Time.at(read(4, 0).unpack('L').first)\n end",
"title": ""
},
{
"docid": "937816a496ace7e64e93ca923c85daaa",
"score": "0.74929136",
"text": "def start_time(time = nil)\n return @start_time unless time\n\n @start_time = time\n end",
"title": ""
},
{
"docid": "d58330f0669ce4cb6200bc6d7516f4b8",
"score": "0.73735803",
"text": "def start_time\n TimeSlot.time_at starts_at\n end",
"title": ""
},
{
"docid": "b92a0996519bd6ddb0de3d04d476fde9",
"score": "0.73657954",
"text": "def start_time; end",
"title": ""
},
{
"docid": "b92a0996519bd6ddb0de3d04d476fde9",
"score": "0.73657954",
"text": "def start_time; end",
"title": ""
},
{
"docid": "b92a0996519bd6ddb0de3d04d476fde9",
"score": "0.73657954",
"text": "def start_time; end",
"title": ""
},
{
"docid": "b92a0996519bd6ddb0de3d04d476fde9",
"score": "0.73657954",
"text": "def start_time; end",
"title": ""
},
{
"docid": "b940a5924d224fcce4df9753f40672e4",
"score": "0.7357904",
"text": "def start_time\n\t\t@start_time = Time.now\n\tend",
"title": ""
},
{
"docid": "38e396ce9567d9181274676b9e502bb5",
"score": "0.73352784",
"text": "def time_start\n self.start_time.to_s(:time)\n end",
"title": ""
},
{
"docid": "58569651701147ab7d37980424a4aa2a",
"score": "0.7293594",
"text": "def start_time\n eval(start) if start.present?\n end",
"title": ""
},
{
"docid": "3b70bb42f2310a77b01b88f476380a43",
"score": "0.72911584",
"text": "def start_time=(value)\n\t\tif value.kind_of?(Time)\n\t\t\t@start_time = value\n\t\telse\n\t\t\traise \"Wanted a Time object, found: #{value.inspect}\"\n\t\tend\n\tend",
"title": ""
},
{
"docid": "6a2f57971f43a0a6d1e462e61ccee01a",
"score": "0.7290838",
"text": "def measure_creation_time\n @start_time = Time.now\n end",
"title": ""
},
{
"docid": "709a77f0277836904cc297fc8e04ab4d",
"score": "0.72861016",
"text": "def start_time\n (Time.utc(2001, 1, 1) + self.raw_start_time).localtime\n end",
"title": ""
},
{
"docid": "2e1071c78dd0f1c0fb87255f06422caa",
"score": "0.7274056",
"text": "def start\n if @timeStart == nil\n @timeStart = Time.now()\n end\n self\n end",
"title": ""
},
{
"docid": "a29a6cf6a2820dbb8b1cd3af35944aa4",
"score": "0.7259033",
"text": "def start_time\n @start_time\n end",
"title": ""
},
{
"docid": "a29a6cf6a2820dbb8b1cd3af35944aa4",
"score": "0.7259033",
"text": "def start_time\n @start_time\n end",
"title": ""
},
{
"docid": "a29a6cf6a2820dbb8b1cd3af35944aa4",
"score": "0.7259033",
"text": "def start_time\n @start_time\n end",
"title": ""
},
{
"docid": "a29a6cf6a2820dbb8b1cd3af35944aa4",
"score": "0.7259033",
"text": "def start_time\n @start_time\n end",
"title": ""
},
{
"docid": "e0f80a45aa24b3253712b4fffc1516f8",
"score": "0.7256701",
"text": "def start_time\n Time.at(self[:start_time]).to_i unless self[:start_time].nil?\n end",
"title": ""
},
{
"docid": "71619820690928285c82853a7daa0cb2",
"score": "0.72377676",
"text": "def new\n @sub_time = SubTime.new\n start\n end",
"title": ""
},
{
"docid": "0fe13a0427eb6c80d8f3a55bc4692a93",
"score": "0.7235002",
"text": "def start_time\n date_object.to_datetime\n end",
"title": ""
},
{
"docid": "61a4899e3c11ca111dfeab80fcf30eec",
"score": "0.7225763",
"text": "def start_time(value)\n @start_time[0] = value\n end",
"title": ""
},
{
"docid": "0eb542309420fc88fbba7fa8d693449a",
"score": "0.71961427",
"text": "def start_time\r\n start_time.strftime(\"%I:%M %p\")\r\n end",
"title": ""
},
{
"docid": "66d0f01f3aa5005181e1bcc5f23a1c36",
"score": "0.71932703",
"text": "def start_time\n return @start_time\n end",
"title": ""
},
{
"docid": "2463f8b30509488c6082725abbe16fcd",
"score": "0.7175404",
"text": "def start_time\n @start_time ||= Time.now\n (@start_time.is_a? String) ? @start_time : @start_time.utc.xmlschema\n end",
"title": ""
},
{
"docid": "caf428f0a5e43779e3150baaf055a679",
"score": "0.7173582",
"text": "def start \n @Started = Time.new\n end",
"title": ""
},
{
"docid": "4e496245ea08c1e98d6605e8365410fc",
"score": "0.7173274",
"text": "def start\n @start_time = Time.now\n end",
"title": ""
},
{
"docid": "d83e28be645e8bf54fcff7d6b8b3c842",
"score": "0.7157675",
"text": "def start_time=(t)\r\n t = Time.parse_ymdHMS(t) if t.is_a? String\r\n @start_time = t\r\n end",
"title": ""
},
{
"docid": "0c8fd942db913508bb3d6009d09b9f51",
"score": "0.7143537",
"text": "def start_time\n\t\treturn @start_time\n\tend",
"title": ""
},
{
"docid": "4378194ffee53c08a9c87132032825d0",
"score": "0.7140597",
"text": "def get_start_time\n unless self.start_date.nil?\n s = self.clone\n s.start_date.strftime(\"%I:%M %p\")\n end\n end",
"title": ""
},
{
"docid": "13c00b5fb2846018109ed9e9ef5d2355",
"score": "0.7107467",
"text": "def start_time\n @start_time ||= Time.now.utc\n (@start_time.is_a? String) ? @start_time : @start_time.xmlschema\n end",
"title": ""
},
{
"docid": "bf536e370503c58abdf0f0634818fdd3",
"score": "0.70907086",
"text": "def start_time\n self.start\n end",
"title": ""
},
{
"docid": "a591f769ebdf79bca1da82202690267c",
"score": "0.70863956",
"text": "def start_time=(time)\n @start_time = Event.parse_time(time)\n end",
"title": ""
},
{
"docid": "3ffc10bad4cfb34713798b4950a84f59",
"score": "0.7086083",
"text": "def start_time=(time)\n self.starts_at = to_database_time time\n end",
"title": ""
},
{
"docid": "3fa95ec9ba6f2484928c7ddab4b3ef51",
"score": "0.7082625",
"text": "def start_timer\n @start_time = Time.now.to_f\n end",
"title": ""
},
{
"docid": "49974033b7030d4de6bf42c0d666b000",
"score": "0.70630836",
"text": "def simple_start_time\n hours = start_time.hour < 10 ? \"0\" + start_time.hour.to_s : start_time.hour.to_s\n minutes = start_time.min < 10 ? \"0\" + start_time.min.to_s : start_time.min.to_s\n hours + \":\" + minutes\n end",
"title": ""
},
{
"docid": "a6504a8eaafa7fe77297ece5467b8482",
"score": "0.70630735",
"text": "def start_time=(_); end",
"title": ""
},
{
"docid": "0b528ad4786d407aee0e49d70cf0b0bc",
"score": "0.704492",
"text": "def start\n DateTime.parse(start_time).new_offset(0)\n end",
"title": ""
},
{
"docid": "0b528ad4786d407aee0e49d70cf0b0bc",
"score": "0.704492",
"text": "def start\n DateTime.parse(start_time).new_offset(0)\n end",
"title": ""
},
{
"docid": "6f4486b4272263a4a383bfc72a081276",
"score": "0.7040524",
"text": "def gen_start_time_tracker \n\t$gen_start_test_time = Time.now()\n end",
"title": ""
},
{
"docid": "069feac0c05aff85b787f8a47c7b894b",
"score": "0.70397496",
"text": "def start\n Time.at(start_at)\n end",
"title": ""
},
{
"docid": "561119d6a9eced699716cde7842a94fd",
"score": "0.703819",
"text": "def start_time\n return @start_time\n end",
"title": ""
},
{
"docid": "561119d6a9eced699716cde7842a94fd",
"score": "0.703819",
"text": "def start_time\n return @start_time\n end",
"title": ""
},
{
"docid": "dca6822c2e1db4b06ec48d6740a9242a",
"score": "0.7026368",
"text": "def problem_start\n\t\t\t@start_time = Time.new\n\t\tend",
"title": ""
},
{
"docid": "fc6c9fc57d9f7f7962c63f70f30177f8",
"score": "0.6990903",
"text": "def starttime\n self.start_date_time.strftime(\"%l:%M%P\")\n end",
"title": ""
},
{
"docid": "e4f20db31523524f58ebb1aa67ccc0ef",
"score": "0.6987755",
"text": "def local_start_time; end",
"title": ""
},
{
"docid": "e4f20db31523524f58ebb1aa67ccc0ef",
"score": "0.6987755",
"text": "def local_start_time; end",
"title": ""
},
{
"docid": "12857fe53ba9c4a9ab31767eb201cffe",
"score": "0.69775677",
"text": "def start_time\n date\n end",
"title": ""
},
{
"docid": "d8cafb955537dc0ec218e3148e785394",
"score": "0.69725865",
"text": "def starttime\n starts_at_utc.strftime('%H:%M:%S')\n end",
"title": ""
},
{
"docid": "9a44bdcfc23761b1e89e60defa2576f9",
"score": "0.6971349",
"text": "def utc_start_time; end",
"title": ""
},
{
"docid": "c1a95fa5dad52f4bd9daf196397dfc02",
"score": "0.6968672",
"text": "def start_time\n date_time\n end",
"title": ""
},
{
"docid": "f9b3e0b30550bd4feadab158902e3562",
"score": "0.6958008",
"text": "def start; Time.at(recstartts.to_i); end",
"title": ""
},
{
"docid": "f56389827ffca3deee4b77d4c52a2c26",
"score": "0.6956596",
"text": "def start_time=(_arg0); end",
"title": ""
},
{
"docid": "5cbede94c0a2e6c85251034a530b7b1f",
"score": "0.6938524",
"text": "def start\n @start = MonotonicTime.time_in_seconds\n end",
"title": ""
},
{
"docid": "bb36c9abf7198437e108ccdba51c296f",
"score": "0.69372576",
"text": "def start_time; @start_time/1000.0 end",
"title": ""
},
{
"docid": "9b28c19e44d3bfb4513b58a3a601d147",
"score": "0.6908751",
"text": "def start_time= start \n write_attribute :start_time, absolute_time(start)\n end",
"title": ""
},
{
"docid": "3f7bc92e54b4fda3d0af8776cbbe29b3",
"score": "0.69019",
"text": "def start_time=(start_time)\n if start_time.nil?\n @start_time = nil\n elsif start_time < 0\n raise Error, \"Invalid start time: #{start_time}\"\n else\n @start_time = start_time\n end\n end",
"title": ""
},
{
"docid": "4708397af7d5b2ca3a752937b8275854",
"score": "0.68903106",
"text": "def start_time\n @options[:time_range].first\n end",
"title": ""
},
{
"docid": "525dc7f5e20f75b17fadf90b4c385426",
"score": "0.6890237",
"text": "def start_time\n read_attribute(:start_time)\n end",
"title": ""
},
{
"docid": "f1aac881f95e07b6d0038c213abe4c83",
"score": "0.6869302",
"text": "def start=(time)\n @now = time\n end",
"title": ""
},
{
"docid": "f1aac881f95e07b6d0038c213abe4c83",
"score": "0.6869302",
"text": "def start=(time)\n @now = time\n end",
"title": ""
},
{
"docid": "dfbcd541c28de9ed98a2db38700a4801",
"score": "0.6857204",
"text": "def start_time_input\n @start_time_input || start_time.try(:strftime, \"%H:%M\")\n end",
"title": ""
},
{
"docid": "69332c3f5d8d8ca93deb8affbe06e8d7",
"score": "0.6852824",
"text": "def save_start_time(start_time = nil)\n @start_time = start_time || timestamp\n end",
"title": ""
},
{
"docid": "1182805902cca93ca1a6e71c708f16f8",
"score": "0.6848238",
"text": "def start_time\n dtstart_property ? dtstart.to_datetime : nil\n end",
"title": ""
},
{
"docid": "cca66d7335fa931041bf31cb1aac2898",
"score": "0.68387824",
"text": "def start_time\n @body['start_time'] && Time.at(@body['start_time']).utc\n end",
"title": ""
},
{
"docid": "9c6c3176d20123026ba7eff72c9ef396",
"score": "0.6833317",
"text": "def start_time\n self.starttime.strftime(\"%a %b %-d, %Y at %l:%M%p\")\n end",
"title": ""
},
{
"docid": "f938c74a79a9ef6eaed6807c1c8c45b9",
"score": "0.6823725",
"text": "def start\n\t\t@startTime = Time.now\n\tend",
"title": ""
},
{
"docid": "181d2d8f4eaf928a4a1e8b2527a58a30",
"score": "0.6811026",
"text": "def start_time\n time_by_sample_number(0) unless empty?\n end",
"title": ""
},
{
"docid": "ac7b0c7a20ec13d64c3a366342ef6bd3",
"score": "0.67833143",
"text": "def start_time\n if schedule\n return IceCube::Schedule.from_yaml(schedule).start_time\n end\n end",
"title": ""
},
{
"docid": "8ca7ff4c49dfb34db024642356c1615a",
"score": "0.6772473",
"text": "def start_time\n start_at.in_time_zone(member.timezone)\n end",
"title": ""
},
{
"docid": "4ce5406255f32fd1982c2a0bba975bfc",
"score": "0.67675245",
"text": "def start_time\n Convert.timestamp_to_time @grpc.start_time\n end",
"title": ""
},
{
"docid": "36dbf641296c021259b732fe3c0245cf",
"score": "0.67564136",
"text": "def begin_at\n Time.new(year, month, day, begin_hour, begin_minute, 0, '+00:00')\n end",
"title": ""
},
{
"docid": "74fa5380c166a4693eb038375265cbbb",
"score": "0.67510617",
"text": "def start_date_time=(value)\n @start_date_time = value\n end",
"title": ""
},
{
"docid": "f91312940d7948511c4d23f8e47a76ea",
"score": "0.6740667",
"text": "def stime\n @start_time\n end",
"title": ""
},
{
"docid": "c01e28442ec460c100ad020c879803a6",
"score": "0.674045",
"text": "def start_time\n\t\treturn duedate\n\tend",
"title": ""
},
{
"docid": "beea9fb5b33670dacb286665d6f2dee7",
"score": "0.6732844",
"text": "def start_time\n data.start_time\n end",
"title": ""
},
{
"docid": "020eb1a2f656df13d0d6e1fb59ac06dd",
"score": "0.6727729",
"text": "def start_at\n today = Time.now\n Time.new(today.year, today.month, today.day, 13,0,0)\n end",
"title": ""
},
{
"docid": "253387715dbea31af81cf1e311e6191c",
"score": "0.67243314",
"text": "def start\n @start = Time.now\n end",
"title": ""
},
{
"docid": "253387715dbea31af81cf1e311e6191c",
"score": "0.67243314",
"text": "def start\n @start = Time.now\n end",
"title": ""
},
{
"docid": "53130673cf7780b58f471aae2795eb1d",
"score": "0.6723931",
"text": "def request_start_time\n @request_start_time = Time.new.seconds_since_midnight\n end",
"title": ""
},
{
"docid": "53130673cf7780b58f471aae2795eb1d",
"score": "0.6723931",
"text": "def request_start_time\n @request_start_time = Time.new.seconds_since_midnight\n end",
"title": ""
},
{
"docid": "0286210a7af6bce9a12773986eb2efd3",
"score": "0.67238444",
"text": "def start_date_time=(value)\n @start_date_time = value\n end",
"title": ""
},
{
"docid": "5f015e75d0452504c4976158b0f315b7",
"score": "0.6721246",
"text": "def build_initiated\n @start = Time.now\n end",
"title": ""
},
{
"docid": "fe18bc05539a924d47588fe33d422328",
"score": "0.6718173",
"text": "def setup_start_at\n return unless start_at.blank?\n \n self.start_at = Time.now\n end",
"title": ""
},
{
"docid": "411a68abfd4b50d5994e5e2a62a78aae",
"score": "0.671595",
"text": "def event_start_time=(value)\n @event_start_time = value\n end",
"title": ""
},
{
"docid": "a7e30b7ca5ce5119096db0af6344a431",
"score": "0.6706884",
"text": "def start_time\n data[:start_time]\n end",
"title": ""
},
{
"docid": "9ffd6955878b86c457531e695628172a",
"score": "0.67065126",
"text": "def start_time\n self.date\n end",
"title": ""
},
{
"docid": "9ffd6955878b86c457531e695628172a",
"score": "0.67065126",
"text": "def start_time\n self.date\n end",
"title": ""
},
{
"docid": "fe0a8c2f48018e7fcce881b9398c067a",
"score": "0.67019707",
"text": "def initialize\n @time = Time.new\n end",
"title": ""
},
{
"docid": "e3496242be96698d6af462729cd70f73",
"score": "0.6701526",
"text": "def start_time\n \tself.schedule_on\n\tend",
"title": ""
}
] |
c1e2de8f6c18369a88cb8a3be3841a37
|
GET /coupon_designs/new GET /coupon_designs/new.json
|
[
{
"docid": "b05d3ea3a50d96388c314a30aa816ccd",
"score": "0.8404147",
"text": "def new\n @coupon_design = CouponDesign.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @coupon_design }\n end\n end",
"title": ""
}
] |
[
{
"docid": "9e850bc5e06d2dcb77aa53db168c0f37",
"score": "0.7832543",
"text": "def create\n @coupon_design = CouponDesign.new(params[:coupon_design])\n\n respond_to do |format|\n if @coupon_design.save\n format.html { redirect_to @coupon_design, notice: 'Coupon design was successfully created.' }\n format.json { render json: @coupon_design, status: :created, location: @coupon_design }\n else\n format.html { render action: \"new\" }\n format.json { render json: @coupon_design.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d033b04d278da2202b954898e5e61420",
"score": "0.7772951",
"text": "def new\n @coupon = Coupon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @coupon }\n end\n end",
"title": ""
},
{
"docid": "d033b04d278da2202b954898e5e61420",
"score": "0.7772951",
"text": "def new\n @coupon = Coupon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @coupon }\n end\n end",
"title": ""
},
{
"docid": "d033b04d278da2202b954898e5e61420",
"score": "0.7772951",
"text": "def new\n @coupon = Coupon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @coupon }\n end\n end",
"title": ""
},
{
"docid": "391708dc75f21ed4a4b09a9029ad95f9",
"score": "0.77648056",
"text": "def new\n @coupon = Coupon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @coupon}\n end\n end",
"title": ""
},
{
"docid": "a8e839e6b63bade3fe4a7c6f8c23c101",
"score": "0.7736377",
"text": "def new\n @coupon = Coupon.new(:company_id => @company.id)\n @companies = Company.order('name ASC')\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @coupon }\n end\n end",
"title": ""
},
{
"docid": "cf6e97e250cdf0a9fba6c2250be28d3c",
"score": "0.77292",
"text": "def new\n @coupon_category = CouponCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @coupon_category }\n end\n end",
"title": ""
},
{
"docid": "6de58cc0b5ed0284233b358c85bc64d6",
"score": "0.75682414",
"text": "def new\n @coupon = Coupon.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.xml { render :xml => @coupon }\n\t format.json { render :json => @coupon.to_a.to_json }\n end\n end",
"title": ""
},
{
"docid": "8d1bb238da9bb03f0a9fde2a467ba71d",
"score": "0.74831945",
"text": "def new \n \n @coupon = Coupon.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @coupon }\n end\n\t\t\n end",
"title": ""
},
{
"docid": "191d2b410e86d03e098d9424bce6130a",
"score": "0.74717087",
"text": "def new\n @cupon = Cupon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @cupon }\n end\n end",
"title": ""
},
{
"docid": "76b13e54e9ff3782bc86721bf52f16a2",
"score": "0.74712646",
"text": "def new\n @coupon = current_user.coupons.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @coupon }\n end\n end",
"title": ""
},
{
"docid": "4a40a99b67747f0622502d97f3e3d791",
"score": "0.74457955",
"text": "def new\n @coupon_usage = CouponUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @coupon_usage}\n end\n end",
"title": ""
},
{
"docid": "1cb93d94116fb34ebfed881993a96f8d",
"score": "0.744121",
"text": "def new\n @coupon_product = CouponProduct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @coupon_product }\n end\n end",
"title": ""
},
{
"docid": "6ea41e3356bbf18ba63ba116d3802aca",
"score": "0.7400006",
"text": "def new\n @mcoupon = Mcoupon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mcoupon }\n end\n end",
"title": ""
},
{
"docid": "5c373421d6589ffa8ad4eacfe2f3aa88",
"score": "0.7398149",
"text": "def new\n @admin_coupon = Admin::Coupon.new\n \n respond_to do |format|\n format.html # new.html.erbb\n format.json { render json: @admin_coupon }\n end\n end",
"title": ""
},
{
"docid": "0256cb260fbaa361b662d019db9396d0",
"score": "0.7344183",
"text": "def new\n @design = Design.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @design }\n end\n end",
"title": ""
},
{
"docid": "682f7d961c882ab17d6c1bf307738061",
"score": "0.7298879",
"text": "def new\n @coupon = Coupon.new\n @categories = Category.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @coupon }\n end\n end",
"title": ""
},
{
"docid": "0ada6512566eff7fa78cf6d92adfccab",
"score": "0.7269816",
"text": "def new\n @design = Design.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @design }\n end\n end",
"title": ""
},
{
"docid": "01e0f124b0f7b12d05d31e32bb9a6fb8",
"score": "0.72237754",
"text": "def new\n @coupon = Coupon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @coupon }\n end\n end",
"title": ""
},
{
"docid": "01e0f124b0f7b12d05d31e32bb9a6fb8",
"score": "0.72237754",
"text": "def new\n @coupon = Coupon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @coupon }\n end\n end",
"title": ""
},
{
"docid": "01e0f124b0f7b12d05d31e32bb9a6fb8",
"score": "0.72237754",
"text": "def new\n @coupon = Coupon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @coupon }\n end\n end",
"title": ""
},
{
"docid": "4222409d4d2df13670685e60cffad5be",
"score": "0.714929",
"text": "def new\n @coupons = Coupon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @coupons }\n end\n end",
"title": ""
},
{
"docid": "a5c064169837a90a7085e38bf7d8321e",
"score": "0.7106023",
"text": "def new\n @discount = Discount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @discount }\n end\n end",
"title": ""
},
{
"docid": "2907b6e184951a7d5f1695867e1187d2",
"score": "0.6993407",
"text": "def new\n @ref_benefit_category = Ref::BenefitCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ref_benefit_category }\n end\n end",
"title": ""
},
{
"docid": "17e00a8fe57ed9666882e7e335a0098f",
"score": "0.6962634",
"text": "def new\n @title = \"Create a new coupon\"\n @coupon = Coupon.new\n end",
"title": ""
},
{
"docid": "2ac6053eb47a984432a22cc4c5c07725",
"score": "0.6958748",
"text": "def new\n @concession = Concession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @concession }\n end\n end",
"title": ""
},
{
"docid": "8eccdbe65236e7e97affb086cff53ab3",
"score": "0.69322526",
"text": "def new\n @procon = Procon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @procon }\n end\n end",
"title": ""
},
{
"docid": "4656241b13da990ba09414fca0ff0d67",
"score": "0.69288146",
"text": "def new\n @complaint = Complaint.new\n coupon = Coupon.find(params[:coupon_id]) if params[:coupon_id]\n if coupon\n @complaint.coupon_id = coupon.id\n @complaint.coupon_code = coupon.code\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @complaint }\n end\n end",
"title": ""
},
{
"docid": "23cbfeb1331db20f514b66aeefe338fc",
"score": "0.69241434",
"text": "def new\n @corporation = Corporation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @corporation }\n end\n end",
"title": ""
},
{
"docid": "51aca6edb6d8f372b52681ac07811422",
"score": "0.691667",
"text": "def new\n @design = @account.designs.build\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"title": ""
},
{
"docid": "12aa37ad954d2e174c0e2dac5f6dec9e",
"score": "0.6896156",
"text": "def new\n @discount = Discount.new\n @cart = current_cart\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @discount }\n end\n end",
"title": ""
},
{
"docid": "5541f6080b02858cf454cf927d8a63af",
"score": "0.68740827",
"text": "def new\n @con = Con.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @con }\n end\n end",
"title": ""
},
{
"docid": "0306acf3dc35ad1cff4853a343a3104f",
"score": "0.686146",
"text": "def create\n @coupon = Coupon.new(params[:coupon])\n\n respond_to do |format|\n if @coupon.save\n format.html { redirect_to @coupon, notice: 'Coupon was successfully created.' }\n format.json { render json: @coupon, status: :created, location: @coupon }\n else\n format.html { render action: \"new\" }\n format.json { render json: @coupon.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0306acf3dc35ad1cff4853a343a3104f",
"score": "0.686146",
"text": "def create\n @coupon = Coupon.new(params[:coupon])\n\n respond_to do |format|\n if @coupon.save\n format.html { redirect_to @coupon, notice: 'Coupon was successfully created.' }\n format.json { render json: @coupon, status: :created, location: @coupon }\n else\n format.html { render action: \"new\" }\n format.json { render json: @coupon.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "43f67b745ddbc024f1afe030f5efdc6f",
"score": "0.68267804",
"text": "def create\n @coupon = Coupon.new(coupon_params)\n\n respond_to do |format|\n if @coupon.save\n format.html { redirect_to @coupon, notice: \"Coupon was successfully created.\" }\n format.json { render json: @coupon, status: :created, location: @coupon }\n else\n format.html { render action: \"new\" }\n format.json { render json: @coupon.errors, status: :unprocessable_entry }\n end\n end\n end",
"title": ""
},
{
"docid": "96f5ec988fb600946dcf87d6b8da089a",
"score": "0.68126255",
"text": "def new\n @title = \"Добавление страховой компании\"\n @insurance_company = InsuranceCompany.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @insurance_company }\n end\n end",
"title": ""
},
{
"docid": "165631697ba2c0c1a60d3cf491e90526",
"score": "0.68045974",
"text": "def new\n @design_feature = DesignFeature.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @design_feature }\n end\n end",
"title": ""
},
{
"docid": "98cf603bc29d64bf0e81a6ad842e0db2",
"score": "0.67931336",
"text": "def new\n @newscategory = Newscategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newscategory }\n end\n end",
"title": ""
},
{
"docid": "e1c32f4589b0efd57c8cc267fe9e581c",
"score": "0.6790025",
"text": "def create\n if @coupon.save\n render json: @coupon, status: :created, location: @coupon\n else\n render json: @coupon.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "19376626c94beee66dbf0e97b67ad84f",
"score": "0.6789432",
"text": "def new\n @nonprofit = Nonprofit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nonprofit }\n end\n end",
"title": ""
},
{
"docid": "ba307760ff3ffec74eb47418bc2c9400",
"score": "0.6774644",
"text": "def new\n @corporation_debit = CorporationDebit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @corporation_debit }\n end\n end",
"title": ""
},
{
"docid": "ecc0a40d178a5950206692ae32c3e1ec",
"score": "0.67654574",
"text": "def create\n @coupon = Coupon.new(params[:coupon])\n\n respond_to do |format|\n if @coupon.save\n format.html { redirect_to :controller => 'coupons', :action => 'show', :id => @coupon.id, :company_id => @coupon.company_id, :notice => 'Coupon was successfully created.' }\n format.json { render :json => @coupon, :status => :created, :location => @coupon }\n else\n format.html { \n @companies = Company.order('name ASC')\n render :action => \"new\"\n }\n format.json { render :json => @coupon.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "28a0e630f60e1d0e087ea42aa9d9e331",
"score": "0.6764932",
"text": "def new\n @non_profit = NonProfit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @non_profit }\n end\n end",
"title": ""
},
{
"docid": "7388980b2a3ff5ad809b3ea3dd83ff97",
"score": "0.6761039",
"text": "def new\n @coupon = Coupon.new\n\n render :partial => 'new', :object => @coupon\n end",
"title": ""
},
{
"docid": "cf1de87a084edf336307df1a80d88c48",
"score": "0.6759849",
"text": "def new\n @supply_category = SupplyCategory.find(params[:sc_id])\n @supply = @supply_category.supplies.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supply }\n end\n end",
"title": ""
},
{
"docid": "73f9b5d6c89a054261a0819d680e45bc",
"score": "0.67597365",
"text": "def new\n @global_discount = GlobalDiscount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @global_discount }\n end\n end",
"title": ""
},
{
"docid": "1961ecc38b6021b12fdf74c327fc094a",
"score": "0.6747718",
"text": "def new\n @company = @klass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"title": ""
},
{
"docid": "1b3dd6cc9de147cfe5db9a543ee753ef",
"score": "0.67394716",
"text": "def new\n @competence = Competence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @competence }\n end\n end",
"title": ""
},
{
"docid": "0bd1e9d3377e46eb6804aeebf498e775",
"score": "0.6733557",
"text": "def new\n @network_design = NetworkDesign.new\n\n respond_to do |format|\n format.html \n format.json { render :json => @network_design }\n end\n end",
"title": ""
},
{
"docid": "0e2b7adbdfefabcbf6f076cc5b190086",
"score": "0.6729887",
"text": "def new\n @fx_company = FxCompany.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fx_company }\n end\n end",
"title": ""
},
{
"docid": "3d361ae2013e8c327a6932f18ed8e3b7",
"score": "0.6728496",
"text": "def new\n @company = Company.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"title": ""
},
{
"docid": "c28701ac3e0585a7a994c1109fc7d611",
"score": "0.6721643",
"text": "def new\n @disc = Disc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @disc }\n end\n end",
"title": ""
},
{
"docid": "c28701ac3e0585a7a994c1109fc7d611",
"score": "0.6721643",
"text": "def new\n @disc = Disc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @disc }\n end\n end",
"title": ""
},
{
"docid": "9b961dacbfe59839112eb49c5bb71803",
"score": "0.6720284",
"text": "def create\n @coupon_category = CouponCategory.new(params[:coupon_category])\n\n respond_to do |format|\n if @coupon_category.save\n format.html { redirect_to @coupon_category, notice: 'Coupon category was successfully created.' }\n format.json { render json: @coupon_category, status: :created, location: @coupon_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @coupon_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ec8c1d195ab094208f8e5bf8c8547a03",
"score": "0.6719894",
"text": "def new\n @consumidor = Consumidor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @consumidor }\n end\n end",
"title": ""
},
{
"docid": "75e94b322b83936cd439940d87f18126",
"score": "0.67170274",
"text": "def new\n @coupon = Coupon.new :\"start_date_#{current_system}\" => Time.zone.now.beginning_of_day, :\"end_date_#{current_system}\" => Time.zone.now.end_of_day\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @coupon }\n end\n end",
"title": ""
},
{
"docid": "f4ab8a68c43bbc09e7db92877d41ce37",
"score": "0.6715393",
"text": "def new\n @comit = Comit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comit }\n end\n end",
"title": ""
},
{
"docid": "c633302a3602945c1c67c06255d3610e",
"score": "0.6713979",
"text": "def new\n @crew_category = CrewCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @crew_category }\n end\n end",
"title": ""
},
{
"docid": "038269bc881f42072e44be8472336f78",
"score": "0.6713679",
"text": "def new\n @design_datum = DesignDatum.new\n @states = State.all\n @corp_states = CorpState.all\n @projects = Project.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @design_datum }\n end\n end",
"title": ""
},
{
"docid": "9f35dbabf5a66f78b3aa65d99a73a027",
"score": "0.67129976",
"text": "def new\n @coment = Coment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @coment }\n end\n end",
"title": ""
},
{
"docid": "6293cc2cd87b3a16a9bd34a5c37cf5ca",
"score": "0.6708045",
"text": "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"title": ""
},
{
"docid": "6293cc2cd87b3a16a9bd34a5c37cf5ca",
"score": "0.6708045",
"text": "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"title": ""
},
{
"docid": "6293cc2cd87b3a16a9bd34a5c37cf5ca",
"score": "0.6708045",
"text": "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"title": ""
},
{
"docid": "6293cc2cd87b3a16a9bd34a5c37cf5ca",
"score": "0.6708045",
"text": "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"title": ""
},
{
"docid": "6293cc2cd87b3a16a9bd34a5c37cf5ca",
"score": "0.6708045",
"text": "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"title": ""
},
{
"docid": "6293cc2cd87b3a16a9bd34a5c37cf5ca",
"score": "0.6708045",
"text": "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"title": ""
},
{
"docid": "6293cc2cd87b3a16a9bd34a5c37cf5ca",
"score": "0.6708045",
"text": "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"title": ""
},
{
"docid": "6293cc2cd87b3a16a9bd34a5c37cf5ca",
"score": "0.6708045",
"text": "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"title": ""
},
{
"docid": "6293cc2cd87b3a16a9bd34a5c37cf5ca",
"score": "0.6708045",
"text": "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"title": ""
},
{
"docid": "6293cc2cd87b3a16a9bd34a5c37cf5ca",
"score": "0.6708045",
"text": "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"title": ""
},
{
"docid": "6293cc2cd87b3a16a9bd34a5c37cf5ca",
"score": "0.6708045",
"text": "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"title": ""
},
{
"docid": "6293cc2cd87b3a16a9bd34a5c37cf5ca",
"score": "0.6708045",
"text": "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"title": ""
},
{
"docid": "6293cc2cd87b3a16a9bd34a5c37cf5ca",
"score": "0.6708045",
"text": "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"title": ""
},
{
"docid": "6293cc2cd87b3a16a9bd34a5c37cf5ca",
"score": "0.6708045",
"text": "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"title": ""
},
{
"docid": "6293cc2cd87b3a16a9bd34a5c37cf5ca",
"score": "0.6708045",
"text": "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end",
"title": ""
},
{
"docid": "31823a3812e4e610e5e81ba55f0d2493",
"score": "0.670259",
"text": "def new\n @production = Production.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @production }\n end\n end",
"title": ""
},
{
"docid": "31823a3812e4e610e5e81ba55f0d2493",
"score": "0.670259",
"text": "def new\n @production = Production.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @production }\n end\n end",
"title": ""
},
{
"docid": "d3c788209e2e278d5dc9462acb1477b1",
"score": "0.67004365",
"text": "def new\n @cold_production = ColdProduction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cold_production }\n end\n end",
"title": ""
},
{
"docid": "146cc0d8bf3e345c07dc35fc4fd1f57c",
"score": "0.6697113",
"text": "def new\r\n @discounts_on_period = DiscountsOnPeriod.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @discounts_on_period }\r\n end\r\n end",
"title": ""
},
{
"docid": "f11672a03d58d0d88c46beb1c4befc3d",
"score": "0.6691837",
"text": "def new\n @design = Design.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"title": ""
},
{
"docid": "d058bd6c8bc60510c826c6672ebd631c",
"score": "0.6686864",
"text": "def new\n # @coupon=Coupon.new\nend",
"title": ""
},
{
"docid": "ff2075c617bb9d6bd1096da3420da545",
"score": "0.66862386",
"text": "def new\n @cup = Cup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @cup }\n end\n end",
"title": ""
},
{
"docid": "3b38dd0d56ae030d639d714c354ed510",
"score": "0.66843337",
"text": "def create\n @coupon = Coupon.new(coupon_params)\n\n respond_to do |format|\n if @coupon.save\n format.html { redirect_to @coupon, notice: 'Coupon was successfully created.' }\n format.json { render :show, status: :created, location: @coupon }\n else\n format.html { render :new }\n format.json { render json: @coupon.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "de2c4a548acf0d406b87fc5bbaae5301",
"score": "0.6678387",
"text": "def new\n @insurance_co = InsuranceCompany.new\n @title = \"Insurance Companies\"\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @insurance_co }\n end\n end",
"title": ""
},
{
"docid": "90a494ee21c3ee3aa0978ebbe78f68c2",
"score": "0.6674602",
"text": "def new\n @codes_cpt = CodesCpt.new\n @title = \"New CPT Code\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @codes_cpt }\n end\n end",
"title": ""
},
{
"docid": "142c9843af460205672a84a30fb00da4",
"score": "0.6666186",
"text": "def new\n @new_category = NewCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_category }\n end\n end",
"title": ""
},
{
"docid": "7fcd813de6b5bfa4ef176dc5994ea426",
"score": "0.6665491",
"text": "def create\n @cupon = Cupon.new(params[:cupon])\n\n respond_to do |format|\n if @cupon.save\n format.html { redirect_to @cupon, :notice => 'Cupon was successfully created.' }\n format.json { render :json => @cupon, :status => :created, :location => @cupon }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @cupon.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "61d747caed2d5d1a8b16801fefb539dc",
"score": "0.6657915",
"text": "def create\n @design = Design.new(params[:design])\n\n respond_to do |format|\n if @design.save\n format.html { redirect_to @design, notice: 'Design was successfully created.' }\n format.json { render json: @design, status: :created, location: @design }\n else\n format.html { render action: \"new\" }\n format.json { render json: @design.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c233e05b5b3a40ae26ea6f83e183a1c0",
"score": "0.6647476",
"text": "def new\n @corp = Corp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @corp }\n end\n end",
"title": ""
},
{
"docid": "25c4446aa9be71e87b5f50acd9af4aa0",
"score": "0.6643035",
"text": "def new\n @design = Design.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @design }\n end\n end",
"title": ""
},
{
"docid": "dad4b564b429bf1e78943ddaa8efa7d2",
"score": "0.6641159",
"text": "def new\n @counselor = Counselor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @counselor }\n end\n end",
"title": ""
},
{
"docid": "be4d8fd483e337dbead8a4d842511b57",
"score": "0.6636867",
"text": "def new\n @income_category = IncomeCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @income_category }\n end\n end",
"title": ""
},
{
"docid": "d5f395ed05cc728de542be41d30c502e",
"score": "0.6635334",
"text": "def new\n @comune = Comune.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comune }\n end\n end",
"title": ""
},
{
"docid": "09384136245f0a8ca81d7e689fc5f0d2",
"score": "0.6634805",
"text": "def new\n @cold_consumption = ColdConsumption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cold_consumption }\n end\n end",
"title": ""
},
{
"docid": "4f4ec1bc665196663465e3cd56199bf2",
"score": "0.6634442",
"text": "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @company }\n end\n end",
"title": ""
},
{
"docid": "4f4ec1bc665196663465e3cd56199bf2",
"score": "0.6634442",
"text": "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @company }\n end\n end",
"title": ""
},
{
"docid": "31c8c5a421b4dbecf26238b1bf18fb49",
"score": "0.66329753",
"text": "def new\n @newse = Newse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newse }\n end\n end",
"title": ""
},
{
"docid": "7e2b16e7909da5a159449f443af1ce85",
"score": "0.6632802",
"text": "def new\n @cst = Cst.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cst }\n end\n end",
"title": ""
},
{
"docid": "a79b4c10e9e29da93eaf8a699e09cdce",
"score": "0.66293764",
"text": "def new\n @curpg = :discharges\n @discharge = Discharge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @discharge }\n end\n end",
"title": ""
},
{
"docid": "e2c48c8c0f8ad51b8f4c6ee14a1ab5a3",
"score": "0.6626662",
"text": "def new\n @convenio = Convenio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @convenio }\n end\n end",
"title": ""
}
] |
008ad0a329595861f01dca5a7fdc1e3b
|
Sets the onPremisesSecurityIdentifier property value. Contains the onpremises security identifier (SID) for the user that was synchronized from onpremises to the cloud. Readonly. Returned only on $select. Supports $filter (eq including on null values).
|
[
{
"docid": "2de3ad9d6dfddd4f55a5f073a7dc085e",
"score": "0.8133679",
"text": "def on_premises_security_identifier=(value)\n @on_premises_security_identifier = value\n end",
"title": ""
}
] |
[
{
"docid": "790a4e732a8c34616ced0999035fadab",
"score": "0.7020967",
"text": "def on_premises_security_identifier\n return @on_premises_security_identifier\n end",
"title": ""
},
{
"docid": "790a4e732a8c34616ced0999035fadab",
"score": "0.7020967",
"text": "def on_premises_security_identifier\n return @on_premises_security_identifier\n end",
"title": ""
},
{
"docid": "790a4e732a8c34616ced0999035fadab",
"score": "0.7020967",
"text": "def on_premises_security_identifier\n return @on_premises_security_identifier\n end",
"title": ""
},
{
"docid": "790a4e732a8c34616ced0999035fadab",
"score": "0.7020967",
"text": "def on_premises_security_identifier\n return @on_premises_security_identifier\n end",
"title": ""
},
{
"docid": "d429d0eecc0387476b6f6d1966792419",
"score": "0.64591956",
"text": "def security_identifier=(value)\n @security_identifier = value\n end",
"title": ""
},
{
"docid": "d429d0eecc0387476b6f6d1966792419",
"score": "0.64591956",
"text": "def security_identifier=(value)\n @security_identifier = value\n end",
"title": ""
},
{
"docid": "4098a7df3a6263693683da1219699943",
"score": "0.5353506",
"text": "def on_premises_immutable_id=(value)\n @on_premises_immutable_id = value\n end",
"title": ""
},
{
"docid": "0f3f6199e3f548ccea10cd386866d9b0",
"score": "0.52501696",
"text": "def on_premises_user_principal_name=(value)\n @on_premises_user_principal_name = value\n end",
"title": ""
},
{
"docid": "177755bf1851670cd829175997a244d2",
"score": "0.5243569",
"text": "def security_identifier\n return @security_identifier\n end",
"title": ""
},
{
"docid": "177755bf1851670cd829175997a244d2",
"score": "0.5243569",
"text": "def security_identifier\n return @security_identifier\n end",
"title": ""
},
{
"docid": "c39f56888442ed7421f1b74297b8464d",
"score": "0.5225234",
"text": "def on_premises_sam_account_name=(value)\n @on_premises_sam_account_name = value\n end",
"title": ""
},
{
"docid": "c39f56888442ed7421f1b74297b8464d",
"score": "0.5225234",
"text": "def on_premises_sam_account_name=(value)\n @on_premises_sam_account_name = value\n end",
"title": ""
},
{
"docid": "a40a0e34ca439423163c3ce7f56e9622",
"score": "0.50055164",
"text": "def on_premises_info=(value)\n @on_premises_info = value\n end",
"title": ""
},
{
"docid": "0a1b831995f488c1baa01602ed172d99",
"score": "0.49872473",
"text": "def set_security\n @security = Security.find(params[:id])\n end",
"title": ""
},
{
"docid": "5f03118834fcf439e232d9da53443d96",
"score": "0.49737504",
"text": "def on_premises_sam_account_name\n return @on_premises_sam_account_name\n end",
"title": ""
},
{
"docid": "5f03118834fcf439e232d9da53443d96",
"score": "0.49737504",
"text": "def on_premises_sam_account_name\n return @on_premises_sam_account_name\n end",
"title": ""
},
{
"docid": "43c9edc8ff527c41989e6a4079e78462",
"score": "0.49370116",
"text": "def source_identity=(value)\n @source_identity = value\n end",
"title": ""
},
{
"docid": "73ddcc9dccdb3a1b213c19a405944d48",
"score": "0.49012738",
"text": "def set_matrix_security_user\n @matrix_security_user = MatrixSecurity::User.find(params[:id])\n end",
"title": ""
},
{
"docid": "604d9b59dcdc3c1ba1fbcfd7d289290e",
"score": "0.4900051",
"text": "def on_premises_user_principal_name\n return @on_premises_user_principal_name\n end",
"title": ""
},
{
"docid": "57ebfbc7e9c16bd773032875c9c89fe9",
"score": "0.4890003",
"text": "def identity_resource_identifier=(value)\n @identity_resource_identifier = value\n end",
"title": ""
},
{
"docid": "2b82ae829957cedc0bc6cfccf2522c2c",
"score": "0.48858586",
"text": "def set_security_device\n @security_device = ::SecurityDevice::SecurityDevice.find(params[:id])\n end",
"title": ""
},
{
"docid": "d551c446246b3ae45e74996836d15a77",
"score": "0.48492417",
"text": "def security_enabled=(value)\n @security_enabled = value\n end",
"title": ""
},
{
"docid": "313daf51b25336f6339d1be326ffc261",
"score": "0.4838521",
"text": "def alternative_security_ids=(value)\n @alternative_security_ids = value\n end",
"title": ""
},
{
"docid": "f1ed08640b61d7a781f70a692d66534a",
"score": "0.48284447",
"text": "def ssn\n safe_attr('va_eauth_pnid')&.delete('-') if safe_attr('va_eauth_pnidtype') == 'SSN'\n end",
"title": ""
},
{
"docid": "f1ed08640b61d7a781f70a692d66534a",
"score": "0.48284447",
"text": "def ssn\n safe_attr('va_eauth_pnid')&.delete('-') if safe_attr('va_eauth_pnidtype') == 'SSN'\n end",
"title": ""
},
{
"docid": "ce1c18d9fdb7bc8211002c67105970cf",
"score": "0.48187086",
"text": "def external_principal_id=(value)\n @external_principal_id = value\n end",
"title": ""
},
{
"docid": "414b28e532f4201f61dfef63e8145511",
"score": "0.48081943",
"text": "def service_principal_id=(value)\n @service_principal_id = value\n end",
"title": ""
},
{
"docid": "6d14f22fc9cb94e2bfb14a08fb26f6b1",
"score": "0.47362128",
"text": "def account_sid=(value); end",
"title": ""
},
{
"docid": "0fc5069af8ede2e47f2e03d516955a86",
"score": "0.4730726",
"text": "def principal_id=(value)\n @principal_id = value\n end",
"title": ""
},
{
"docid": "d62bd45f59de7e402f3ca6759a412c5c",
"score": "0.47280487",
"text": "def set_IncomingPhoneNumberSID(value)\n set_input(\"IncomingPhoneNumberSID\", value)\n end",
"title": ""
},
{
"docid": "d62bd45f59de7e402f3ca6759a412c5c",
"score": "0.47280487",
"text": "def set_IncomingPhoneNumberSID(value)\n set_input(\"IncomingPhoneNumberSID\", value)\n end",
"title": ""
},
{
"docid": "d62bd45f59de7e402f3ca6759a412c5c",
"score": "0.47280487",
"text": "def set_IncomingPhoneNumberSID(value)\n set_input(\"IncomingPhoneNumberSID\", value)\n end",
"title": ""
},
{
"docid": "afe6b77983fc3f7c606763f6559762d1",
"score": "0.4703494",
"text": "def principal_id=(value)\n @principal_id = value\n end",
"title": ""
},
{
"docid": "afe6b77983fc3f7c606763f6559762d1",
"score": "0.4703494",
"text": "def principal_id=(value)\n @principal_id = value\n end",
"title": ""
},
{
"docid": "afe6b77983fc3f7c606763f6559762d1",
"score": "0.4703494",
"text": "def principal_id=(value)\n @principal_id = value\n end",
"title": ""
},
{
"docid": "97365f37f2038fbf965658c764cebbf7",
"score": "0.46981314",
"text": "def set_individual_identity\n @individual_identity = IndividualIdentity.find(params[:id])\n end",
"title": ""
},
{
"docid": "5cc63d696506e00266d2ab94b4404621",
"score": "0.46941292",
"text": "def ssn=(new_ssn)\n if !new_ssn.blank?\n write_attribute(:encrypted_ssn, Person.encrypt_ssn(new_ssn))\n else\n unset_sparse(\"encrypted_ssn\")\n end\n end",
"title": ""
},
{
"docid": "5cc63d696506e00266d2ab94b4404621",
"score": "0.46941292",
"text": "def ssn=(new_ssn)\n if !new_ssn.blank?\n write_attribute(:encrypted_ssn, Person.encrypt_ssn(new_ssn))\n else\n unset_sparse(\"encrypted_ssn\")\n end\n end",
"title": ""
},
{
"docid": "c8ef82c7bc9785bc54b9e2f29fff0df1",
"score": "0.46904263",
"text": "def issn=(value)\n write_attribute(:issn, value)\n #TODO if there is already an 'Identifier::Global::Issn' update instead of add\n self.identifiers.build(type: 'Identifier::Global::Issn', identifier: value) if ! value.blank?\n end",
"title": ""
},
{
"docid": "b09bea4da02150b1724fc68703b7ccb0",
"score": "0.46859533",
"text": "def ssn\n attributes['va_eauth_pnid']&.delete('-') if attributes['va_eauth_pnidtype'] == 'SSN'\n end",
"title": ""
},
{
"docid": "5ad3d61db1a31db47a7eb6feb1b5e66a",
"score": "0.46759737",
"text": "def ssn=(new_ssn)\n if !new_ssn.blank?\n write_attribute(:encrypted_ssn, CensusMember.encrypt_ssn(new_ssn))\n else\n unset_sparse(\"encrypted_ssn\")\n end\n end",
"title": ""
},
{
"docid": "f8ab3ba37660b88111b4515ea69793dd",
"score": "0.4669044",
"text": "def on_premises_immutable_id\n return @on_premises_immutable_id\n end",
"title": ""
},
{
"docid": "9add1465b6e21c628dd9d20251e8cc42",
"score": "0.4651542",
"text": "def set_SecurityToken(value)\n set_input(\"SecurityToken\", value)\n end",
"title": ""
},
{
"docid": "9add1465b6e21c628dd9d20251e8cc42",
"score": "0.4651542",
"text": "def set_SecurityToken(value)\n set_input(\"SecurityToken\", value)\n end",
"title": ""
},
{
"docid": "9add1465b6e21c628dd9d20251e8cc42",
"score": "0.46505484",
"text": "def set_SecurityToken(value)\n set_input(\"SecurityToken\", value)\n end",
"title": ""
},
{
"docid": "9add1465b6e21c628dd9d20251e8cc42",
"score": "0.46505484",
"text": "def set_SecurityToken(value)\n set_input(\"SecurityToken\", value)\n end",
"title": ""
},
{
"docid": "9add1465b6e21c628dd9d20251e8cc42",
"score": "0.46505484",
"text": "def set_SecurityToken(value)\n set_input(\"SecurityToken\", value)\n end",
"title": ""
},
{
"docid": "e65edcc3791f3b111fb8533243141b4c",
"score": "0.46490976",
"text": "def set_identity_provider\n @identity_provider = IdentityProvider.find(params[:id])\n end",
"title": ""
},
{
"docid": "9f1fe37371be33db8826de3ca0adcf55",
"score": "0.46374282",
"text": "def on_premises_sync_enabled=(value)\n @on_premises_sync_enabled = value\n end",
"title": ""
},
{
"docid": "9f1fe37371be33db8826de3ca0adcf55",
"score": "0.46374282",
"text": "def on_premises_sync_enabled=(value)\n @on_premises_sync_enabled = value\n end",
"title": ""
},
{
"docid": "9f1fe37371be33db8826de3ca0adcf55",
"score": "0.46374282",
"text": "def on_premises_sync_enabled=(value)\n @on_premises_sync_enabled = value\n end",
"title": ""
},
{
"docid": "9f1fe37371be33db8826de3ca0adcf55",
"score": "0.46374282",
"text": "def on_premises_sync_enabled=(value)\n @on_premises_sync_enabled = value\n end",
"title": ""
},
{
"docid": "9f1fe37371be33db8826de3ca0adcf55",
"score": "0.46374282",
"text": "def on_premises_sync_enabled=(value)\n @on_premises_sync_enabled = value\n end",
"title": ""
},
{
"docid": "bdb0d3cb1ff24ced34f4f396558120d5",
"score": "0.46045268",
"text": "def primary=(set_primary)\n return unless set_primary\n customer.update(InvoiceAdressNo: id)\n end",
"title": ""
},
{
"docid": "e515a1cc8a921200325cec472567d917",
"score": "0.46012306",
"text": "def identity_sources=(value)\n @identity_sources = value\n end",
"title": ""
},
{
"docid": "cbfcd2b7a161403df26e812bfd1d1959",
"score": "0.45647556",
"text": "def on_premises_domain_name=(value)\n @on_premises_domain_name = value\n end",
"title": ""
},
{
"docid": "cbfcd2b7a161403df26e812bfd1d1959",
"score": "0.45647556",
"text": "def on_premises_domain_name=(value)\n @on_premises_domain_name = value\n end",
"title": ""
},
{
"docid": "b624a3f7e2cc49c44b34950be6e83de8",
"score": "0.4564363",
"text": "def identity_synchronization=(value)\n @identity_synchronization = value\n end",
"title": ""
},
{
"docid": "3c7e5dc9a07245e745327be879b4e6ee",
"score": "0.4527976",
"text": "def ssn=(ssn)\n @ssn = ssn\n self.encrypted_ssn = Encryptor.one_way_encrypt_string(ssn)\n end",
"title": ""
},
{
"docid": "fc6a77f8550298225cf454e907527416",
"score": "0.45085317",
"text": "def set_insured_user\n @insured_user = InsuredUser.find(params[:id])\n end",
"title": ""
},
{
"docid": "9210188fc33ee4b09e444e75782feb29",
"score": "0.45076394",
"text": "def set_identity_provider\n @identity_provider = IdentityProvider.find(params[:id])\n end",
"title": ""
},
{
"docid": "6367ba3bdf5d3e91ef834b137ec7883b",
"score": "0.4500435",
"text": "def set_insured_user\n @insured_user = InsuredUser.find(params[:id])\n end",
"title": ""
},
{
"docid": "da2e61e3b7a019ed956fd732b5b16055",
"score": "0.44987348",
"text": "def service_principal_filter=(value)\n @service_principal_filter = value\n end",
"title": ""
},
{
"docid": "df717e80ebc4cd28c31404296767adb9",
"score": "0.44964",
"text": "def issn=(id)\n series_identifier_set(2, id)\n end",
"title": ""
},
{
"docid": "90b69164b9c9ddcee93aff61ad1968a3",
"score": "0.44780886",
"text": "def set_security_camera\n @security_camera = SecurityCamera.find(params[:id])\n end",
"title": ""
},
{
"docid": "fac9e2857c5002ba1ddc764555a87198",
"score": "0.44657382",
"text": "def set_EC2SecurityGroupOwnerId(value)\n set_input(\"EC2SecurityGroupOwnerId\", value)\n end",
"title": ""
},
{
"docid": "fac9e2857c5002ba1ddc764555a87198",
"score": "0.44657382",
"text": "def set_EC2SecurityGroupOwnerId(value)\n set_input(\"EC2SecurityGroupOwnerId\", value)\n end",
"title": ""
},
{
"docid": "5e2ff5f690d6ac84a4f01397925c2218",
"score": "0.4460576",
"text": "def set_security_company\n @security_company = SecurityCompany.find(params[:id])\n end",
"title": ""
},
{
"docid": "26f5329e9fc51a7e08b04a8ef18d8650",
"score": "0.445794",
"text": "def primary_role=(value)\n @primary_role = value\n end",
"title": ""
},
{
"docid": "1012288066e34c04c419888de400427f",
"score": "0.44552958",
"text": "def enable_id_token_issuance=(value)\n @enable_id_token_issuance = value\n end",
"title": ""
},
{
"docid": "e026dc9fd45fac6178fa0463a827c4bb",
"score": "0.44548425",
"text": "def set_identity\n @identity = Identity.find(params[:id])\n authorize @identity\n end",
"title": ""
},
{
"docid": "00c831f2698a48378fa7507e814d5439",
"score": "0.44367132",
"text": "def identity=(value)\n setsockopt IDENTITY, value.to_s\n end",
"title": ""
},
{
"docid": "00c831f2698a48378fa7507e814d5439",
"score": "0.44367132",
"text": "def identity=(value)\n setsockopt IDENTITY, value.to_s\n end",
"title": ""
},
{
"docid": "00c831f2698a48378fa7507e814d5439",
"score": "0.44367132",
"text": "def identity=(value)\n setsockopt IDENTITY, value.to_s\n end",
"title": ""
},
{
"docid": "0d893c4660bc846be091f739afd5d3ce",
"score": "0.44340003",
"text": "def set_SourceDBInstanceIdentifier(value)\n set_input(\"SourceDBInstanceIdentifier\", value)\n end",
"title": ""
},
{
"docid": "9a1c47f4720fea989e4d729aa7ed46f6",
"score": "0.4416009",
"text": "def set_seccion_local\n @seccion_local = SeccionLocal.find(params[:id])\n end",
"title": ""
},
{
"docid": "a40a1f349b011e8d271bcf5e5a077ee4",
"score": "0.4413099",
"text": "def set_security_classification\n @security_classification = SecurityClassification.find(params[:id])\n end",
"title": ""
},
{
"docid": "5083c44893cf50820d0a229f2d639563",
"score": "0.43964323",
"text": "def set_identity\n @identity = Identity.find(params[:identity_id])\n\n # make sure the identity belongs to this user\n unless @identity.user == current_user\n redirect_to root_url\n end\n end",
"title": ""
},
{
"docid": "7f8547ff86058bab41904e0da9a08d72",
"score": "0.4391222",
"text": "def set_identity\n @identity = Identity.find(params[:id])\n end",
"title": ""
},
{
"docid": "09cd08cb38d6086f148ea743b7c71caf",
"score": "0.43807963",
"text": "def set_IdentityID(value)\n set_input(\"IdentityID\", value)\n end",
"title": ""
},
{
"docid": "09cd08cb38d6086f148ea743b7c71caf",
"score": "0.43807963",
"text": "def set_IdentityID(value)\n set_input(\"IdentityID\", value)\n end",
"title": ""
},
{
"docid": "09cd08cb38d6086f148ea743b7c71caf",
"score": "0.43807963",
"text": "def set_IdentityID(value)\n set_input(\"IdentityID\", value)\n end",
"title": ""
},
{
"docid": "09cd08cb38d6086f148ea743b7c71caf",
"score": "0.43807963",
"text": "def set_IdentityID(value)\n set_input(\"IdentityID\", value)\n end",
"title": ""
},
{
"docid": "09cd08cb38d6086f148ea743b7c71caf",
"score": "0.43807963",
"text": "def set_IdentityID(value)\n set_input(\"IdentityID\", value)\n end",
"title": ""
},
{
"docid": "09cd08cb38d6086f148ea743b7c71caf",
"score": "0.43807963",
"text": "def set_IdentityID(value)\n set_input(\"IdentityID\", value)\n end",
"title": ""
},
{
"docid": "d0d0857dae3847a943e61b489c1e2e2e",
"score": "0.4375814",
"text": "def custom_security_attributes=(value)\n @custom_security_attributes = value\n end",
"title": ""
},
{
"docid": "d0d0857dae3847a943e61b489c1e2e2e",
"score": "0.4375814",
"text": "def custom_security_attributes=(value)\n @custom_security_attributes = value\n end",
"title": ""
},
{
"docid": "6f54cedeecc392fb5567018eb82c210d",
"score": "0.43594894",
"text": "def current_identity=(identity)\n @current_identity = identity\n end",
"title": ""
},
{
"docid": "971031cf5857c17a0316b61d257dccb7",
"score": "0.4351393",
"text": "def set_security_software\n @security_software = SecuritySoftware.find(params[:id])\n end",
"title": ""
},
{
"docid": "8fe6dc9a81610443f3cf6e3c795cec84",
"score": "0.43411273",
"text": "def set_security_element\n @security_element = SecurityElement.find(params[:id])\n end",
"title": ""
},
{
"docid": "4f02cc608e6c8a93aa779ac414f91f5e",
"score": "0.43361938",
"text": "def set_VpcSecurityGroupIds(value)\n set_input(\"VpcSecurityGroupIds\", value)\n end",
"title": ""
},
{
"docid": "e4fa512b9f160c4149ebc14f4031ecf4",
"score": "0.43350953",
"text": "def identity=(value)\n @identity = value\n end",
"title": ""
},
{
"docid": "e4fa512b9f160c4149ebc14f4031ecf4",
"score": "0.43350953",
"text": "def identity=(value)\n @identity = value\n end",
"title": ""
},
{
"docid": "e4fa512b9f160c4149ebc14f4031ecf4",
"score": "0.43350953",
"text": "def identity=(value)\n @identity = value\n end",
"title": ""
},
{
"docid": "e4fa512b9f160c4149ebc14f4031ecf4",
"score": "0.43350953",
"text": "def identity=(value)\n @identity = value\n end",
"title": ""
},
{
"docid": "f6e65ca089d16eb97dc56b5249dfc711",
"score": "0.4332077",
"text": "def set_invention_has_student\n @invention_has_student = InventionHasStudent.find(params[:id])\n end",
"title": ""
},
{
"docid": "973ded0e346bd3e4c4d74af54b030dde",
"score": "0.43258464",
"text": "def set_security_question\n @security_question = SecurityQuestion.find(params[:id])\n end",
"title": ""
}
] |
f9b73fad02d1de4f65de919fd8b68f6c
|
GET /issues/1 GET /issues/1.json
|
[
{
"docid": "0de852f45fc350daa19f14d5fb9d1d56",
"score": "0.0",
"text": "def show\n \n @comments = Comment.where(issue_id: @issue).order(\"created_at DESC\")\n end",
"title": ""
}
] |
[
{
"docid": "a301822fbe1d079022fa7529293c5db9",
"score": "0.76324594",
"text": "def index\n a = URI.parse(\"https://api.github.com/repos/nnluukhtn/employment_bot/issues?state=all\").read\n @gitissue = JSON.parse(a)\n end",
"title": ""
},
{
"docid": "4c7f71ef1304137ac2477268b7ff9966",
"score": "0.7347235",
"text": "def list_issue(issue)\n payload = JSON.generate(gist_issue_1)\n uri = URI(\"https://github.com/stevefake/2016.03.28/issues/1\")\n req = Net::HTTP::Post.new(uri, {'Content-Type' =>'application/json'})\n req.basic_auth ENV['GITHUB_USER'], ENV['GITHUB_PASSWORD']\n req.body = payload\n http = Net::HTTP.new(uri.hostname, uri.port)\n http.use_ssl = true\n http.start\n response = http.request(req)\n return response\n end",
"title": ""
},
{
"docid": "cd62b8dd63c181ee639eae89c93a7ec4",
"score": "0.7344943",
"text": "def list_issues\n\t\t\tself.class.get(\"/issues\", :headers => @auth)\n\t\tend",
"title": ""
},
{
"docid": "8a8b965a91524fc97afb9f32a3dd16e4",
"score": "0.7308888",
"text": "def issues\n Bugly.\n get(api_issues_url).\n fetch(\"issues\", []).\n map { |i| Bugly::Issue.new(i) }\n end",
"title": ""
},
{
"docid": "849dcd5c153104911f7f389157d6d44a",
"score": "0.7288346",
"text": "def index\n @issues = Issue.all\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @issues }\n end\n end",
"title": ""
},
{
"docid": "9284c5f8d282b0eb468d3e8ed5bddfea",
"score": "0.72822726",
"text": "def index\n @issues = @jira_manager.fetch_issues\n rescue => error\n render json: {message: error.message}, status: :internal_server_error\n end",
"title": ""
},
{
"docid": "a7627d59a18162d4375cee0e77a5a25f",
"score": "0.7282137",
"text": "def show\n @issue = Issue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issue }\n end\n end",
"title": ""
},
{
"docid": "a7627d59a18162d4375cee0e77a5a25f",
"score": "0.7282137",
"text": "def show\n @issue = Issue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issue }\n end\n end",
"title": ""
},
{
"docid": "a7627d59a18162d4375cee0e77a5a25f",
"score": "0.7282137",
"text": "def show\n @issue = Issue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issue }\n end\n end",
"title": ""
},
{
"docid": "9f1272cc3eb76b83263ca0146b745bd8",
"score": "0.72608817",
"text": "def issue(owner, repo, number)\n get \"/repos/#{owner}/#{repo}/issues/#{number}\"\n end",
"title": ""
},
{
"docid": "892d1ebc844eb1179cd0655436bf0356",
"score": "0.72587305",
"text": "def issues\n @projects = current_user.projects.all\n @user = current_user\n @issues = current_user.assigned_issues.opened.recent.page(params[:page]).per(20)\n @issues = @issues.includes(:author, :project)\n\n respond_to do |format|\n format.html\n format.atom { render layout: false }\n end\n end",
"title": ""
},
{
"docid": "8beed1844556070ba90dfdb4ab985c54",
"score": "0.7251772",
"text": "def show\n @issue = Issue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @issue }\n end\n end",
"title": ""
},
{
"docid": "a28a338189bf4ce3da55f3fa150e32ab",
"score": "0.72395355",
"text": "def show\n\n respond_to do |format|\n format.html\n format.json { render json: @issue }\n end\n end",
"title": ""
},
{
"docid": "6fb732ab4688aa17997c978006d39efa",
"score": "0.72357917",
"text": "def issue(repo, number, options = {})\n get \"#{Repository.path repo}/issues/#{number}\", options\n end",
"title": ""
},
{
"docid": "718da104824e7e20e0f1f053aa2cd462",
"score": "0.7223863",
"text": "def get_github_issues github_uri\n github_api_helper github_uri,'issues'\n end",
"title": ""
},
{
"docid": "749034a20c9ce13bb50102543c7f1657",
"score": "0.7215329",
"text": "def show\n @issue = current_user.organization.issues.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issue }\n end\n end",
"title": ""
},
{
"docid": "3bafd036aff62ac30ab501a9b90e1729",
"score": "0.71944195",
"text": "def show\n respond_with(@issue) do |format|\n format.json { render json: @issue.to_json }\n end\n end",
"title": ""
},
{
"docid": "c954bc2a5aa0642ae1420178db971a52",
"score": "0.7181208",
"text": "def show\n @issue = @user.issues.find(params[:id])\n end",
"title": ""
},
{
"docid": "65c8cf0952e122010c92b2a59ca8966f",
"score": "0.71759963",
"text": "def index\n @issues = Issue.all\n end",
"title": ""
},
{
"docid": "65c8cf0952e122010c92b2a59ca8966f",
"score": "0.71759963",
"text": "def index\n @issues = Issue.all\n end",
"title": ""
},
{
"docid": "65c8cf0952e122010c92b2a59ca8966f",
"score": "0.71759963",
"text": "def index\n @issues = Issue.all\n end",
"title": ""
},
{
"docid": "65c8cf0952e122010c92b2a59ca8966f",
"score": "0.71759963",
"text": "def index\n @issues = Issue.all\n end",
"title": ""
},
{
"docid": "65c8cf0952e122010c92b2a59ca8966f",
"score": "0.71759963",
"text": "def index\n @issues = Issue.all\n end",
"title": ""
},
{
"docid": "65c8cf0952e122010c92b2a59ca8966f",
"score": "0.71759963",
"text": "def index\n @issues = Issue.all\n end",
"title": ""
},
{
"docid": "65c8cf0952e122010c92b2a59ca8966f",
"score": "0.71759963",
"text": "def index\n @issues = Issue.all\n end",
"title": ""
},
{
"docid": "65c8cf0952e122010c92b2a59ca8966f",
"score": "0.71759963",
"text": "def index\n @issues = Issue.all\n end",
"title": ""
},
{
"docid": "65c8cf0952e122010c92b2a59ca8966f",
"score": "0.71759963",
"text": "def index\n @issues = Issue.all\n end",
"title": ""
},
{
"docid": "65c8cf0952e122010c92b2a59ca8966f",
"score": "0.71759963",
"text": "def index\n @issues = Issue.all\n end",
"title": ""
},
{
"docid": "65c8cf0952e122010c92b2a59ca8966f",
"score": "0.71759963",
"text": "def index\n @issues = Issue.all\n end",
"title": ""
},
{
"docid": "d6b75df5e8590a1870f24d5e75e4aa5e",
"score": "0.716953",
"text": "def issue(repo, number, options={})\n get(\"/repos/#{Repository.new(repo)}/issues/#{number}\", options, 3)\n end",
"title": ""
},
{
"docid": "04d1dfab6745c13cba87245b2d19f5f0",
"score": "0.7156447",
"text": "def lookup_jira_issues\n # /rest/api/2/project/DP\n project = @jira.Project.find('DP')\n # /rest/api/2/search?jql=project%3D%22DP%22\n project.issues\n end",
"title": ""
},
{
"docid": "c62b2e6b3763ce83060f7041f0c3ac41",
"score": "0.71489006",
"text": "def get_issues(params)\n # { |response, request, result, &block|\n # JSON.parse(.to_str, symbolize_names: true)\n # \"! Server Error: #{response.code}\"\n RestClient.post \"#{@api_url}/issues.json?auth_token=#{@auth_token}\", params do |response, request, result, &block|\n case response.code\n when 200\n JSON.parse(response.to_str, :symbolize_names => true)\n else\n { :errors => [response.code] }\n end\n end\n end",
"title": ""
},
{
"docid": "5658feae770c98a94db4d41cce738520",
"score": "0.7130375",
"text": "def index\n @issues = @user.issues\n end",
"title": ""
},
{
"docid": "a969d695cb2f2560c3e6e925818ed578",
"score": "0.7120539",
"text": "def issues\n response = client.get(client.options[:rest_base_path] + \"/search?jql=project%3D'#{key}'\")\n json = self.class.parse_json(response.body)\n json['issues'].map do |issue|\n client.Issue.build(issue)\n end\n end",
"title": ""
},
{
"docid": "d4dd732170ddc2bb6ea9b46f311cf3df",
"score": "0.7097765",
"text": "def show\n @issue = Issue.where(issue_id: params[:id]).first\n rescue => error\n render json: {message: error.message}, status: :internal_server_error\n end",
"title": ""
},
{
"docid": "e40ecc4fe8b961f085c247b30161419b",
"score": "0.709408",
"text": "def get_issues(params)\n RestClient::Request.execute method: :post, url: \"#{@api_url}/issues/scan.json\",\n headers: @headers, payload: params do |response, request, result, &block|\n case response.code\n when 200\n JSON.parse(response.to_str, :symbolize_names => true)\n else\n { :errors => [response.code] }\n end\n end\n end",
"title": ""
},
{
"docid": "47c4318d43dbba63d41d38d5bd4f5f52",
"score": "0.7060154",
"text": "def show\n @issue2 = Issue.find(params[:id])\n respond_to do |format|\n format.html\n format.json {render json: @issue2, status: :ok, serializer: IssuesSerializer}\n end\n end",
"title": ""
},
{
"docid": "44042ea4ec1a4dae6507b48400117caa",
"score": "0.7046389",
"text": "def show\n @issue = Issue.find(params[:id])\n @resource = @issue\n @notes = @issue.notes\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issue }\n end\n end",
"title": ""
},
{
"docid": "3acd128c799541b583cc49189b49d8e5",
"score": "0.7029003",
"text": "def index\n if session[:ref].nil?\n #create reference\n #session[:ref] = Digest::SHA2.hexdigest(Time.now.to_s + 'ts')\n session[:ref] = session[:session_id]\n end\n if params[:ref]\n #get reference from url\n session[:ref] = params[:ref]\n end\n @issues = Issue.where(:ref=>session[:ref])\n\n if @issues.count==0\n flash[:notice] = \"You haven't issues. You can add them by pressing *New Issue*\"\n else\n flash[:notice] = nil\n end\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @issues }\n end\n end",
"title": ""
},
{
"docid": "6b390accec477ff4630ed3e2b4a6ec1e",
"score": "0.69977367",
"text": "def index \n # dont want all issues associated everywhere, just want the one associated with a specific project\n # first figure out the project, and then get that projects issues\n # since our issues are associated with a project, we can use that project to access those specific issues associated with that project\n \n @issues = @project.issues \n render json: @issues # saying render these issues as JSON\n # whatever we have here aka `@issues` is what will be ther responce in our fetch requests \n # aka this is what is sent back into our frontend after a fetch request is run \n # -------OR------------\n # @issues = Issue.all\n # render json: @issues\n # issues = Issue.order(\"created_at DESC\")\n end",
"title": ""
},
{
"docid": "69666cf58efc06c11bbb9330a6ea93be",
"score": "0.6997497",
"text": "def index\n\t\t@issues = Issue.all\n\tend",
"title": ""
},
{
"docid": "25ac2f4929655d5e80acdb9493db2bab",
"score": "0.6972216",
"text": "def issues\n @user = current_user\n @issues = current_user.assigned_issues.opened\n @issues = @issues.of_group(@group).order(\"created_at DESC\").page(params[:page]).per(20)\n @issues = @issues.includes(:author, :project)\n\n respond_to do |format|\n format.html\n format.atom { render layout: false }\n end\n end",
"title": ""
},
{
"docid": "1ce21fc588b60f7e5d08e0b7229f2867",
"score": "0.69711",
"text": "def show\n @issue_list = IssueList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issue_list }\n end\n end",
"title": ""
},
{
"docid": "3652c6befc75a6740b6e278bdad49df2",
"score": "0.6955033",
"text": "def show\n @project = Project.find(params[:id])\n @issue = @project.issues.new\n end",
"title": ""
},
{
"docid": "ab414139aa67df77d60a058e2c8cdbcc",
"score": "0.6939473",
"text": "def show\n respond_to do |format|\n format.html\n format.json {render json: @issue, status: :ok, serializer: IssueSerializer}\n end\n end",
"title": ""
},
{
"docid": "29b45565ba6465272d53da9aad3a8eec",
"score": "0.69370306",
"text": "def user_issues(options={})\n get '/user/issues', :params => options\n end",
"title": ""
},
{
"docid": "4a5290a7bd7fbbc598e16cb3159fc406",
"score": "0.6929845",
"text": "def get(user, repo_name, id, params={})\n issue_data = @connection.get(\"/repos/#{user}/#{repo_name}/issues/#{id.to_s}\", params)\n GitHubApi::Issue.new_with_all_data(self, issue_data)\n rescue RestClient::ResourceNotFound\n raise NotFound, \"The issue #{user}/#{repo_name}/issues/#{id} does not exist or is not visible to the user.\"\n end",
"title": ""
},
{
"docid": "7275c963e7ec3be5dfdd0d4ac52fdcd8",
"score": "0.6921795",
"text": "def show\n @issues = Issue.where(project: @project)\n end",
"title": ""
},
{
"docid": "6d0698e6d70eed95a458197a80f0d98d",
"score": "0.69046885",
"text": "def show\n @issue_resource = IssueResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issue_resource }\n end\n end",
"title": ""
},
{
"docid": "30c0460253a6e7cec29dfe4dedb30ac6",
"score": "0.6903704",
"text": "def repo_issues(owner, repo, options={})\n get \"/repos/#{owner}/#{repo}/issues\"\n end",
"title": ""
},
{
"docid": "0a78865dcc3382264931aba17864b45d",
"score": "0.6897419",
"text": "def issues(options = {})\n search_url = client.options[:rest_base_path] + '/search'\n query_params = { jql: \"project=\\\"#{key}\\\"\" }\n query_params.update Base.query_params_for_search(options)\n response = client.get(url_with_query_params(search_url, query_params))\n json = self.class.parse_json(response.body)\n json['issues'].map do |issue|\n client.Issue.build(issue)\n end\n end",
"title": ""
},
{
"docid": "c886d052018920dc738e025fa50cf73d",
"score": "0.6874728",
"text": "def issues\n return IssuesAPI.new(self)\n end",
"title": ""
},
{
"docid": "21220c3217d611b1dfbb3389b9df9e95",
"score": "0.68701285",
"text": "def index\n i = params[:issue_id]\n @issue = Issue.choose_issue(i)\n @ideas = Idea.where(\"issue_id = ?\", @issue)\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @ideas }\n end\n end",
"title": ""
},
{
"docid": "88cc34cf3903f1acf9af9688571a9c35",
"score": "0.6841417",
"text": "def issues\n respond_with @article_issues_presenter do |format|\n format.json { render json: @article_issues_presenter.as_json(only: [:priority, :kind, :status, :summary, :description, :subscribed_emails]) }\n end\n end",
"title": ""
},
{
"docid": "64b04b31fb01a0a82c390fe5c6d83815",
"score": "0.6814045",
"text": "def get_issues_info\n closed_issues = []\n stop = false\n page = 1\n\n until stop\n issue_fetch = HTTParty.get(@GITHUB_API_BASE_URL + \"/issues?state=closed&page=#{page}&access_token=#{@access_token}\", headers: {\n \"User-Agent\" => @user_agent\n })\n\n if issue_fetch.is_a?(Hash) && issue_fetch['message'] === 'Not Found'\n break\n end\n\n if issue_fetch.count === 0\n stop = true\n end\n\n\n issue_fetch.each do |issue|\n closed_issues << {\n 'number' => issue['number'],\n 'created_at' => issue['created_at'],\n 'closed_at' => issue['closed_at'],\n 'duration' => (Date.parse(issue['closed_at']) - Date.parse(issue['created_at'])).to_i\n }\n end\n\n page += 1\n end\n\n closed_issues.reverse!\n end",
"title": ""
},
{
"docid": "701dd62d0d26b917e75b453cdf0d7019",
"score": "0.68022907",
"text": "def index\n if params[:format]\n session[:project_id] = params[:format]\n end\n @project = Project.find_by(id: session[:project_id])\n @issues = Issue.where(project_id: @project)\n end",
"title": ""
},
{
"docid": "9f52dadc1b0b4cd60ff5ac97be6e3b09",
"score": "0.67949325",
"text": "def issues\n id = 10000\n ISSUES.map do |i|\n id += 1\n i.merge(\n :id => id,\n :self => \"#{@jira_url}/rest/api/2/issue/#{id}\",\n :fields => i[:fields].merge(\n :status => i[:fields][:status].merge(\n :self => \"#{@jira_url}/rest/api/2/status/#{i[:fields][:status][:id]}\"\n )\n )\n )\n end\n end",
"title": ""
},
{
"docid": "e233e4af712f87c37407cd39117de579",
"score": "0.6776641",
"text": "def get_issues(organization, repo)\n request = Typhoeus::Request.new(\n \"https://api.github.com/repos/#{organization}/#{repo}/issues\",\n headers: {Authorization: \"token #{token}\"}\n )\n response = request.run\n repos = JSON.parse(response.body).map do |issue|\n issue\n end\n end",
"title": ""
},
{
"docid": "8c17cc1770b409ddcb499e6c255d87bb",
"score": "0.6763888",
"text": "def get_issue(issue_number)\n\n RestClient.proxy = @proxy\n\n url = @github_api_url + \"/repos\" + @github_repo + \"/issues/#{issue_number}\"\n headers = {:accept => :json, :content_type => :json, :authorization => \"Bearer #{@gitub_token}\"}\n\n r = RestClient.get url, headers\n\n issue = JSON.parse(r.body)\n return issue\n end",
"title": ""
},
{
"docid": "5a1d27d3b73138d8044130de56ccaf6c",
"score": "0.67538357",
"text": "def show\n @unfix_issue = BaseIssue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @unfix_issue }\n end\n end",
"title": ""
},
{
"docid": "ba51e916b6875359562c2587adf9303f",
"score": "0.6746215",
"text": "def show\n repo = Repo.find_by_owner_name_and_name(params[:owner], params[:repo])\n\n @issue = Issue.find_by_repo_id_and_git_number(repo.id, params[:git_number])\n\n if !@issue\n flash[:error] = \"There is no issue number #{params[:git_number]} for #{params[:owner]}/#{params[:repo]}\"\n redirect_to :action => \"index\"\n else\n @difficulty = @issue.retrieve_difficulty(current_user) if current_user\n \n if current_user\n RefreshIssuesWorker.perform_async(@issue.id, current_user.token)\n end\n \n # if @issue.updated?(@issue.repo.octokit_id, @issue.git_number, octokit_client.client)\n # RefreshIssuesWorker.perform_async(@issue.id, current_user.token)\n # flash[:notice] = \"Updating issue from Github, please refresh\"\n # end \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issue }\n end\n end\n end",
"title": ""
},
{
"docid": "73f7783e27f9b14a04fa830c45b2bfbe",
"score": "0.6740782",
"text": "def get_repo_issues\n res = get \"/repos/#{load_current_repo}/issues\"\n if res.is_a?(Array)\n res.map do |issue|\n { 'name' => issue['title'], 'url' => issue['html_url'] }\n end\n else\n []\n end\n end",
"title": ""
},
{
"docid": "de4fe7afe8b16df4abc97ffa2411fcfa",
"score": "0.6737026",
"text": "def issue(project_id, issue_id)\n api Constant.url_for('ISSUE', project_id, issue_id)\n end",
"title": ""
},
{
"docid": "ed3bd71d90b2337956778494946af220",
"score": "0.67354333",
"text": "def show\n @issue = Issue.where(\"published = ? AND id = ?\", true, params[:id])\n \n respond_to do |format|\n format.json { render json: @issue }\n end\n end",
"title": ""
},
{
"docid": "88160719d8c1f3620b4131c9ffa6af9a",
"score": "0.6734495",
"text": "def get_issues\n \n offset = 0\n issues = []\n begin\n json = RestClient.get(REDMINE_URL+\"/issues\", {:params => {:format => :json, :status_id => '*', :limit => 100, :offset => offset}})\n result = JSON.parse(json)\n issues << [*result[\"issues\"]]\n offset = offset + result['limit']\n print '.'\n end while offset < result['total_count']\n puts\n\n puts \"Retreived redmine issue index.\"\n issues.flatten!\n\n #puts \"Getting comments\"\n #issues.map! do |issue|\n # get_comments(issue)\n #end\n #puts \"Retreived comments.\"\n\n self.redmine_issues = issues.reverse!\n end",
"title": ""
},
{
"docid": "fb1f117cf6e388c0f30b5138cb5dad70",
"score": "0.673021",
"text": "def find_issues\n @issues = Issue.find_all_by_id(params[:id] || params[:ids])\n raise ActiveRecord::RecordNotFound if @issues.empty?\n raise Unauthorized unless @issues.all?(&:visible?)\n @projects = @issues.collect(&:project).compact.uniq\n @project = @projects.first if @projects.size == 1\n rescue ActiveRecord::RecordNotFound\n render_404\n end",
"title": ""
},
{
"docid": "7991ae2190479bd8c6c6977d6c84b4a0",
"score": "0.6713901",
"text": "def show\n search = Search.find(params[:id])\n @issues = getGitIssues(search.keyword, search.language, search.order)\n puts @issues\n end",
"title": ""
},
{
"docid": "abc94551313cae64e06cc88b27bc5799",
"score": "0.6697993",
"text": "def issue(github_url)\n parsed = Github::UrlParser.new(github_url)\n endpoint = \"/repos/#{parsed.owner}/#{parsed.repo}/issues/#{parsed.number}\"\n url = \"#{BASE_URI}#{endpoint}\"\n response = HTTParty.get url, options\n\n handle! response\n end",
"title": ""
},
{
"docid": "6900c3ced23fffc8477bb939310dda12",
"score": "0.66937155",
"text": "def github_issue\n @github_issue ||= begin\n path = \"/repos/#{@owner}/#{@repository}/issues/#{@number}\"\n options = {}\n\n if defined?(@updated_at)\n options[:headers] = {\n \"If-Modified-Since\" => @updated_at.httpdate\n }\n end\n\n github_client.send(:request, :get, path, nil, options)\n end\n end",
"title": ""
},
{
"docid": "9543cb605e51cd6b847debae0678ecf5",
"score": "0.66931736",
"text": "def get_issues\n repos_meta = HTTParty.get(@GITHUB_API_BASE_URL + \"?access_token=#{@access_token}\", headers: {\n \"User-Agent\" => @user_agent\n })\n\n if repos_meta.is_a?(Hash) && repos_meta['message'] === 'Not Found'\n issues = nil\n else\n issues = repos_meta['open_issues_count']\n end\n\n issues\n end",
"title": ""
},
{
"docid": "f7579f6feeedd512fe5d6fc7ddfbf60e",
"score": "0.66920483",
"text": "def index\n @github_issues = GithubIssue.all\n end",
"title": ""
},
{
"docid": "e55b6226dd81ee6c465140d84f10bd78",
"score": "0.6676767",
"text": "def org_issues(org, options={})\n get \"/orgs/#{org}/issues\", :params => options\n end",
"title": ""
},
{
"docid": "1321775d5b54e8de43654b15e59ab753",
"score": "0.66757536",
"text": "def issue(issue_id)\r\n url + 'issues/' + issue_id.to_s\r\n end",
"title": ""
},
{
"docid": "57c4cd53257f6db071bd1953d4008340",
"score": "0.6670096",
"text": "def issue(key)\n if key.nil? || key.to_s.strip.empty?\n raise ArgumentError.new(\"Issue key is required\")\n end\n json = self.get \"issue/#{key}\"\n if json and (json.empty? or json['errorMessages'])\n raise IssueNotFound.new(\"Issue '#{key}' not found in Jira\")\n else\n return Issue.new(self, json)\n end\n end",
"title": ""
},
{
"docid": "cf5235f733212a2ac8a9872c2ce25bfd",
"score": "0.6663115",
"text": "def issue(issue_id)\n url + 'issues/' + issue_id.to_s\n end",
"title": ""
},
{
"docid": "257533b7c29d8e8b87110fa0e7c8b44e",
"score": "0.6648506",
"text": "def getissues(offset)\n\tcontentURI = URI(MyConfig::Tracker + \"&offset=#{offset}&limit=100&nometa=1\")\n\t# puts offset\n\treq = Net::HTTP::Get.new(contentURI.path + '?' + contentURI.query)\n\treq.add_field 'X-Redmine-API-Key', MyConfig::Apikey\n\thttps = Net::HTTP.new(contentURI.host, contentURI.port)\n\thttps.use_ssl = true\n\n\tresp = https.start { |cx| cx.request(req) }\n\tsystems = JSON.parse(resp.body)\nend",
"title": ""
},
{
"docid": "38dc14ad8e146ab2cf67398b8d6b3195",
"score": "0.66483104",
"text": "def issues\n @issues ||= Octokit.\n org_issues('everydayhero', filter: 'all', direction: 'asc').\n sort_by { |issue| issue.created_at }.\n select { |issue| issue.pull_request.rels[:html] }\n end",
"title": ""
},
{
"docid": "be073941b13ea81ef9addc25be1802ef",
"score": "0.66329235",
"text": "def index\n @issues = @repository.issues.order('created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @issues }\n end\n end",
"title": ""
},
{
"docid": "f7c38f2c476517f24798ba3ffe708ca1",
"score": "0.66269916",
"text": "def index\n i = params[:issue_id]\n @issue = Issue.choose_issue(i)\n @submissions = Submission.where(\"issue_id = ?\", @issue)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @submissions }\n end\n end",
"title": ""
},
{
"docid": "a8c424c65e33bcd947eff4015abd44b0",
"score": "0.6612263",
"text": "def issues_in_project project_id\n api Constant.url_for('ISSUES_IN_PROJECT', project_id)\n end",
"title": ""
},
{
"docid": "6f556bd26013437da4ed1170fec80f17",
"score": "0.6612017",
"text": "def index \n @issues = Issue.all\n @closed_issues = Issue.closed\n @fellow_student_issues = Issue.fellow_student\n @instructor_normal_issues = Issue.instructor_normal\n @instructor_urgent_issues = Issue.instructor_urgent\n @assigned_issues = Issue.assigned\n @assignable_issues = Issue.assignable\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @issues }\n format.js {}\n end\n end",
"title": ""
},
{
"docid": "2708f7341556549eafefb5a7e55fa659",
"score": "0.65974605",
"text": "def show\n session[:current_issue] = @issue\n @pages = @issue.pages.order(:id, 'desc')\n @pages = @issue.pages\n respond_to do |format|\n format.html\n format.json { render @issue }\n end\n end",
"title": ""
},
{
"docid": "57522ab78b98bbaf2cd0e03f94edd08f",
"score": "0.6584035",
"text": "def new\n # @issue = Issue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end",
"title": ""
},
{
"docid": "106acee100aa68d8b8f1a997335e8365",
"score": "0.6583379",
"text": "def uri\n \"https://github.com/#{username}/#{project}/issues#issue/#{number}\"\n end",
"title": ""
},
{
"docid": "bbc25e98420b730e7b63bf66f1d0d522",
"score": "0.6575301",
"text": "def index\n @issues = Issue.all.order(sort_column + ' ' + sort_direction)\n @issues = @issues.where(kind: params[:kind]) if params[:kind]\n @issues = @issues.where(priority: params[:priority]) if params[:priority]\n @issues = @issues.where(status: params[:status]) if params[:status]\n\n if params.has_key?(:responsible)\n if User.exists?(nickname: params[:responsible])\n @issues = @issues.where(assignee_id: User\n .find_by(nickname: params[:responsible]).id)\n else\n @issues = []\n end\n end\n\n if params[:watching]\n @user = User.find_by(nickname: params[:watching])\n @issues = @issues.to_a\n if @user.nil?\n @issues.clear\n else\n @issues = @issues.select {|i| i.watchers.exists?(@user.id)}\n end\n end\n\n respond_to do |format|\n format.html\n format.json {render json: @issues, status: :ok, each_serializer: IndexIssueSerializer}\n end\n end",
"title": ""
},
{
"docid": "b97b59f888040fba7b7214a0bb5cd91c",
"score": "0.6575036",
"text": "def index\n @issue = Issue.find(params[:issue_id])\n @articles = @issue.articles\n end",
"title": ""
},
{
"docid": "af56e53d9176e313d41fc8cbb3779065",
"score": "0.6569606",
"text": "def new\n @issue = Issue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end",
"title": ""
},
{
"docid": "af56e53d9176e313d41fc8cbb3779065",
"score": "0.6569606",
"text": "def new\n @issue = Issue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end",
"title": ""
},
{
"docid": "af56e53d9176e313d41fc8cbb3779065",
"score": "0.6569606",
"text": "def new\n @issue = Issue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end",
"title": ""
},
{
"docid": "af56e53d9176e313d41fc8cbb3779065",
"score": "0.6569606",
"text": "def new\n @issue = Issue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end",
"title": ""
},
{
"docid": "af56e53d9176e313d41fc8cbb3779065",
"score": "0.6569606",
"text": "def new\n @issue = Issue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end",
"title": ""
},
{
"docid": "0cf7341e26f5bb115d8f13d605ee0b1e",
"score": "0.65666497",
"text": "def index\n @issues = @repository.issues.order('created_at DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @issues }\n end\n end",
"title": ""
},
{
"docid": "4d505d149f5ef8d5669a7774c6157470",
"score": "0.6565319",
"text": "def show\n\t\t@issue = Issue.find_by_id(params[:id]) or not_found\n\t\t@user = User.find_by_id(@issue.user_id) or not_found\n\t\t@issue_trackers = @issue.issue_trackers.order(:created_at)\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\tend\n\tend",
"title": ""
},
{
"docid": "4e2a37020044c14b0de629234b5388ca",
"score": "0.65524006",
"text": "def new\r\n @issue = Issue.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @issue }\r\n end\r\n end",
"title": ""
},
{
"docid": "ae11273a74d426059bf92fc069eb629c",
"score": "0.65520006",
"text": "def list(options=nil, params={})\n Rails.logger.info \">> Gihub Issues API\"\n\n path =\n if options && options[:user] && options[:repo]\n Rails.logger.info \">> list Issues: #{options[:user]} #{options[:repo]}\"\n \"/repos/#{options[:user]}/#{options[:repo]}/issues\"\n else\n Rails.logger.info \">> user Issues\"\n '/issues'\n end\n\n Rails.logger.info \">> Gihub Issues API: path: #{path}\"\n @connection.get(path, params).map do |issue_data|\n GitHubApi::Issue.new(self, issue_data)\n end\n end",
"title": ""
},
{
"docid": "9cda28acee3534c0b032a6393ac3676f",
"score": "0.6538197",
"text": "def getorgissues\n self.class.get(\"/orgs/TIY-ATL-ROR-2015-Sep/issues\", headers: @headers, \n query: { state: \"all\" })\n end",
"title": ""
},
{
"docid": "e8f3c756964752b3010333cdcbf474a2",
"score": "0.6536543",
"text": "def index\n respond_to do |format|\n @issues = Issue.all\n \n if params.has_key?(:assignee)\n if User.exists?(id: params[:assignee])\n @issues = @issues.where(assignee_id: params[:assignee])\n else\n format.json {render json: {\"error\":\"User with id=\"+params[:assignee]+\" does not exist\"}, status: :unprocessable_entity}\n end\n end\n \n if params.has_key?(:type)\n @issues = @issues.where(Type: params[:type])\n end\n \n if params.has_key?(:priority)\n @issues = @issues.where(Priority: params[:priority])\n end\n \n if params.has_key?(:status)\n if params[:status] == \"New&Open\"\n @issues = @issues.where(Status: [\"Open\",\"New\"])\n else\n @issues = @issues.where(Status: params[:status])\n end\n end\n \n if params.has_key?(:watcher)\n if User.exists?(id: params[:watcher])\n @issues = Issue.joins(:watchers).where(watchers:{user_id: params[:watcher]})\n else\n format.json {render json: {\"error\":\"User with id=\"+params[:watcher]+\" does not exist\"}, status: :unprocessable_entity}\n end\n end\n\n format.html\n format.json {render json: @issues, status: :ok, each_serializer: IssueIndexSerializer}\n end\n end",
"title": ""
},
{
"docid": "34151795f55bad49a01975219fa71992",
"score": "0.6515161",
"text": "def new\n @issue = Issue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end",
"title": ""
},
{
"docid": "5c6f57cce550256922b7048cb654fa83",
"score": "0.65104735",
"text": "def list_issues(repository, options={})\n get(\"/repos/#{Repository.new(repository)}/issues\", options, 3)\n end",
"title": ""
},
{
"docid": "4acfd3d294b2784cd41af1ab9e2cf7f3",
"score": "0.64779156",
"text": "def show\n @issue = Issue.find(params[:id])\n @user_login_name = @issue.user.identities.first.login_name if @issue.gist_id\n @response = @issue.responses.build\n\n respond_to do |format|\n format.html { render :layout => 'response'}\n format.json { render json: @issue }\n end\n end",
"title": ""
},
{
"docid": "986a9a685ecfd485dccf6170accc31e4",
"score": "0.6477211",
"text": "def get_recently_viewed_issues(params = {})\n get('users/myself/recentlyViewedIssues', params)\n end",
"title": ""
}
] |
7dde2dd1014c015164748bdd7ff26985
|
This method will parse some SSMS stuff, such as GO
|
[
{
"docid": "82f0e8f1a18542f6d8d0716c5a212e94",
"score": "0.55299604",
"text": "def parse_sql(sql)\n sql.split(/go\\n/i)\n end",
"title": ""
}
] |
[
{
"docid": "f3b453ea58f595f07701e41aeec2d8d2",
"score": "0.5412424",
"text": "def parse(statement)\n # (1) split into nuggets -> something.something.something\n nugz = statement.split(\".\")\n\n # (2) grok each nugget into buds -> anything(?anything)[?anything]\n budz = nugz.map{ |nugget| /(\\w+)(?:\\(([^\\)]*)\\))?(?:\\[([^\\]]*)\\])?/.match(nugget).captures }\n pp(budz)\n print(\"\\n\")\n\n # (3) scan each bud for whether it's an Entity or Directive, and refine the AST\n ast = budz.map do |bud|\n case bud.first\n when /(order|limit|offset)/ then\n Hash[ [:directive, :params].zip(bud) ]\n when /^[A-Z]/ then\n Hash[ [:entity, :conditions, :fields].zip(bud) ]\n else puts \"whoa duuuude: #{bud.inspect}\"\n end\n end\n\n # (4) explode conditions, captures, params chunks\n ast.each do |chunk|\n chunk[:conditions] &&= chunk[:conditions].split(',').map(&:strip).map { |cond| cond.split(/\\s+/) }\n chunk[:params] &&= chunk[:params].split(',').map(&:strip)\n chunk[:fields] &&= chunk[:fields].split(',').map(&:strip)\n end\n\n return ast\nend",
"title": ""
},
{
"docid": "e28df82633748a01bcc5bcc3349eecc5",
"score": "0.5336016",
"text": "def syntax_analisys argv\n # ルート namespace (region) を生成\n @root_namespace = Region.new(\"::\")\n\n #### 構文解析 (post コードを除く) ####\n # すべての cdl を import する\n argv.each{ |f|\n dbgPrint( \"## Import: #{f}\\n\")\n Import.new( f, false, false )\n }\n\n # すべての構文解釈が完了したことの報告\n # 実際には、後からプラグインの生成する CDL のパースが行われる\n # エラー行数の決定方法の変更のために行う\n Generator.end_all_parse\n dbgPrint( \"## End all parse (except Post Code)\\n\")\n end",
"title": ""
},
{
"docid": "ae88178924d170be0c6968eb04917665",
"score": "0.51538414",
"text": "def parse\r\n commands\r\n end",
"title": ""
},
{
"docid": "04fcfb05a1f282d3dcef0bd779ee3e29",
"score": "0.5103882",
"text": "def test_12\n stmts = @sql.parse(' \\d foo ; select \\'foo\\'; ')\n assert_equal(2, stmts.size)\n\n stmt1 = stmts[0]\n assert(!stmt1.open?)\n assert_equal(:meta_command, stmt1.keyword)\n assert_equal(' \\d foo ;', stmt1.raw)\n\n stmt2 = stmts[1]\n assert(!stmt2.open?)\n assert_equal(:select, stmt2.keyword)\n assert_equal(\" select 'foo';\", stmt2.raw)\n end",
"title": ""
},
{
"docid": "7689cef26aaf880ef1272f2dbea0f3d8",
"score": "0.50904197",
"text": "def mssql_parse_done(data, info)\n status,cmd,rows = data.slice!(0,8).unpack('vvV')\n info[:done] = { :status => status, :cmd => cmd, :rows => rows }\n info\n end",
"title": ""
},
{
"docid": "6a87bf91db40e34ef4ff0abe857438e2",
"score": "0.5088488",
"text": "def mssql_parse_env(data, info)\n len = data.slice!(0,2).unpack('v')[0]\n buff = data.slice!(0,len)\n type = buff.slice!(0,1).unpack('C')[0]\n\n nval = ''\n nlen = buff.slice!(0,1).unpack('C')[0] || 0\n nval = buff.slice!(0,nlen*2).gsub(\"\\x00\", '') if nlen > 0\n\n oval = ''\n olen = buff.slice!(0,1).unpack('C')[0] || 0\n oval = buff.slice!(0,olen*2).gsub(\"\\x00\", '') if olen > 0\n\n info[:envs] ||= []\n info[:envs] << { :type => type, :old => oval, :new => nval }\n info\n end",
"title": ""
},
{
"docid": "0d9d499cb66f167e00c92aeabb95b118",
"score": "0.50738883",
"text": "def mssql_parse_info(data, info)\n len = data.slice!(0,2).unpack('v')[0]\n buff = data.slice!(0,len)\n\n errno,state,sev,elen = buff.slice!(0,8).unpack('VCCv')\n emsg = buff.slice!(0,elen * 2)\n emsg.gsub!(\"\\x00\", '')\n\n info[:infos]||= []\n info[:infos] << \"SQL Server Info ##{errno} (State:#{state} Severity:#{sev}): #{emsg}\"\n info\n end",
"title": ""
},
{
"docid": "51651c1f2b3b080d4c44bd52afed7571",
"score": "0.50613534",
"text": "def parse(source); end",
"title": ""
},
{
"docid": "51651c1f2b3b080d4c44bd52afed7571",
"score": "0.50613534",
"text": "def parse(source); end",
"title": ""
},
{
"docid": "51651c1f2b3b080d4c44bd52afed7571",
"score": "0.50613534",
"text": "def parse(source); end",
"title": ""
},
{
"docid": "51651c1f2b3b080d4c44bd52afed7571",
"score": "0.50613534",
"text": "def parse(source); end",
"title": ""
},
{
"docid": "51651c1f2b3b080d4c44bd52afed7571",
"score": "0.50613534",
"text": "def parse(source); end",
"title": ""
},
{
"docid": "51651c1f2b3b080d4c44bd52afed7571",
"score": "0.50613534",
"text": "def parse(source); end",
"title": ""
},
{
"docid": "8c0171fba928e0e0224fe8eeffcb37a3",
"score": "0.5022203",
"text": "def mssql_parse_env(data, info)\n len = data.slice!(0, 2).unpack('v')[0]\n buff = data.slice!(0, len)\n type = buff.slice!(0, 1).unpack('C')[0]\n\n nval = ''\n nlen = buff.slice!(0, 1).unpack('C')[0] || 0\n nval = buff.slice!(0, nlen * 2).gsub(\"\\x00\", '') if nlen > 0\n\n oval = ''\n olen = buff.slice!(0, 1).unpack('C')[0] || 0\n oval = buff.slice!(0, olen * 2).gsub(\"\\x00\", '') if olen > 0\n\n info[:envs] ||= []\n info[:envs] << { :type => type, :old => oval, :new => nval }\n info\n end",
"title": ""
},
{
"docid": "dec72a659e1063dd37255cdeddd05177",
"score": "0.50199604",
"text": "def mssql_parse_done(data, info)\n status, cmd, rows = data.slice!(0, 8).unpack('vvV')\n info[:done] = { :status => status, :cmd => cmd, :rows => rows }\n info\n end",
"title": ""
},
{
"docid": "b509c438f6017ad87077a910e0f1ca60",
"score": "0.50024855",
"text": "def mssql_parse_info(data, info)\n len = data.slice!(0, 2).unpack('v')[0]\n buff = data.slice!(0, len)\n\n errno, state, sev, elen = buff.slice!(0, 8).unpack('VCCv')\n emsg = buff.slice!(0, elen * 2)\n emsg.gsub!(\"\\x00\", '')\n\n info[:infos] ||= []\n info[:infos] << \"SQL Server Info ##{errno} (State:#{state} Severity:#{sev}): #{emsg}\"\n info\n end",
"title": ""
},
{
"docid": "ac35d0a72e2e6fe32327fa17fd28e15f",
"score": "0.49863812",
"text": "def parse\n tokens = source.split(/([{} ])/)\n\n parse_procedure(tokens)\n end",
"title": ""
},
{
"docid": "b394694237415625d325389e77818258",
"score": "0.4983224",
"text": "def parse_specific\n\n end",
"title": ""
},
{
"docid": "b394694237415625d325389e77818258",
"score": "0.4983224",
"text": "def parse_specific\n\n end",
"title": ""
},
{
"docid": "0a5424c1f7e4e8d33515ff99977aafbf",
"score": "0.49712864",
"text": "def translate(assem)\n parsingObject = Parser.new(assem)\n codeObject = Code.new\n loc = 0\n\n while (parsingObject.hasMoreCommands)\n if (parsingObject.commandType == 'A_COMMAND')\n $machineCode[loc] = codeObject.toBinary(parsingObject.symbol.to_i)\n elsif (parsingObject.commandType == 'C_COMMAND')\n $machineCode[loc] = \"111\" + codeObject.comp(parsingObject.comp) + codeObject.dest(parsingObject.dest) + \n codeObject.jump(parsingObject.jump)\n end\n parsingObject.advance\n loc += 1\n end\nend",
"title": ""
},
{
"docid": "9a5fc1908fa9bf6c8db1865c0512b282",
"score": "0.49395555",
"text": "def divide_lexemes_into_statements(lexemes)\n statement = []\n \n lexemes.each do |lexeme|\n if ['@', 'BeginSym', 'EndSym', 'EofSym'].member?(lexeme)\n if !statement.empty?\n @lexemes.push(statement)\n statement = []\n end\n else\n statement.push(lexeme)\n end\n end\n end",
"title": ""
},
{
"docid": "8d001537fb9c2d0168c2586de70f6620",
"score": "0.4930257",
"text": "def handle_sy_sm\n handle_sy\n next_tag\n handle_sm\n end",
"title": ""
},
{
"docid": "cfc64655d8a635c2b0e52549825348ed",
"score": "0.4881786",
"text": "def parse; end",
"title": ""
},
{
"docid": "cfc64655d8a635c2b0e52549825348ed",
"score": "0.4881786",
"text": "def parse; end",
"title": ""
},
{
"docid": "70b8bea01c57b10ad4a27147e87db2ab",
"score": "0.48674032",
"text": "def parsed_statement\n @parsed_statement ||= statement\n .gsub(ALTER_TABLE_REGEX, '')\n .gsub('`', '\\\\\\`')\n .gsub(/\\\\n/, '')\n .gsub('\"', '\\\\\\\"')\n end",
"title": ""
},
{
"docid": "f8e1d9f7e6c24d7265a40d8949bc0f58",
"score": "0.48643395",
"text": "def parse(script)\n blocks = script.split(\"\\n\\n\")\n stack_keywords = [\"def\", \"if\", \"case\", \"class\",\"loop\", \"while\", \"for\", \"begin\",\"{\"]\n stack_open = [0, 0, 0, 0, 0, 0, 0,0]\n last_opened = []\n stack_trace = [] ## keeps track of keywords opened and the ends after them\n line_no = 0\n defined_classes = []\n defined_methods = []\n global_vars = []\n instance_vars = []\n local_vars = []\n statements = [] ## contains an array for each keyword block containing any statements from the block\n unexpected_end = []\n script_ok = true\n\n blocks.each do |block|\n if block.to_s.downcase[0..5] == \"jumpto\"\n # Handle jump statements\n elsif block.to_s == \"exit\"\n # Handle exit statement\n\t break # done parsing after exit\n else\n lines = block.split(\";\").join(\"\\n\").split(\"\\n\")\n lines.each do |line| ; line_no += 1\n\t \t line = line.gsub(/\\s+/, \" \")\n if line[0] == \" \"; line = line[1..-1]; end\n\t\t\n if line[0] == \"#\"\n\t\t ##comment line\n elsif line[0..3] == \"def \"\n\t\t\n stack_open[0] += 1\n last_opened << \"def\"; stack_trace << \"def \"+line.split(\" \")[1..-1].join(\" \")\n defined_methods << line.split(\" \")[1]\n elsif line[0..2] == \"if \"\n stack_open[1] += 1\n last_opened << \"if\"; stack_trace << \"if \"+line.split(\" \")[1..-1].join(\" \")\n elsif line[0..4] == \"case \"\n stack_open[2] += 1\n last_opened << \"case\"; stack_trace << \"case \"+line.split(\" \")[1..-1].join(\" \")\n elsif line[0..5] == \"class \"\n stack_open[3] += 1\n last_opened << \"class\"; stack_trace << \"class \"+line.split(\" \")[1..-1].join(\" \")\n defined_classes << line.split(\" \")[1]\t \n \n\t\t elsif line[0..4] == \"loop\"\n stack_open[4] += 1\n last_opened << \"loop\"; stack_trace << \"loop \"+line.split(\" \")[1..-1].join(\" \")\n last_opened << \"{\"; stack_trace << \"loop \"+line.split(\" \")[1..-1].join(\" \")\n \n\t\t elsif line =~ /^loop.*\\{.*\\}\\s*$/\n stack_open[4] += 1\n last_opened << \"loop\"\n stack_trace << \"loop \"+line.split(\" \")[1..-1].join(\" \")\n\n\t\t elsif line[0..4] == \"while\"\n stack_open[5] += 1\n last_opened << \"while\"; stack_trace << \"while \"+line.split(\" \")[1..-1].join(\" \")\n \n\t\t elsif line[0..2] == \"for\"\n stack_open[6] += 1\n last_opened << \"for\"; stack_trace << \"for \"+line.split(\" \")[1..-1].join(\" \")\n\t\t\t\n \t\t elsif line[0..4] == \"begin\"\n\t\t stack_open[7] += 1\n\t\t last_opened << \"begin\"; stack_trace << \"begin\"\n elsif line[0..5] == \"rescue\"\n\t\t \n elsif line[0..5] == \"else\"\n \n\t\t elsif line[0..5] == \"next\"\n \n\t\t elsif line[0..5] == \"break\"\n\n elsif line =~ /^@\\w+\\b\\s*==/\n # instance variable with == operator\n elsif line =~ /^@\\w+\\b\\s*\\./\n # instance variable with dot operator\n elsif line =~ /^@\\w+\\b\\s*>=/\n # instance variable with >= operator\n elsif line =~ /^@\\w+\\b\\s*<=/\n # instance variable with <= operator\n elsif line =~ /^@\\w+\\b\\s*\\+=/\n # instance variable with += operator\n elsif line =~ /^@\\w+\\b\\s*\\-=/ \n # instance variable with -= operator\n elsif line =~ /^@\\w+\\b\\s*=/ # instance variable declaration\n var_name = line.split(\"=\")[0][1..-1] # remove the @ from the var name\n instance_vars << \"@\"+var_name unless instance_vars.include?(\"@\"+var_name)\n\t\t\t\n elsif line =~ /^\\$\\w+\\b\\s*==/\n # global variable with == operator\n elsif line =~ /^\\$\\w+\\b\\s*\\./\n # global variable with dot operator\n elsif line =~ /^\\$\\w+\\b\\s*>=/\n # global variable with >= operator\n elsif line =~ /^\\$\\w+\\b\\s*<=/\n # global variable with <= operator\n elsif line =~ /^\\$\\w+\\b\\s*\\+=/\n # global variable with += operator\n elsif line =~ /^\\$\\w+\\b\\s*\\-=/ \n # global variable with -= operator\t\t\t\n elsif line =~ /^\\$\\w+\\b\\s*=/ # global variable declaration\n var_name = line.split(\"=\")[0][1..-1] # remove the $ from the var name\n global_vars << \"$\"+var_name unless global_vars.include?(\"$\"+var_name)\n\t\t\t\n\t\t\t\n\t\t elsif line =~ /^\\w+\\b\\s*==/\n # instance variable with == operator\n elsif line =~ /^\\w+\\b\\s*\\./\n # instance variable with dot operator\n elsif line =~ /^\\w+\\b\\s*>=/\n # instance variable with >= operator\n elsif line =~ /^\\w+\\b\\s*<=/\n # instance variable with <= operator\n elsif line =~ /^\\w+\\b\\s*\\+=/\n # instance variable with += operator\n elsif line =~ /^\\w+\\b\\s*\\-=/ \n # instance variable with -= operator\n elsif line =~ /^\\w+\\b\\s*=/ # local variable declaration\n var_name = line.split(\"=\")[0].strip \n\t\t local_vars << var_name unless local_vars.include?(var_name)\n\n\n\n\n elsif line.downcase.strip == \"end\"\n # Close the most recent open block\n stack_trace << \"end\"\n\t\t if last_opened.any?\n stack_open[stack_keywords.index(last_opened.last)] -= 1\n last_opened.pop\n else; unexpected_end << last_opened[-1].to_s+\" @ line \"+line_no.to_s\n\t\t end\n\t\t \n else\n # Handle other statements \n\t\t \n end\n end\n\t \n # Add a separator to the local variables array between blocks\n local_vars << \"\" unless local_vars.empty?\n instance_vars << \"\" unless instance_vars.empty?\n global_vars << \"\" unless global_vars.empty?\n defined_classes << \"\" unless defined_classes.empty?\n defined_methods << \"\" unless defined_methods.empty?\n\t \n end\n end\n\n puts \"#####################################################################\"\n puts script.to_s\n puts \"#####################################################################\"\n\n # Check for stack errors\n s=stack_open; s.delete(0)\n if s.include?(1)\n\t stack_keywords.each do |k|\n\t if stack_open[stack_keywords.index(k)] == 1\n\t\t puts \"ERROR: Stack left open for keyword: \"+k.to_s\n\t\t script_ok = false\n\t end\n\t end\n end \n if unexpected_end != []\n puts \"ERROR: Unexpected 'end' in stack keywords: \"+unexpected_end.to_s\n\t script_ok = false\n end\n defined_classesl = defined_classes; defined_classesl.delete(\"\"); defined_classesl = defined_classesl.length\n defined_methodsl = defined_methods; defined_methodsl.delete(\"\"); defined_methodsl = defined_methodsl.length\n global_varsl = global_vars; global_varsl.delete(\"\"); global_varsl = global_varsl.length \n instance_varsl = instance_vars; instance_varsl.delete(\"\"); instance_varsl = instance_varsl.length\n local_varsl = local_vars; local_varsl.delete(\"\"); local_varsl = local_varsl.length\n puts \"\\nParse Results for file: \"\n puts \"Blocks: \"+blocks.length.to_s + \" Logical Lines: \"+line_no.to_s+\"\\n\"\n puts \"Size: \"+script.to_s.length.to_s+\" bytes\\n\"\n puts \"\"\n if defined_classesl > 0\n puts \"Defined classes: \"+defined_classesl.to_s+\": \"+defined_classes.join(\", \")+\"\\n\"\n puts \"\"\n end\n if global_varsl > 0\n puts \"Global variables: \"+global_varsl.to_s+\": \"+global_vars.join(\", \")+\"\\n\"\n puts \"\"\n end\n puts \"Defined methods: \"+defined_methodsl.to_s+\": \"+defined_methods.join(\", \")+\"\\n\"\n puts \"\"\n puts \"Instance variables: \"+instance_varsl.to_s+\": \"+instance_vars.join(\", \")+\"\\n\"\n puts \"\"\n puts \"Local variables: \"+local_varsl.to_s+\": \"+local_vars.join(\", \")+\"\\n\"\n puts \"\"\n puts \"Stack trace: \"+stack_trace.length.to_s+\" :\"+stack_trace.to_s+\"\\n\"\n puts \"\"\n puts \"Script pass: \"+script_ok.to_s\n end",
"title": ""
},
{
"docid": "ccf0a0a0208893bdec1c9f5715928962",
"score": "0.48594034",
"text": "def statement\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 2 )\n\n\n return_value = StatementReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n root_0 = nil\n\n __SEMI3__ = nil\n __SEMI5__ = nil\n __SEMI7__ = nil\n __SEMI9__ = nil\n __SEMI11__ = nil\n __SEMI13__ = nil\n __SEMI15__ = nil\n __SEMI17__ = nil\n __SEMI19__ = nil\n string_literal20 = nil\n __SEMI21__ = nil\n __SEMI23__ = nil\n __SEMI24__ = nil\n subsystem2 = nil\n user_type_limit4 = nil\n on_stack_limit6 = nil\n error8 = nil\n server_prefix10 = nil\n user_prefix12 = nil\n server_demux14 = nil\n type_decl16 = nil\n routine_decl18 = nil\n import_decl22 = nil\n\n\n tree_for_SEMI3 = nil\n tree_for_SEMI5 = nil\n tree_for_SEMI7 = nil\n tree_for_SEMI9 = nil\n tree_for_SEMI11 = nil\n tree_for_SEMI13 = nil\n tree_for_SEMI15 = nil\n tree_for_SEMI17 = nil\n tree_for_SEMI19 = nil\n tree_for_string_literal20 = nil\n tree_for_SEMI21 = nil\n tree_for_SEMI23 = nil\n tree_for_SEMI24 = nil\n\n begin\n # at line 85:11: ( subsystem SEMI !| user_type_limit SEMI !| on_stack_limit SEMI !| error SEMI !| server_prefix SEMI !| user_prefix SEMI !| server_demux SEMI !| type_decl SEMI !| routine_decl SEMI !| 'skip' SEMI !| import_decl SEMI !| SEMI !)\n alt_2 = 12\n case look_2 = @input.peek( 1 )\n when T__125 then alt_2 = 1\n when T__79 then alt_2 = 2\n when T__69 then alt_2 = 3\n when T__92 then alt_2 = 4\n when T__76, T__118 then alt_2 = 5\n when T__78, T__131 then alt_2 = 6\n when T__116 then alt_2 = 7\n when T__126 then alt_2 = 8\n when T__73, T__77, T__111, T__120 then alt_2 = 9\n when T__122 then alt_2 = 10\n when T__91, T__93, T__94, T__121, T__127 then alt_2 = 11\n when SEMI then alt_2 = 12\n else\n raise NoViableAlternative( \"\", 2, 0 )\n\n end\n case alt_2\n when 1\n root_0 = @adaptor.create_flat_list\n\n\n # at line 85:13: subsystem SEMI !\n @state.following.push( TOKENS_FOLLOWING_subsystem_IN_statement_109 )\n subsystem2 = subsystem\n @state.following.pop\n @adaptor.add_child( root_0, subsystem2.tree )\n\n __SEMI3__ = match( SEMI, TOKENS_FOLLOWING_SEMI_IN_statement_111 )\n\n when 2\n root_0 = @adaptor.create_flat_list\n\n\n # at line 88:5: user_type_limit SEMI !\n @state.following.push( TOKENS_FOLLOWING_user_type_limit_IN_statement_120 )\n user_type_limit4 = user_type_limit\n @state.following.pop\n @adaptor.add_child( root_0, user_type_limit4.tree )\n\n __SEMI5__ = match( SEMI, TOKENS_FOLLOWING_SEMI_IN_statement_122 )\n\n when 3\n root_0 = @adaptor.create_flat_list\n\n\n # at line 89:5: on_stack_limit SEMI !\n @state.following.push( TOKENS_FOLLOWING_on_stack_limit_IN_statement_129 )\n on_stack_limit6 = on_stack_limit\n @state.following.pop\n @adaptor.add_child( root_0, on_stack_limit6.tree )\n\n __SEMI7__ = match( SEMI, TOKENS_FOLLOWING_SEMI_IN_statement_131 )\n\n when 4\n root_0 = @adaptor.create_flat_list\n\n\n # at line 90:5: error SEMI !\n @state.following.push( TOKENS_FOLLOWING_error_IN_statement_138 )\n error8 = error\n @state.following.pop\n @adaptor.add_child( root_0, error8.tree )\n\n __SEMI9__ = match( SEMI, TOKENS_FOLLOWING_SEMI_IN_statement_140 )\n\n when 5\n root_0 = @adaptor.create_flat_list\n\n\n # at line 91:5: server_prefix SEMI !\n @state.following.push( TOKENS_FOLLOWING_server_prefix_IN_statement_147 )\n server_prefix10 = server_prefix\n @state.following.pop\n @adaptor.add_child( root_0, server_prefix10.tree )\n\n __SEMI11__ = match( SEMI, TOKENS_FOLLOWING_SEMI_IN_statement_149 )\n\n when 6\n root_0 = @adaptor.create_flat_list\n\n\n # at line 92:5: user_prefix SEMI !\n @state.following.push( TOKENS_FOLLOWING_user_prefix_IN_statement_156 )\n user_prefix12 = user_prefix\n @state.following.pop\n @adaptor.add_child( root_0, user_prefix12.tree )\n\n __SEMI13__ = match( SEMI, TOKENS_FOLLOWING_SEMI_IN_statement_158 )\n\n when 7\n root_0 = @adaptor.create_flat_list\n\n\n # at line 93:5: server_demux SEMI !\n @state.following.push( TOKENS_FOLLOWING_server_demux_IN_statement_165 )\n server_demux14 = server_demux\n @state.following.pop\n @adaptor.add_child( root_0, server_demux14.tree )\n\n __SEMI15__ = match( SEMI, TOKENS_FOLLOWING_SEMI_IN_statement_167 )\n\n when 8\n root_0 = @adaptor.create_flat_list\n\n\n # at line 94:5: type_decl SEMI !\n @state.following.push( TOKENS_FOLLOWING_type_decl_IN_statement_174 )\n type_decl16 = type_decl\n @state.following.pop\n @adaptor.add_child( root_0, type_decl16.tree )\n\n __SEMI17__ = match( SEMI, TOKENS_FOLLOWING_SEMI_IN_statement_176 )\n\n when 9\n root_0 = @adaptor.create_flat_list\n\n\n # at line 95:5: routine_decl SEMI !\n @state.following.push( TOKENS_FOLLOWING_routine_decl_IN_statement_183 )\n routine_decl18 = routine_decl\n @state.following.pop\n @adaptor.add_child( root_0, routine_decl18.tree )\n\n __SEMI19__ = match( SEMI, TOKENS_FOLLOWING_SEMI_IN_statement_185 )\n\n when 10\n root_0 = @adaptor.create_flat_list\n\n\n # at line 96:5: 'skip' SEMI !\n string_literal20 = match( T__122, TOKENS_FOLLOWING_T__122_IN_statement_192 )\n tree_for_string_literal20 = @adaptor.create_with_payload( string_literal20 )\n @adaptor.add_child( root_0, tree_for_string_literal20 )\n\n\n __SEMI21__ = match( SEMI, TOKENS_FOLLOWING_SEMI_IN_statement_194 )\n\n when 11\n root_0 = @adaptor.create_flat_list\n\n\n # at line 97:5: import_decl SEMI !\n @state.following.push( TOKENS_FOLLOWING_import_decl_IN_statement_201 )\n import_decl22 = import_decl\n @state.following.pop\n @adaptor.add_child( root_0, import_decl22.tree )\n\n __SEMI23__ = match( SEMI, TOKENS_FOLLOWING_SEMI_IN_statement_203 )\n\n when 12\n root_0 = @adaptor.create_flat_list\n\n\n # at line 99:5: SEMI !\n __SEMI24__ = match( SEMI, TOKENS_FOLLOWING_SEMI_IN_statement_211 )\n\n end\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 2 )\n\n\n end\n\n return return_value\n end",
"title": ""
},
{
"docid": "2e078fd6a8e663b95efbb6dca66f53a1",
"score": "0.48540255",
"text": "def parse_lang_for_codeblock(source); end",
"title": ""
},
{
"docid": "da8d1b6f0d9a2760ec9ae52bc319db8d",
"score": "0.48517886",
"text": "def parse_operation; end",
"title": ""
},
{
"docid": "2c658d72167268f322a2cc0ba83cd003",
"score": "0.4851052",
"text": "def parse_special\n @@parse_special\n end",
"title": ""
},
{
"docid": "81f251aaa34440cb86fb09e5a3b1e776",
"score": "0.4846533",
"text": "def parseStatements(endToken = Token::T_EOF)\n parseStatement()\n check(Token::T_SEMICOLON, \"Statement should end with semi-colon\")\n\n #This will loop until we reach the end of the block\n if getTokenKind == endToken\n return\n end\n \n parseStatements(endToken)\nend",
"title": ""
},
{
"docid": "1ccdc5e7000f78b891e8ae4aab6de6fa",
"score": "0.4834672",
"text": "def exception_on_syntax_error; end",
"title": ""
},
{
"docid": "e991969c5c8fe487bb79b440d2fa5a51",
"score": "0.4802919",
"text": "def parseNext(script)\n puts script\n\n shl = \"opcode = SHL /\\\\ shl\"\n shr = \"opcode = SHR /\\\\ shr\"\n inv = \"opcode = NOT /\\\\ not\"\n nop = \"opcode = NOP /\\\\ nop\"\n expression = \"\\\\/ \" + shl + \" \\\\/ \" + shr + \" \\\\/ \" + inv + \" \\\\/ \" + nop\n\n tla = TLA.new\n\n tla.parse(shl)\n tla.parse(shr)\n tla.parse(inv)\n tla.parse(nop)\n tla.parse(expression)\n\n rescue Parslet::ParseFailed => failure\n puts failure.cause.ascii_tree\nend",
"title": ""
},
{
"docid": "c1dba675cb93ec5c593a3c9e04f0364b",
"score": "0.48028144",
"text": "def compile script\n compiled = []\n while script.count > 0\n line = script.shift.strip\n\n # Flow structures\n if line == \"IF\"\n n = 0\n index = 0\n else_index = 0\n depth = 0\n script.each do |v|\n v.strip!\n if v == \"THEN\" && depth == 0\n index = n\n break\n elsif v == \"ELSE\" && depth == 0\n else_index = n\n elsif v == \"THEN\" && depth > 0\n depth -= 1\n elsif v == \"IF\"\n depth += 1\n end\n n += 1\n end\n raise Exception.new(\"Syntax error\") unless index\n block = script.shift(index+1)\n # Get rid of the THEN\n block.pop\n if else_index > 0\n yes = block.shift(else_index)\n # Ignore the ELSE word\n no = block[1..-1]\n else\n yes = block\n no = nil\n end\n compiled << Ifelse.new(compile(yes), compile(no))\n\n elsif line == \"TIMES\"\n n = script.index { |v| v.strip == \"/TIMES\" }\n raise Exception.new(\"Syntax error\") unless n\n block = script.shift(n+1)\n # Get rid of the /TIMES\n block.pop\n compiled << Times.new(compile(block))\n\n elsif /PROCEDURE\\s+(?<name>[A-Za-z0-9_-]+)/ =~ line\n # Populate first so that the procedure can call itself\n @procedures[name] = Procedure.new\n n = script.index { |v| v.strip == \"/PROCEDURE\" }\n raise Exception.new(\"Syntax error\") unless n\n block = script.shift(n+1)\n # Get rid of the /PROCEDURE\n block.pop\n @procedures[name].block = compile(block)\n\n elsif @commands.has_key? line\n compiled << @commands[line]\n\n elsif @procedures.has_key? line\n compiled << @procedures[line]\n\n # Only need to account for integers\n elsif /^[0-9]+$/ =~ line\n compiled << line.to_i\n\n # Literal\n elsif !line.empty?\n compiled << line\n\n end\n end\n compiled\nend",
"title": ""
},
{
"docid": "3e6cb02185715fbf1ae75322d0ea4f5b",
"score": "0.48017502",
"text": "def mssql_parse_error(data, info)\n len = data.slice!(0,2).unpack('v')[0]\n buff = data.slice!(0,len)\n\n errno,state,sev,elen = buff.slice!(0,8).unpack('VCCv')\n emsg = buff.slice!(0,elen * 2)\n emsg.gsub!(\"\\x00\", '')\n\n info[:errors] << \"SQL Server Error ##{errno} (State:#{state} Severity:#{sev}): #{emsg}\"\n info\n end",
"title": ""
},
{
"docid": "2a6ad5b6bf8ccb92223ab68a7dceebe4",
"score": "0.47963572",
"text": "def parse\n pre_index = @scanner.token_index\n p_token,p_token_value = nil\n c_token,c_token_value = @scanner.get_token\n parenth = 0\n\n while (c_token != nil)\n @scanner.token_index += 1\n n_token, n_token_value = @scanner.get_token\n\n unless n_token == \" \"\n case c_token\n when \"bad_token\"\n @token_errors << c_token_value\n\n when \"and\"\n unless (n_token =~ /not|fstatement|statement|\\(/) || (scanner.token_index == scanner.arguments.size) && !(n_token == nil)\n @parse_errors << [pre_index, scanner.token_index]\n end\n\n if p_token == nil\n @parse_errors << [pre_index - c_token.size, scanner.token_index]\n elsif (p_token == \"and\" || p_token == \"or\")\n @parse_errors << [pre_index - 1 - p_token.size, pre_index - 1]\n end\n\n when \"or\"\n unless (n_token =~ /not|fstatement|statement|\\(/) || (scanner.token_index == scanner.arguments.size) && !(n_token == nil)\n @parse_errors << [pre_index, scanner.token_index]\n end\n\n if p_token == nil\n @parse_errors << [pre_index - c_token.size, scanner.token_index]\n elsif (p_token == \"and\" || p_token == \"or\")\n @parse_errors << [pre_index - 1 - p_token.size, pre_index - 1]\n end\n\n when \"not\"\n unless n_token =~ /fstatement|statement|\\(|not/ && !(n_token == nil)\n @parse_errors << [pre_index, scanner.token_index]\n end\n\n when \"statement\",\"fstatement\"\n unless n_token =~ /and|or|\\)/\n unless scanner.token_index == scanner.arguments.size\n @parse_errors << [pre_index, scanner.token_index]\n end\n end\n\n when \")\"\n unless (n_token =~ /|and|or|not|\\(/)\n unless(scanner.token_index == scanner.arguments.size)\n @parse_errors << [pre_index, scanner.token_index]\n end\n end\n unless @paren_errors.empty?\n @paren_errors.pop\n else\n @paren_errors.push((n_token.nil?) ? scanner.token_index - 1: scanner.token_index - n_token_value.size)\n end\n\n when \"(\"\n unless n_token =~ /fstatement|statement|not|\\(/\n @parse_errors << [pre_index, scanner.token_index]\n end\n @paren_errors.push((n_token.nil?) ? scanner.token_index - 1: scanner.token_index - n_token_value.size)\n\n else\n @parse_errors << [pre_index, scanner.token_index]\n end\n\n unless n_token == \" \" ||c_token == \"bad_token\"\n @execution_stack << {c_token => c_token_value}\n end\n\n p_token, p_token_value = c_token, c_token_value\n c_token, c_token_value = n_token, n_token_value\n end\n pre_index = @scanner.token_index\n end\n end",
"title": ""
},
{
"docid": "34646af19ea5e10505bd942e451d0a37",
"score": "0.4783339",
"text": "def parse_code\n already_documented = false \n @string_representation.each_line do |line|\n @entities.each do |entity_class|\n already_documented = already_documented || @comment_syntax.commentStart?(line)\n begin\n entity = Object.const_get(entity_class).new line, @comment_syntax\n if already_documented\n already_documented = false\n else\n generated_string << entity.comment_string + \"\\n\" \n end\n rescue\n end\n end\n generated_string << line\n end\n end",
"title": ""
},
{
"docid": "d72b6f108132c66f4a54a7c6f6e08c9c",
"score": "0.47797993",
"text": "def commands\n script.split(/\\r\\n|\\r|\\n/).reject(&:blank?).map do |line|\n line = line.gsub(/[[:space:]]+/, \" \").strip\n next if line.empty?\n\n case line\n when /\\A(?:create alias|alias) (\\S+) -> (\\S+)\\z/i\n [:create_alias, Tag.normalize_name($1), Tag.normalize_name($2)]\n when /\\A(?:create implication|imply) (\\S+) -> (\\S+)\\z/i\n [:create_implication, Tag.normalize_name($1), Tag.normalize_name($2)]\n when /\\A(?:remove alias|unalias) (\\S+) -> (\\S+)\\z/i\n [:remove_alias, Tag.normalize_name($1), Tag.normalize_name($2)]\n when /\\A(?:remove implication|unimply) (\\S+) -> (\\S+)\\z/i\n [:remove_implication, Tag.normalize_name($1), Tag.normalize_name($2)]\n when /\\Arename (\\S+) -> (\\S+)\\z/i\n [:rename, Tag.normalize_name($1), Tag.normalize_name($2)]\n when /\\A(?:mass update|update) (.+?) -> (.*)\\z/i\n [:mass_update, $1, $2]\n when /\\Acategory (\\S+) -> (#{Tag.categories.regexp})\\z/i\n [:change_category, Tag.normalize_name($1), $2.downcase]\n when /\\Anuke (\\S+)\\z/i\n [:nuke, $1]\n when /\\Adeprecate (\\S+)\\z/i\n [:deprecate, $1]\n when /\\Aundeprecate (\\S+)\\z/i\n [:undeprecate, $1]\n else\n [:invalid_line, line]\n end\n end\n end",
"title": ""
},
{
"docid": "b26f9fee15ecb2f81a354ac4c43b6cb8",
"score": "0.47755033",
"text": "def mssql_parse_error(data, info)\n len = data.slice!(0, 2).unpack('v')[0]\n buff = data.slice!(0, len)\n\n errno, state, sev, elen = buff.slice!(0, 8).unpack('VCCv')\n emsg = buff.slice!(0, elen * 2)\n emsg.gsub!(\"\\x00\", '')\n\n info[:errors] << \"SQL Server Error ##{errno} (State:#{state} Severity:#{sev}): #{emsg}\"\n info\n end",
"title": ""
},
{
"docid": "43a39482bd8dbea9f876101669bafa04",
"score": "0.47728363",
"text": "def mssql_ping_parse(data)\n\t\tres = {}\n\t\tvar = nil\n\t\tidx = data.index('ServerName')\n\t\treturn res if not idx\n\t\t\n\t\tdata[idx, data.length-idx].split(';').each do |d|\n\t\t\tif (not var)\n\t\t\t\tvar = d\n\t\t\telse\n\t\t\t\tif (var.length > 0)\n\t\t\t\t\tres[var] = d\n\t\t\t\t\tvar = nil\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t\n\t\treturn res\n\tend",
"title": ""
},
{
"docid": "43a39482bd8dbea9f876101669bafa04",
"score": "0.47718397",
"text": "def mssql_ping_parse(data)\n\t\tres = {}\n\t\tvar = nil\n\t\tidx = data.index('ServerName')\n\t\treturn res if not idx\n\t\t\n\t\tdata[idx, data.length-idx].split(';').each do |d|\n\t\t\tif (not var)\n\t\t\t\tvar = d\n\t\t\telse\n\t\t\t\tif (var.length > 0)\n\t\t\t\t\tres[var] = d\n\t\t\t\t\tvar = nil\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t\n\t\treturn res\n\tend",
"title": ""
},
{
"docid": "387e3fb6b64b8278cff603de70dc5411",
"score": "0.47689152",
"text": "def parse\n new_tokenize\n definitions_pass\n mangle_and_merge()\n do_main_pass()\n end",
"title": ""
},
{
"docid": "8029640c2e242beb4897418ebfec1637",
"score": "0.47685334",
"text": "def sbql_parser\n p = Parser.new\n p.do_parse()\n end",
"title": ""
},
{
"docid": "74944e1494b90bca74cdf5ae02b696a6",
"score": "0.47655502",
"text": "def parse_statement( statement )\n\tstatement = statement.sub( /#.*/, '' )\n\tcase statement.strip\n\twhen ''\n\t# Skip blank lines\n\twhen /print\\s+'(.*?)'/ @ripper.on_path( $1 ) do |el|\n\t\tputs el.text\n\tend\n\twhen /delete\\s+'(.*?)'/\n\t\[email protected]_path( $1 ) { |el| el.remove }\n\twhen /replace\\s+'(.*?)'\\s+'(.*?)'$/ @ripper.on_path( $1 ) { |el| el.text = $2 }\n\twhen /uppercase\\s+'(.*?)'/\n\t\[email protected]_path( $1 ) { |el| el.text = el.text.upcase }\n\twhen /print_document/\n\t\[email protected] do |doc|\n\t\tputs doc \n\t\tend\n\telse\n\t\traise \"Don't know what to do with: #{statement}\"\n\tend\nend",
"title": ""
},
{
"docid": "678b188c5e3df01b5594d3456fb314d4",
"score": "0.47569725",
"text": "def parse!; end",
"title": ""
},
{
"docid": "f73a19093955f66f570ebfdfbf7b0551",
"score": "0.47555086",
"text": "def tokens(sql)\n sql.scan(%r{\n (\n -- .* (?# matches \"--\" style comments to the end of line or string )\n | - (?# matches single \"-\" )\n |\n /[*] .*? [*]/ (?# matches C-style comments )\n | / (?# matches single slash ) \n |\n ' ( [^'\\\\] | '' | \\\\. )* ' (?# match strings surrounded by apostophes )\n |\n \" ( [^\"\\\\] | \"\" | \\\\. )* \" (?# match strings surrounded by \" )\n |\n \\?\\?? (?# match one or two question marks )\n |\n [^-/'\"?]+ (?# match all characters except ' \" ? - and / )\n \n )}x).collect {|t| t.first}\n end",
"title": ""
},
{
"docid": "d58246ab382b7680ef8712eb6cd9f077",
"score": "0.47553056",
"text": "def parse_program()\n # puts \"parsing program\"\n parse_statement\n if @tokens.first.kind == Token::EOL\n return\n elsif @tokens.first.kind == Token::EOF\n abort\n else\n puts \"Error: invalid input\"\n abort\n end\n end",
"title": ""
},
{
"docid": "cebdbf3cc40ca114925df3a1e284e874",
"score": "0.47503862",
"text": "def autogen_parse(parameters); end",
"title": ""
},
{
"docid": "615eeb0880f5d8cb520a572a3113ea23",
"score": "0.4743253",
"text": "def test_22\n token, value, raw, rest = @sql.lex(' \\d foo ; select \\'foo\\';')\n assert_equal(:meta_command, token)\n assert_equal('\\d foo ;', value)\n assert_equal(' \\d foo ;', raw)\n assert_equal(' select \\'foo\\';', rest)\n end",
"title": ""
},
{
"docid": "8ffc813a13900375c3b0fd1f3a5a2ecd",
"score": "0.47420323",
"text": "def parse_expressison line\n\t\t\tm = line.match(/^([^ ]+) ([^ ]+) (.+)$/i)\n\t\t\tresult = {:command => m[1].to_s.downcase, :table_name => m[2]}\n\t\t\tline = m[3].to_s\n\n\t\t\tcase result[:command]\n\t\t\t\twhen 'initmodel' \n\t\t\t\t\tm = line.match(/^[\\s]*({[^}]+})$/i)\n\t\t\t\t\tresult.merge!({:nodes => JSON.parse(m[1]).to_a.flatten})\n\n\t\t\t\twhen 'find' || 'count'\n\t\t\t\t\tm = line.match(/^[\\s]*([^ ]+) ({[^}]*}) ({[^}]+})$/i)\n\t\t\t\t\tresult.merge!({\n\t\t\t\t\t\t:number=>m[1], \n\t\t\t\t\t\t:filters=>JSON.parse(m[2]).symbolize_keys!, \n\t\t\t\t\t\t:params=>JSON.parse(m[3]).symbolize_keys!\n\t\t\t\t\t})\n\t\t\t\twhen 'set'\n\t\t\t\t\tm = line.match(/^[\\s]*({[^}]+})$/i)\n\t\t\t\t\tresult.merge!({\n\t\t\t\t\t\t:params => JSON.parse(m[1]).symbolize_keys!\n\t\t\t\t\t})\n\t\t\t\twhen 'delete'\n\t\t\t\t\tm = line.match(/^[\\s]*(.+)/i)\n\t\t\t\t\tresult.merge!({\n\t\t\t\t\t\t:ids => JSON.parse(m[1]).symbolize_keys!\n\t\t\t\t\t})\n\t\t\tend\n\t\t\tresult\n\t\tend",
"title": ""
},
{
"docid": "c110aa573a98dd7ee0a23b119ef0d514",
"score": "0.47337216",
"text": "def mssql_ping_parse(data)\n res = []\n var = nil\n idx = data.index('ServerName')\n return res if not idx\n sdata = data[idx, (data.length - 1)]\n\n instances = sdata.split(';;')\n instances.each do |instance|\n rinst = {}\n instance.split(';').each do |d|\n if (not var)\n var = d\n else\n if (var.length > 0)\n rinst[var] = d\n var = nil\n end\n end\n end\n res << rinst\n end\n\n return res\n end",
"title": ""
},
{
"docid": "c1288f6035a923e64a103e18005a6657",
"score": "0.47283873",
"text": "def parse()\n # todo: packrat style caching\n # set a checkpoint \n @parser.checkpoint\n result = parse_real()\n if !result \n # rollback on failure.\n @parser.rollback\n end\n return result\n end",
"title": ""
},
{
"docid": "6f73c4b4a22556f8984bde269b7ea24a",
"score": "0.47258216",
"text": "def parse\n \t#for each line of assembly, check if A or C instruction\n \t@assembly_instructions.each do |instruction|\n \t if command_type(instruction) == :a_command\n \t \t@machine_instructions << assemble_a_command(instruction)\n \t elsif command_type(instruction) == :c_command\n \t \t@machine_instructions << assemble_c_command(instruction)\n \t elsif command_type(instruction) == :l_command\n \t \t@machine_instructions << assemble_l_command(instruction)\n \t #if it is a full on label, insert nil\n \t else\n \t \t@machine_instructions << nil\n \t end\n \tend\n \t@machine_instructions\n end",
"title": ""
},
{
"docid": "2fbed4357515550a6214a19de54bfdf4",
"score": "0.4718912",
"text": "def parse(sql)\n @last_error = nil\n parse_internal(sql)\n end",
"title": ""
},
{
"docid": "c6d9f2f83fbdbfbb42443d6f43026e60",
"score": "0.4714787",
"text": "def parser() @parser end",
"title": ""
},
{
"docid": "971c18d96f45955863a676824b23c45c",
"score": "0.47089025",
"text": "def parse\n results = code_to_test.split(/^(?=\\S)/)\n parse_setup results.shift\n parse_happy_path results.shift\n parse_sad_path results.shift\n end",
"title": ""
},
{
"docid": "a4d5494df35bea236c5ced8916f4ab3f",
"score": "0.47009194",
"text": "def parse_nem12_500(_line, _options = {}); end",
"title": ""
},
{
"docid": "ba3340a039d319f240e8f9ba38e97146",
"score": "0.46976975",
"text": "def handle_sy_mn_od\n handle_sy\n handle_mn\n next_tag\n handle_od\n end",
"title": ""
},
{
"docid": "50f29aa4b65f3bfb287d323cbfe7064c",
"score": "0.46961915",
"text": "def parser; end",
"title": ""
},
{
"docid": "50f29aa4b65f3bfb287d323cbfe7064c",
"score": "0.46961915",
"text": "def parser; end",
"title": ""
},
{
"docid": "50f29aa4b65f3bfb287d323cbfe7064c",
"score": "0.46961915",
"text": "def parser; end",
"title": ""
},
{
"docid": "50f29aa4b65f3bfb287d323cbfe7064c",
"score": "0.46961915",
"text": "def parser; end",
"title": ""
},
{
"docid": "50f29aa4b65f3bfb287d323cbfe7064c",
"score": "0.46961915",
"text": "def parser; end",
"title": ""
},
{
"docid": "50f29aa4b65f3bfb287d323cbfe7064c",
"score": "0.46961915",
"text": "def parser; end",
"title": ""
},
{
"docid": "50f29aa4b65f3bfb287d323cbfe7064c",
"score": "0.46961915",
"text": "def parser; end",
"title": ""
},
{
"docid": "50f29aa4b65f3bfb287d323cbfe7064c",
"score": "0.46961915",
"text": "def parser; end",
"title": ""
},
{
"docid": "50f29aa4b65f3bfb287d323cbfe7064c",
"score": "0.46961915",
"text": "def parser; end",
"title": ""
},
{
"docid": "2f4881e536145724fe527b6dfa26c54b",
"score": "0.4692182",
"text": "def handle_sy_sm_sd\n handle_sy\n next_tag\n handle_sm\n next_tag\n handle_sd\n end",
"title": ""
},
{
"docid": "4b28141519608d564642001720c29389",
"score": "0.4689511",
"text": "def handle_sy_mn_sd\n handle_sy\n handle_mn\n next_tag\n handle_sd\n end",
"title": ""
},
{
"docid": "c8f335fefaa55ffe0c3586182bbeda27",
"score": "0.46892235",
"text": "def structure\n parser = Marshal::Structure::Parser.new token_stream\n\n begin\n parser.parse\n rescue => exception\n @tokenizer.crash_dump\n puts exception\n puts exception.backtrace\n end\n end",
"title": ""
},
{
"docid": "51051bd5cf5ffa4316547c34f65df348",
"score": "0.46797308",
"text": "def syntax; end",
"title": ""
},
{
"docid": "51051bd5cf5ffa4316547c34f65df348",
"score": "0.46797308",
"text": "def syntax; end",
"title": ""
},
{
"docid": "51051bd5cf5ffa4316547c34f65df348",
"score": "0.46797308",
"text": "def syntax; end",
"title": ""
},
{
"docid": "51051bd5cf5ffa4316547c34f65df348",
"score": "0.46797308",
"text": "def syntax; end",
"title": ""
},
{
"docid": "7ebb0e2a61287a80e0f270f66d11e039",
"score": "0.46749842",
"text": "def process\n process_node ast\n rescue Parser::SyntaxError\n end",
"title": ""
},
{
"docid": "3906874ecfbdc12d496b8566cf974c67",
"score": "0.4672971",
"text": "def t__14!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 6 )\n\n type = T__14\n channel = ANTLR3::DEFAULT_CHANNEL\n\n\n # - - - - main rule block - - - -\n # at line 12:9: '\\\"'\n match(0x22)\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__, 6 )\n\n end",
"title": ""
},
{
"docid": "805d9ff48632f31bf372ce2b2669aae9",
"score": "0.46700174",
"text": "def parse_commands com, body\n commands = body.downcase.split(/\\W+/).map { |w| map_to_command w, t.commands }\n commands.delete_if { |c| c.nil? }\n commands[0,1]\n end",
"title": ""
},
{
"docid": "132dd1f641a553bf8835a13a0ca71027",
"score": "0.4662582",
"text": "def handle_gr_ts\n handle_gr\n handle_possible(SeparatorSpace)\n handle_ts\n end",
"title": ""
},
{
"docid": "c767b3acb8f565ec3d538a7ffcd6f4bf",
"score": "0.4660734",
"text": "def parseCommandString(cmdParams)\n cmdParams.each do |entry|\n line = entry.dup\n line.strip!\n if line.match(/fcname=/)\n @fcName = line.gsub(/fcname=/,\"\") \n elsif line.match(/lanebarcode=/)\n @laneBarcode = line.gsub(/lanebarcode=/,\"\")\n elsif line.match(/queue=/)\n @queueName = line.gsub(/queue=/, \"\")\n end\n end\n \n if @fcName == nil || @laneBarcode == nil\n printUsage()\n exit -1\n elsif\n @fcBarcode = PipelineHelper.getFCBarcodeName(@fcName, @laneBarcode)\n puts \"Sequencing Event Name : \" + @fcBarcode.to_s\n end\n end",
"title": ""
},
{
"docid": "222d72609ce1b15b75ee0a3eb75a5936",
"score": "0.46582606",
"text": "def __parse_inter(process)\n parsed_process = QProcess.new\n tmp_node = QProcess::ProcessNode.new\n proclen = process.length\n\n if process[0..5] == \"*meas*\"\n head = 6\n tail = 0\n nest_if = 0\n cond_set_flag = false;\n then_set_flag = false;\n\n i = 0;\n process.each_char { |char|\n if process[i..i+5] == \"*meas*\"\n nest_if += 1\n elsif process[i..i+5] == \"*saem*\" and nest_if >= 2\n nest_if -= 1\n elsif process[i..i+3] == \"then\" and nest_if == 1\n cond_set_flag = true;\n tail = i - 1\n tmp_node.kind = \"condition\"\n tmp_node.target = [process[head..tail]]\n head = i + 4\n parsed_process.node = tmp_node\n elsif process[i..i+5] == \"*saem*\" and nest_if == 1\n then_set_flag = true;\n tail = i - 1\n parsed_process.left = __parse_inter(process[head..tail])\n end\n i += 1\n }\n unless cond_set_flag and then_set_flag\n raise \"measure syntax error\"\n end\n elsif process[0..0] == \"(\" #either palla or ristriction\n i = 0\n nest_paren = 0\n process.each_char{ |char|\n if char == \"(\"\n nest_paren += 1\n elsif char == \")\"\n nest_paren -= 1\n elsif char == \"|\" and nest_paren == 1 #palla\n unless process[i+1..i+1] == \"|\" and \n process[proclen-1..proclen-1] == \")\"\n raise \"palla syntax error\"\n end\n tmp_node.kind = \"palla\"\n parsed_process.node = tmp_node\n parsed_process.left = __parse_inter(process[1..i-1])\n parsed_process.right = __parse_inter(process[i+2..proclen-2])\n break\n elsif char == \"/\" and nest_paren == 1 #ristriction\n unless process[i+1..i+1] == \"{\" and \n process[proclen-1..proclen-1] == \")\" and\n process[proclen-2..proclen-2] == \"}\" \n raise \"restriction syntax error\"\n end\n tmp_node.kind = \"restriction\"\n tmp_node.target = process[i+2 .. proclen-3].split(\",\")\n parsed_process.node = tmp_node\n parsed_process.left = __parse_inter(process[1..i-1])\n break\n end\n i += 1\n } #process.each_char\n else\n i = 0\n terminal_flag = true\n process.each_char{ |char|\n if char == \".\"\n parsed_process.node = __tokenize(process[0..i-1])\n parsed_process.left = __parse_inter(process[i+1..proclen - 1])\n terminal_flag = false\n break\n end\n i += 1\n }\n if terminal_flag == true\n begin \n i = process.index(\"(\")\n j = process.index(\")\")\n if i == nil or j == nil or process[0..6] != \"discard\"\n raise \"ill formed discard: \" + process\n end\n tmp_node.kind = \"discard\"\n tmp_node.target = process[i+1 .. j-1].split(\",\")\n parsed_process.node = tmp_node\n end\n end\n end\n parsed_process\n end",
"title": ""
},
{
"docid": "275b08f01749b6393fc50859346230de",
"score": "0.4657646",
"text": "def start\n @cmd.parse\n end",
"title": ""
},
{
"docid": "e7cc98abb2a76e92726daab879281bde",
"score": "0.46573916",
"text": "def parse!\n case self.peek\n when SQLTree::Token::SELECT then SQLTree::Node::SelectQuery.parse(self)\n when SQLTree::Token::INSERT then SQLTree::Node::InsertQuery.parse(self)\n when SQLTree::Token::DELETE then SQLTree::Node::DeleteQuery.parse(self)\n when SQLTree::Token::UPDATE then SQLTree::Node::UpdateQuery.parse(self)\n when SQLTree::Token::BEGIN then SQLTree::Node::BeginStatement.parse(self)\n when SQLTree::Token::COMMIT then SQLTree::Node::CommitStatement.parse(self)\n when SQLTree::Token::SET then SQLTree::Node::SetQuery.parse(self)\n else raise UnexpectedToken.new(self.peek)\n end\n end",
"title": ""
},
{
"docid": "7fd9ba677f7bf1b034f32300a57a6d03",
"score": "0.46543896",
"text": "def parse\n \n end",
"title": ""
},
{
"docid": "ab3a631ea2c575c865ce3d4c124c5408",
"score": "0.46524557",
"text": "def parse_vscsi_syntax(vscsi_string)\n return parse_slash_delim_string(vscsi_string, \n [:virtual_slot_num, :client_or_server, :remote_lpar_id, :remote_lpar_name, :remote_slot_num, :is_required]) if !vscsi_string.empty?\n end",
"title": ""
},
{
"docid": "1cf58a05ea6105d5776752f1fa2af6b8",
"score": "0.46433172",
"text": "def space_tokens\n\n line_array=@text_to_process.split(\"\\n\")\n\n for line in line_array do\n\n #There is a pattern we need to observe\n # A line of code like this-->\n # for(c=1;c<1-;c++)\n # We need to sepearte for and (\n # However, for a code like this-->\n # getStuff(), getstuff and ( need to be together so as we can identify it as a method\n # We cannot strip comments before identifiers as well because we will lose the info on which lines are package imports/library includes or declaration line\n #Hence our keywords need some special treatment\n line_split=line.split(\" \")\n line=\"\"\n\n for word in line_split\n for keyword in @confinstance.words_list do\n if word.include?(keyword)\n new_keyword=\" \" << keyword << \" \"\n word.sub!(keyword,new_keyword)\n end\n end\n line << word\n end\n\n #Space'commas' and semicolon\n line.gsub!(\",\",\" , \")\n line.gsub!(\";\",\" ; \")\n\n\n line.gsub!(\"{\",\" { \")\n line.gsub!(\"}\",\" } \")\n line.gsub!(\"[\",\" [ \")\n line.gsub!(\"]\",\" ] \")\n line.gsub!(\"(\",\"( \") #keep attached to method but seperate from parameter within\n line.gsub!(\")\",\" ) \")\n line.gsub!(\"+\",\" + \") #Case when c++ c + +\n line.gsub!(\"-\",\" - \")\n\n #For all words with =,:,<,> sticked together we can seperate the identifier.methodname() or identifier:list with a space so as they can be later properly identified as a sepearte varibale\n #We need them at this stage to differentiate between different tokens, so they will be removed in a later stage\n line.gsub!(\"=\",\" = \")\n line.gsub!(\":\",\" : \")\n line.gsub!(\"<\",\" < \")\n line.gsub!(\">\",\" > \")\n line.gsub!(\".\",\". \")\n\n\n #Remove @\n line.gsub!(\"@\",\"\")\n\n @filtered_text << line+\"\\n\"\n end\n\n switch_text\n\n end",
"title": ""
},
{
"docid": "83c5642aefd4ca6a5619a2f20d319601",
"score": "0.46302563",
"text": "def mssql_parse_reply(data, info)\n info[:errors] = []\n return if not data\n until data.empty?\n token = data.slice!(0, 1).unpack('C')[0]\n case token\n when 0x81\n mssql_parse_tds_reply(data, info)\n when 0xd1\n mssql_parse_tds_row(data, info)\n when 0xe3\n mssql_parse_env(data, info)\n when 0x79\n mssql_parse_ret(data, info)\n when 0xfd, 0xfe, 0xff\n mssql_parse_done(data, info)\n when 0xad\n mssql_parse_login_ack(data, info)\n when 0xab\n mssql_parse_info(data, info)\n when 0xaa\n mssql_parse_error(data, info)\n when nil\n break\n else\n info[:errors] << \"unsupported token: #{token}\"\n end\n end\n info\n end",
"title": ""
},
{
"docid": "3c5c320d06ddd20df0ad4744e9a7cd95",
"score": "0.46298003",
"text": "def process(statements); end",
"title": ""
},
{
"docid": "9295f5b2faa192217d03f4c5f6c90c89",
"score": "0.46287918",
"text": "def yt_parse(key, source, opts)\n opts = {:rubyless_helper => self}.merge(Hash[*(opts.map{|k,v| [k.to_sym, v]}.flatten)])\n\n case key\n when 'res'\n\n begin\n query = DummyProcessor.new(source, opts).query\n (query.main_class != DummyClass ? \"#{query.main_class}: \" : '') + query.to_s\n rescue QueryBuilder::Error => err\n err.message\n end\n when 'sxp'\n # s-expression\n QueryBuilder::Parser.parse(source).inspect\n when 'sql'\n DummyProcessor.new(source, opts).query.sql(binding)\n when 'count'\n DummyProcessor.new(source, opts).query.to_s(:count)\n when 'count_sql'\n DummyProcessor.new(source, opts).query.sql(binding, :count)\n else\n \"parse not implemented for '#{key}' in querybuilder_test.rb\"\n end\n end",
"title": ""
},
{
"docid": "811693eacc4be93d75c816fe6a6433a7",
"score": "0.46275485",
"text": "def parse_tokens\n t = @tokenizer\n\n case t.token\n\n when CALL\n return unless scan_until IDENT\n \"CALL #{t.text}\"\n\n when DELETE\n return unless scan_until FROM\n return unless scan_token IDENT\n table = scan_dotted_identifier\n \"DELETE FROM #{table}\"\n\n when INSERT, REPLACE\n action = t.text\n return unless scan_until INTO\n return unless scan_token IDENT\n table = scan_dotted_identifier\n \"#{action} INTO #{table}\"\n\n when SELECT\n level = 0\n while t.scan\n case t.token\n when LPAREN then level += 1\n when RPAREN then level -= 1\n when FROM\n next unless level == 0\n break unless scan_token IDENT\n table = scan_dotted_identifier\n return \"SELECT FROM #{table}\"\n end\n end\n\n when UPDATE\n # Scan for the table name. Some dialects allow option keywords before\n # the table name.\n return 'UPDATE' unless scan_token IDENT\n\n table = t.text\n\n period = false\n first_period = false\n\n while t.scan\n case t.token\n when IDENT\n if period\n table += t.text\n period = false\n end\n\n unless first_period\n table = t.text\n end\n\n # Two adjacent identifiers found after the first period. Ignore\n # the secondary ones, in case they are unknown keywords.\n when PERIOD\n period = true\n first_period = true\n table += '.'\n else\n return \"UPDATE #{table}\"\n end\n end\n end\n end",
"title": ""
},
{
"docid": "7c4db4a9f8a633977e6b535d8d75b4db",
"score": "0.46267533",
"text": "def go s = ''\n \"#{s.sub(/\\A\\n+/,'')}\\nGO\\n\"\n end",
"title": ""
},
{
"docid": "9026553d4c251fadde7604d39b7517c3",
"score": "0.46251613",
"text": "def Program(statements); end",
"title": ""
},
{
"docid": "5c992738078fd55d4beaf0f584d51e39",
"score": "0.4622983",
"text": "def parse \n end",
"title": ""
},
{
"docid": "1e57c351e08e720c2e35ce702322cf7a",
"score": "0.46219414",
"text": "def parse_command\n return nil if @vb_delimited.length < 2\n\n @vb_delimited[1]\n end",
"title": ""
},
{
"docid": "37fff66325f860d2acce07e7f20d3af8",
"score": "0.46191067",
"text": "def parse!()\n # This will prepare the core list of all the possible (parsed) session DAOs\n # from the program text, creating a new session DAO for each date or timing\n # found at the start of a list of events.\n # The DAOs will store just the text tokens (events, date and times) that will\n # have to be parsed afterwards\n extract_tokens_and_prepare_dao_list( @source_row.program_import_text )\n\n # Parse all tokens stored into the @session_daos:\n parse_all_daos()\n\n # Compact session DAOs moving warmup-only session DAOs into the next event\n # session, using as warm-up time the begin time stored into the warm-up session DAO\n # that has to be removed.\n move_warmup_daos_into_event_daos()\n\n # \"Merge\" same or split-event session DAOs into a single session by deleting\n # the duplicated event sessions except for the first one.\n # The reason for this is that we do not plan to support events split among\n # different sessions.\n remove_duplicated_event_daos()\n end",
"title": ""
},
{
"docid": "2dd0908e4be94e8b625564955942cc71",
"score": "0.4615041",
"text": "def parse_line(line)\n\tline.gsub!(\"bags\",\"\")\n\tline.gsub!(\"bag\",\"\")\n\tline.gsub!(\".\",\"\")\n\treturn line\nend",
"title": ""
},
{
"docid": "366dce46007264ee8903189cc30411ae",
"score": "0.46116295",
"text": "def parse\n statements = []\n statements << declaration until at_end?\n statements\n end",
"title": ""
},
{
"docid": "9d5fd0653d3335558309087cafdb78ba",
"score": "0.46016428",
"text": "def compileStatements()\n\t\twhile contains(STATE_STARTS, @tokenizer.getCurrItem)\n\t\t\tcase @tokenizer.getCurrItem\n\t\t\t\twhen \"let\"\n\t\t\t\tcompileLet()\n\t\t\t\twhen \"if\"\n\t\t\t\tcompileIf()\n\t\t\t\twhen \"while\"\n\t\t\t\tcompileWhile()\n\t\t\t\twhen \"do\"\n\t\t\t\tcompileDo()\n\t\t\t\twhen \"return\"\n\t\t\t\tcompileReturn()\n\t\t\tend\n\t\t\[email protected]\n\t\tend\n\t\[email protected]\n\tend",
"title": ""
},
{
"docid": "fe25ab1243a7fe88cb7808380aca8158",
"score": "0.45984793",
"text": "def scan_statement\n # eat any whitespace at the start of the string\n whitespace = @scanner.scan_until(/\\S/)\n\n if whitespace\n @scanner.pos -= 1\n update_counter(whitespace[0..-2])\n end\n\n # look for matches\n if (text = @scanner.scan(/\\}\\}/))\n @context = :body\n token(:VAR_CLOSE, text)\n\n elsif (text = @scanner.scan(/%\\}/))\n @context = :body\n token(:STMT_CLOSE, text)\n\n elsif (text = @scanner.scan(/[=]=/)) # i've added the square brackets because syntax highlighters dont like /=\n token(:OP_EQ, text)\n\n elsif (text = @scanner.scan(/!=/))\n token(:OP_NEQ, text)\n\n elsif (text = @scanner.scan(/>=/))\n token(:OP_GEQ, text)\n\n elsif (text = @scanner.scan(/<=/))\n token(:OP_LEQ, text)\n\n elsif (text = @scanner.scan(/(#{KEYWORDS.join('|')})[\\W]/))\n keyword = text[0..-2]\n @scanner.pos -= 1\n\n token(keyword.upcase.to_sym, keyword)\n\n elsif (text = @scanner.scan(/(end[a-zA-Z]+)/))\n token(:END, text.upcase)\n\n elsif (text = @scanner.scan(/[+\\-]?[0-9]+\\.[0-9]+/))\n token(:REAL, text)\n\n elsif (text = @scanner.scan(/[+\\-]?[1-9][0-9]*|0/))\n token(:INTEGER, text)\n\n elsif (text = @scanner.scan(/'[^']*'/))\n token(:STRING, text)\n\n elsif (text = @scanner.scan(/\"(?:[^\\\\\"]|\\\\.)*\"/))\n text.gsub!(/\\\\\"/) { '\"' }\n text.gsub!(/\\\\r/) { \"\\r\" }\n text.gsub!(/\\\\n/) { \"\\n\" }\n text.gsub!(/\\\\t/) { \"\\t\" }\n text.gsub!(/\\\\\\\\/) { '\\\\' }\n text.gsub!(/\\\\u([0-9a-fA-F]+)/) { |m| [m[2..-1].hex].pack('U') }\n token(:STRING, text)\n\n elsif (text = @scanner.scan(/[A-Za-z_][A-Za-z0-9_\\.]*/))\n token(:IDENTIFIER, text)\n\n else\n next_character = @scanner.getch\n token(next_character, next_character)\n end\n end",
"title": ""
},
{
"docid": "4d61d1164c8773dffe0e326c2ec30f00",
"score": "0.45977667",
"text": "def parse\n @current_token = read_token\n \n case @current_token.token\n when :SEMICOLON\n new_statement\n else\n send \"new_#{@current_token.token.downcase}\"\n end\n end",
"title": ""
},
{
"docid": "35e12afe0d81733402a2c8ce9ee7c3a7",
"score": "0.45934722",
"text": "def process(text)\n @logger.debug \"Processing buffer: #{text}\"\n\n # shortcuts for '.' and '-'\n text = 'c ' + text if text =~ /^\\s*(\\.|\\-+)\\s*$/\n\n # Determine first non-comment word of a command\n text =~ /\\A(?:\\/\\*.*?\\*\\/\\s*|--.*?(?:\\n|\\Z))*\\s*([^[:space:]\\*\\(\\/;]+)?\\s*(.*?)(?:[[:space:];]*)\\Z/mi\n # <------------- 1 ---------------> <--------- 2 -------->- < 3 >\n # 1) strip '/* ... */' or '--' style comments from the beginning\n # 2) first word (any characters not being a space, '(', ';' or '*'), captured into $1\n # 3) remaining portion of a command, captured into $2\n\n case first_word = $1 && $1.upcase\n # Nothing, gibberish or just comments\n when nil\n if $2 && $2 != ''\n raise InvalidCommand, \"Invalid command: #{$2}\"\n end\n\n when 'C', 'CD'\n @logger.debug \"Switch context\"\n old_schema = @context.schema || @context.user\n if $2 && $2 != ''\n @context = context_for(@context, $2[/^\\S+/])\n else\n @context.set(schema: @user)\n end\n @logger.debug \"New context is #{@context.send(:key_hash)}\"\n if old_schema != (@context.schema || @context.user)\n @logger.debug \"Implicit ALTER SESSION SET CURRENT_SCHEMA = \" + (@context.schema || @context.user)\n @oci.exec(\"ALTER SESSION SET CURRENT_SCHEMA = \" + (@context.schema || @context.user))\n end\n\n when 'L', 'LS'\n @logger.debug \"List\"\n options, path = options_for($2)\n filter = path ? path[/[^\\.\\/]*(\\*|\\?)[^\\.\\/]*$/] : nil\n path.chomp!(filter) if filter\n path = path.chomp('.').chomp('/')[/^\\S+/] unless path.nil? || path == '.' || path == '/'\n filter.upcase! if filter\n @logger.debug \"Path: #{path}, Filter: #{filter}\"\n work_context = context_for(@context, path)\n @logger.debug \"List for #{work_context.level || 'database'}\"\n Terminal.puts_grid(@meta.find(work_context).list(options, filter))\n\n when 'D', 'DESC', 'DESCRIBE'\n @logger.debug \"Describe\"\n options, args = options_for($2)\n path = args.split(/\\s+/).first rescue nil\n work_context = context_for(@context, path)\n @logger.debug \"Describe for #{work_context.level || 'database'}\"\n puts(@meta.find(work_context).describe(options))\n\n # TODO: For refactoring\n if work_context.level == :column && options['p']\n prof = @oci.exec <<-SQL\n SELECT value, cnt, rank\n FROM (SELECT value, cnt, row_number() over (order by cnt desc) AS rank\n FROM (SELECT #{work_context.column} AS value, count(*) AS cnt\n FROM #{work_context.object}\n GROUP BY #{work_context.column}\n )\n )\n WHERE rank <= 20 OR value IS NULL\n ORDER BY rank\n SQL\n puts \"\"\n Terminal.puts_cursor(prof)\n end\n\n # Exit\n when 'X', 'EXIT'\n @logger.debug \"Exiting on exit command\"\n terminate\n\n # SQL\n when *SQL_INITIAL_KEYWORDS\n raw_sql = text.gsub(/[;\\/]\\Z/, '')\n @logger.debug \"SQL: #{raw_sql}\"\n context_aware_sql = Awareness.enrich(raw_sql, @context)\n @logger.debug \"SQL (context-aware): #{context_aware_sql}\" if context_aware_sql != raw_sql\n res = @oci.exec(context_aware_sql)\n\n if res.is_a? OCI8::Cursor\n Terminal.puts_cursor(res)\n @logger.info \"#{res.row_count} row(s) selected\"\n else\n @logger.info \"#{res} row(s) affected\"\n end\n\n when 'SU'\n @logger.debug \"Command type: su\"\n su\n\n when 'SUDO'\n @logger.debug \"Command type: sudo (#{$2})\"\n raise InvalidCommand, \"Command required for sudo\" if $2.strip == ''\n su($2)\n\n when '!'\n @logger.debug \"Command type: metadata refresh\"\n @meta.purge_cache\n\n when '?'\n @logger.debug \"Command type: help\"\n puts(HELP)\n\n # Unknown\n else\n raise InvalidCommand, \"Invalid command: #{$1}\"\n end\n\n rescue InvalidCommand, Meta::NotApplicable => e\n @logger.error e.message\n rescue Context::InvalidKey, Meta::NotExists => e\n @logger.error \"Invalid path\"\n rescue OCIError => e\n @logger.error e.parse_error_offset ? \"#{e.message} at #{e.parse_error_offset}\" : e.message\n rescue Interrupt\n @logger.warn \"Interrupted by user\"\n rescue StandardError => e\n @logger.error \"Internal error\"\n @logger.debug e.backtrace\n end",
"title": ""
}
] |
7fd3722636075510c67232e21a0d0deb
|
Same thing but truncate in the dom
|
[
{
"docid": "dfd813b8a5c312e52b34c1a3d7dda700",
"score": "0.5857668",
"text": "def span_with_title_truncated(full_text, truncate_length=100)\n content_tag :span, title: full_text do\n truncate(full_text, length: truncate_length, separator: ' ')\n end\n end",
"title": ""
}
] |
[
{
"docid": "bff9455225bbb6506e2af58dd971b558",
"score": "0.8048757",
"text": "def truncate() end",
"title": ""
},
{
"docid": "a00ec5ce6870f7b5086f0cc7d07e9efe",
"score": "0.74506915",
"text": "def truncate\n end",
"title": ""
},
{
"docid": "990fdbc719fa26c98da70fe7853b5607",
"score": "0.732093",
"text": "def clean_truncate_html(len=30, ellipsis=\"...\")\n Nokogiri::HTML::DocumentFragment.parse(HTML_Truncator.truncate(self, len, :ellipsis => ellipsis, :length_in_chars => true)).to_xhtml\n end",
"title": ""
},
{
"docid": "451cfae4163f45e686f26ad60c194fba",
"score": "0.7222604",
"text": "def wikitext_truncate_and_strip(markup, options = {})\n squished = strip_tags(markup.w).squish # may have entities, eg. " etc\n truncated = truncate squished, options.merge(escape: false)\n if truncated == squished # string wasn't changed\n truncated.html_safe\n else # string was chopped\n omission = options[:omission] || '...'\n truncated.gsub! /&[^;]+?#{Regexp.escape omission}\\z/, omission\n truncated.html_safe\n end\n end",
"title": ""
},
{
"docid": "81b9af7f035b6f944764c4c3e461fe5b",
"score": "0.7180144",
"text": "def truncated_content\n\t\t\tid.to_s+\" - \"+content.truncate(50,{omission: '...'})\n\t end",
"title": ""
},
{
"docid": "13d2c60dd3ecebb627020f9d2a5f90d9",
"score": "0.71563584",
"text": "def truncated_content\n\t\tid.to_s+\" - \"+content.truncate(50,{omission: '...'})\n end",
"title": ""
},
{
"docid": "fa05f47dbd254d3a1bbd830757f93193",
"score": "0.68129563",
"text": "def truncate content # :nodoc:\n maxlen = @maxlen || @width-@internal_width\n maxlen = @width-@internal_width if maxlen > @width-@internal_width\n if maxlen == 0 # (otherwise it becoems -1 below)\n content.replace \"\"\n return\n end\n if !content.nil? \n cl = content.length\n if cl > maxlen # only show maxlen\n @longest_line = cl if cl > @longest_line\n #content = content[@pcol..@pcol+maxlen-1] \n ## taking care of when scrolling is needed but longest_line is misreported\n # So we scroll always and need to check 2013-03-06 - 00:09 \n content.replace(content[@pcol..@pcol+maxlen-1] || \" \")\n else\n ## taking care of when scrolling is needed but longest_line is misreported\n # So we scroll always and need to check 2013-03-06 - 00:09 \n content.replace(content[@pcol..-1]||\" \") if @pcol > 0 \n end\n end\n content\n end",
"title": ""
},
{
"docid": "6bb0b4514837db3fa0a55366efcf2378",
"score": "0.6811628",
"text": "def truncate(p0) end",
"title": ""
},
{
"docid": "6bb0b4514837db3fa0a55366efcf2378",
"score": "0.68104213",
"text": "def truncate(p0) end",
"title": ""
},
{
"docid": "fc96940d6ac18ff228e3081242531286",
"score": "0.679703",
"text": "def truncate(length = 30)\n return self if self.length < length\n self[0..length].gsub(/\\s\\w+\\s*$/, '...')\n end",
"title": ""
},
{
"docid": "317aa8c4bd76675135f9e0245797d7e1",
"score": "0.66457987",
"text": "def truncate\n @text.truncate_words(@word_num, omission: \"#{@cut_off}\")\n end",
"title": ""
},
{
"docid": "ffd6cfc453c5da7b35246fcf62629bd4",
"score": "0.6632534",
"text": "def truncate content # :nodoc:\n maxlen = @maxlen ||= @width-2\n if !content.nil? \n if content.length > maxlen # only show maxlen\n @longest_line = content.length if content.length > @longest_line\n #content = content[@pcol..@pcol+maxlen-1] \n content.replace content[@pcol..@pcol+maxlen-1] \n else\n # can this be avoided if pcol is 0 XXX\n content.replace content[@pcol..-1] if @pcol > 0\n end\n end\n content\n end",
"title": ""
},
{
"docid": "da14545bde48688195d5af8ffa1826c9",
"score": "0.6585431",
"text": "def truncate_hover_blue_tooltip(str,length)\n unless str.nil?\n if str.length > length\n return %Q{\n <span class=\"liviadashboardview\">\n #{truncate(str,:length => length)}\n <span class=\"livia_dashboardroller\" style=\"display:none;\">\n #{str}\n </span>\n </span>\n }.html_safe!\n end\n end \n return str\n end",
"title": ""
},
{
"docid": "aea71fa0c21179a448dcb5e4a88ef651",
"score": "0.6572716",
"text": "def truncate(length)\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "d814bccbff51489b762855eacc1c987a",
"score": "0.6535088",
"text": "def awesome_truncate(text, length = 30, truncate_string = \"…\")\n return \"\" if text.blank?\n\n l = length - truncate_string.mb_chars.length\n result = text.mb_chars.length > length ? (text[/\\A.{#{l}}\\w*\\;?/m][/.*[\\w\\;]/m] || '') + truncate_string : text\n result.html_safe\n end",
"title": ""
},
{
"docid": "0f7457f577883a8c6b53db7e2e70cd1b",
"score": "0.6504771",
"text": "def truncated_text_with_hover text, args = {:truncate => 40}\n \"<div title='#{text.length > args[:truncate] ? text : nil}'>#{text.truncate(args[:truncate])}</div>\".html_safe\n end",
"title": ""
},
{
"docid": "8710af3a40dabf246f76b845edae985d",
"score": "0.6472782",
"text": "def truncate(decplace = 0)\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "22aa79eceda3bd5c386b717c3a35619d",
"score": "0.6457397",
"text": "def trunc(len)\n split(/ /).each_with_object('') do |x, ob|\n break ob unless ob.length + ' '.length + x.length <= len\n\n ob << (\" #{x}\")\n end.strip\n end",
"title": ""
},
{
"docid": "918299165d6bf8bae883df1578d928c9",
"score": "0.6420498",
"text": "def truncate_with_tooltip(text, options = {}, &block)\n return if text.blank?\n\n truncated_text = truncate(text, options, &block)\n\n if options.key?(:length) && text.length > options[:length]\n return content_tag(:span, truncated_text, title: sanitize(text))\n end\n\n truncated_text\n end",
"title": ""
},
{
"docid": "75da2efe6e2737ba902379dc551f9b1e",
"score": "0.6418732",
"text": "def truncate_paragraph(long_str, num_characters, truncated_indicator=\"...\")\nend",
"title": ""
},
{
"docid": "a8778e2203a6f07dbf2e0d304132b68e",
"score": "0.6415813",
"text": "def truncate(v, l = 30)\n s = v.to_s\n s.size > l ? s.first(l) + t('truncation', '...') : s\n end",
"title": ""
},
{
"docid": "3954dc46e7f78177a98a85b85e12b1fa",
"score": "0.64001584",
"text": "def trunc_em\n self.name = self.name.truncate 30 if self.name.present?\n self.twitter_handle = self.twitter_handle.truncate 30 if self.twitter_handle.present?\n self.location = self.location.truncate 40 if self.location.present?\n end",
"title": ""
},
{
"docid": "94e26af649c9037bb7bc7c3b791a8b3b",
"score": "0.6398573",
"text": "def display_truncated_text(text, options)\n truncate_options = {:length => options.delete(:length), :whitespace => options.delete(:whitespace)}\n any_hidden = false\n\n options = {\n :block_tag => \"p\",\n :more => \"\\xE2\\x80\\xA6\", # Ellipsis character in UTF-8\n :truncated_text => {:class => 'truncated'}\n }.merge(options)\n\n if options[:truncated_text].kind_of?(Hash) && options[:truncated_text][:class]\n truncated_attributes = \" class=\\\"#{options[:truncated_text][:class]}\\\"\"\n end\n\n truncate_text(text, truncate_options) do |visible, hidden|\n any_hidden ||= hidden.present?\n {\n :visible => !visible.empty?,\n :html => [\n html_escape(visible),\n (!visible.empty? || hidden.blank?) ? nil : html_escape(hidden),\n ( visible.empty? || hidden.blank?) ? nil : (\n truncated_attributes ? \"<span#{truncated_attributes}>#{html_escape(hidden)}</span>\" : nil\n )\n ].compact\n }\n\n end.tap do |blocks|\n if any_hidden && options[:more]\n last_visible_html = blocks.select{|block| block[:visible] }.last[:html]\n if truncated_attributes\n last_visible_html.insert(1, \"<a href=\\\"#\\\" class=\\\"expand-truncated\\\">#{html_escape(options[:more])}</a>\")\n else\n last_visible_html.insert(1, html_escape(options[:more]))\n end\n end\n\n end.map do |block|\n if block[:visible]\n if options[:block_tag]\n \"<#{options[:block_tag]}>#{block[:html].join}</#{options[:block_tag]}>\"\n else\n block[:html].join\n end\n elsif options[:block_tag] && truncated_attributes\n \"<#{options[:block_tag]}#{truncated_attributes}>#{block[:html].join}</#{options[:block_tag]}>\"\n end\n end.compact.join\n end",
"title": ""
},
{
"docid": "d1e355c6e3bde08be9c891f0af517557",
"score": "0.63944477",
"text": "def truncate_html(text, len = 30, at_end = ' ...')\n p = REXML::Parsers::PullParser.new((text.presence || '<p> </p>').gsub(/[\\r\\n\\t]/, ''))\n tags = []\n new_len = len\n results = ''\n while p.has_next? && new_len > 0\n p_e = p.pull\n case p_e.event_type\n when :start_element\n tags.push p_e[0]\n results << \"<#{tags.last}#{attrs_to_s(p_e[1])}>\"\n when :end_element\n results << \"</#{tags.pop}>\"\n when :text\n results << p_e[0][0..new_len]\n new_len -= p_e[0].length\n else\n results << \"<!-- #{p_e.inspect} -->\"\n end\n end\n\n if at_end && sanitize(text).length > len\n results << at_end\n end\n \n tags.reverse.each do |tag|\n results << \"</#{tag}>\"\n end\n raw(results)\n end",
"title": ""
},
{
"docid": "b9898d1b9e7e2a307e5c0c921f4256f1",
"score": "0.6393981",
"text": "def truncate_nokogiri_node(node,\n length: HtmlAwareTruncation.default_length,\n omission: HtmlAwareTruncation.default_omission,\n separator: nil)\n if node.kind_of?(::Nokogiri::XML::Text)\n if node.content.length > length\n allowable_endpoint = [0, length - omission.length].max\n if separator\n allowable_endpoint = (node.content.rindex(separator, allowable_endpoint) || allowable_endpoint)\n end\n\n ::Nokogiri::XML::Text.new(node.content.slice(0, allowable_endpoint) + omission, node.parent)\n else\n node.dup\n end\n else # DocumentFragment or Element\n return node if node.inner_text.length <= length\n\n truncated_node = node.dup\n truncated_node.children.remove\n remaining_length = length\n\n node.children.each do |child|\n if remaining_length == 0\n truncated_node.add_child ::Nokogiri::XML::Text.new(omission, truncated_node)\n break\n elsif remaining_length < 0\n break\n end\n truncated_node.add_child HtmlAwareTruncation.truncate_nokogiri_node(child, length: remaining_length, omission: omission, separator: separator)\n # can end up less than 0 if the child was truncated to fit, that's\n # fine:\n remaining_length = remaining_length - child.inner_text.length\n\n end\n truncated_node\n end\n end",
"title": ""
},
{
"docid": "4d7e6c15b5859bef90e65df9e97c1691",
"score": "0.6390676",
"text": "def truncate(truncate_at, options = {})\n return dup unless length > truncate_at\n\n omission = options[:omission] || '...'\n length_with_room_for_omission = truncate_at - omission.length\n stop = \\\n if options[:separator]\n rindex(options[:separator], length_with_room_for_omission) || length_with_room_for_omission\n else\n length_with_room_for_omission\n end\n\n \"#{self[0, stop]}#{omission}\"\n end",
"title": ""
},
{
"docid": "58545baade3f6537e8a673f0894e7fa5",
"score": "0.6389617",
"text": "def truncate_html(len = 30, opts = {})\n opts = {:word_cut => true, :tail => ' ...'}.merge(opts)\n p = REXML::Parsers::PullParser.new(self)\n tags = []\n new_len = len\n results = ''\n while p.has_next? && new_len > 0\n p_e = p.pull\n case p_e.event_type\n when :start_element\n tags.push p_e[0]\n results << \"<#{tags.last} #{attrs_to_s(p_e[1])}>\"\n when :end_element\n results << \"</#{tags.pop}>\"\n when :text\n text = HTMLEntities.decode_entities(p_e[0])\n if (text.length > new_len) and !opts[:word_cut]\n piece = text[0 .. text.index(' ', new_len)]\n #piece = text.first(text.index(' ', new_len))\n else\n #piece = text.first(new_len)\n piece = text[0 .. new_len]\n end\n results << HTMLEntities.encode_entities(piece)\n new_len -= text.length\n else\n results << \"<!-- #{p_e.inspect} -->\"\n end\n end\n tags.reverse.each do |tag|\n results << \"</#{tag}>\"\n end\n results << opts[:tail]\n \n return results\n end",
"title": ""
},
{
"docid": "35b8b88f9fce7898a35e5795e27cae36",
"score": "0.6382366",
"text": "def truncate(truncate_at, options = {})\n return dup unless length > truncate_at\n\n omission = options[:omission] || '...'\n length_with_room_for_omission = truncate_at - omission.length\n stop =\n if options[:separator]\n rindex(options[:separator], length_with_room_for_omission) || length_with_room_for_omission\n else\n length_with_room_for_omission\n end\n\n \"#{self[0, stop]}#{omission}\"\n end",
"title": ""
},
{
"docid": "4d86870aa3ad361ca77942cecb5a1800",
"score": "0.63747966",
"text": "def truncate_paragraph(long_str, num_characters, truncated_indicator=\"...\")\n if long_str.length <= num_characters\n return long_str\n else \n return long_str.split(//).first(num_characters).join + \" \" + (truncated_indicator) \n end\n \n\nend",
"title": ""
},
{
"docid": "a36a1718e2f7a21b3d5fa4db9ed5d262",
"score": "0.63311255",
"text": "def truncate_hellip(n)\n length > n ? slice(0, n - 1) + '…' : self\n end",
"title": ""
},
{
"docid": "a974071f6cb3c9d89fa89659c6dd75f7",
"score": "0.6323134",
"text": "def truncate(text, options={})\n options[:length] ||= 30\n options[:omission] ||= \"...\"\n\n if text\n l = options[:length] - options[:omission].length\n chars = text\n stop = options[:separator] ? (chars.rindex(options[:separator], l) || l) : l\n (chars.length > options[:length] ? chars[0...stop] + options[:omission] : text).to_s\n end\n end",
"title": ""
},
{
"docid": "8d165204ac703ffe1550418d93cf5d0c",
"score": "0.6319585",
"text": "def truncate_html(input, len = 30, extension = \"...\")\n #output = input\n #output.gsub!(/<\\/p>\\s*<p>/iu, \"<br /><br />\")\n #output = sanitize(input, :tags => %w(br h1 h2 h3 h4 h5 h6 ul ol li))\n #output.gsub!(/<br.*?>/, \"\\v\")\n\n # We need to be able to call .s on the input, but not on the extension, so we\n # have to use a modified version of truncate() instead of truncate() itself.\n # output = truncate(input, :length => len, :omission => extension)\n l = len - extension.size\n # Temporarily removing .s, as it takes a while to run on long strings\n #output = (chars.length > len ? chars[0...l].s + extension : input).to_s\n #output = input.size > len ? input[0...l] + extension : input\n\n output = strip_tags(input)\n output.strip!\n #output.gsub!(/\\v/, \"<br />\")\n return (output.size < len ? output : (output[0...l] + extension)).html_safe\n end",
"title": ""
},
{
"docid": "fc6f296a3e94fa3bce4cb0a8bf44cf7d",
"score": "0.6310342",
"text": "def truncate_html(text, len = 30, at_end = ' ...')\n p = REXML::Parsers::PullParser.new((text.presence || '<p> </p>').gsub(/[\\r\\n\\t]/, ''))\n tags = []\n new_len = len\n results = ''\n while p.has_next? && new_len > 0\n p_e = p.pull\n case p_e.event_type\n when :start_element\n tags.push p_e[0]\n results << \"<#{tags.last}#{attrs_to_s(p_e[1])}>\"\n when :end_element\n results << \"</#{tags.pop}>\"\n when :text\n results << p_e[0][0..new_len]\n new_len -= p_e[0].length\n else\n results << \"<!-- #{p_e.inspect} -->\"\n end\n end\n if at_end && (sanitize(text).try(:length).to_i) > len\n results << at_end\n end\n tags.reverse.each do |tag|\n results << \"</#{tag}>\"\n end\n raw(results)\n end",
"title": ""
},
{
"docid": "79678d0281e7e56f4e7afacbcceb0337",
"score": "0.63085043",
"text": "def truncated_content_tag(element, text, opts = {})\n return '' if text.blank?\n\n length = opts.delete(:length) || 25\n opts.reverse_merge!(:title => text, :alt => :text)\n content_tag element, truncate(text, :length => length), opts\n end",
"title": ""
},
{
"docid": "4836059976a1ce7c11cfcb976d08d32d",
"score": "0.63054293",
"text": "def truncate( length ) File.truncate( expand_tilde, length ) end",
"title": ""
},
{
"docid": "be7602c0e9b0fd1a1a737ed4024807af",
"score": "0.6303122",
"text": "def truncate_paragraph(long_str, num_characters, truncated_indicator=\"...\")\n\n if long_str.length > num_characters\n return long_str[0...num_characters] + \" \" + truncated_indicator\n else \n return long_str\n end\n\nend",
"title": ""
},
{
"docid": "40a91605d91838a8d4f942ce8aa3f067",
"score": "0.6289551",
"text": "def truncate_html(input, len = 30, extension = \"...\")\n output = input\n output.gsub!(/<\\/p>\\s*<p>/is, \"<br /><br />\")\n output = sanitize(input, :tags => %w(br h1 h2 h3 h4 h5 h6 ul ol li))\n output.gsub!(/<br.*?>/, \"\\v\")\n if output.length < len\n return input\n end\n \n # We need to be able to call .s on the input, but not on the extension, so we\n # have to use a modified version of truncate() instead of truncate() itself.\n # output = truncate(input, :length => len, :omission => extension)\n l = len - extension.mb_chars.length\n chars = input.mb_chars\n # Temporarily removing .s, as it takes a while to run on long strings\n #output = (chars.length > len ? chars[0...l].s + extension : input).to_s\n output = (chars.length > len ? chars[0...l] + extension : input).to_s\n \n output.strip!\n output.gsub!(/\\v/, \"<br />\")\n output.html_safe\n end",
"title": ""
},
{
"docid": "fae038b176f2c78d0f846e0380804c97",
"score": "0.62738043",
"text": "def smart_truncate(len = 30, ending = '...')\n len = Math.max(len, 5)\n return self if self.length <= len\n s = self[0...(len-2)].reverse\n bits = s.split(/[\\s\\-,]/,2)\n s = bits.length == 2 ? bits[1] : bits[0]\n s.reverse + ending\n end",
"title": ""
},
{
"docid": "647955e5c1c50ba835252d286f722db9",
"score": "0.6273351",
"text": "def truncate_well_formed_html(input, len = 30, extension = \"...\")\n def attrs_to_s(attrs)\n return '' if attrs.empty?\n attrs.to_a.map { |attr| %{#{attr[0]}=\"#{attr[1]}\"} }.join(' ')\n end\n\n p = REXML::Parsers::PullParser.new(input)\n tags = []\n new_len = len\n results = ''\n while p.has_next? && new_len > 0\n p_e = p.pull\n case p_e.event_type\n when :start_element\n tags.push p_e[0]\n results << \"<#{tags.last} #{attrs_to_s(p_e[1])}>\"\n when :end_element\n results << \"</#{tags.pop}>\"\n when :text\n results << p_e[0].first(new_len)\n new_len -= p_e[0].length\n end\n end\n\n tags.reverse.each do |tag|\n results << \"</#{tag}>\"\n end\n\n (results.to_s + (input.length > len ? extension : '')).html_safe\n end",
"title": ""
},
{
"docid": "566cfe81b56f6908ec4feb396eb497c9",
"score": "0.62619936",
"text": "def trunc_em\n self.the_url = self.the_url.truncate 200\n end",
"title": ""
},
{
"docid": "a5e193e741976ec441e1023666078278",
"score": "0.6249057",
"text": "def truncate(text, length = 100, truncate_string = '...')\n l = length - truncate_string.length\n (text.length > length ? text[0...l] + truncate_string : text).to_s\n end",
"title": ""
},
{
"docid": "c76d0d2a4083263733c7a74e814b4bde",
"score": "0.6247416",
"text": "def truncate_html(max)\n result = \"\"\n # make str mutable because it will be modified in place with sub!\n str = String.new(self)\n opens = []\n while str != \"\"\n # Self-closing tag.\n if str.sub!(%r{^<(\\w+)[^<>]*/ *>}, \"\")\n result += Regexp.last_match(0)\n # Opening tag.\n elsif str.sub!(/^<(\\w+)[^<>]*>/, \"\")\n result += Regexp.last_match(0)\n opens << Regexp.last_match(1)\n # Closing tag -- just assume tags are nested properly.\n elsif str.sub!(%r{^< */ *(\\w+)[^<>]*>}, \"\")\n result += Regexp.last_match(0)\n opens.pop\n # Normal text.\n elsif str.sub!(/^[^<>]+/, \"\")\n part = Regexp.last_match(0)\n if part.length > max\n result += part[0, max - 1].to_s + \"...\"\n break\n elsif part\n max -= part.length\n result += part\n end\n # All bets are off if not well-formatted HTML.\n else\n break\n end\n end\n result += opens.reverse.map { |x| \"</#{x}>\" }.join\n # Disable cop; we need `html_safe` to prevent Rails from adding escaping\n result.html_safe # rubocop:disable Rails/OutputSafety\n end",
"title": ""
},
{
"docid": "4b408c5fcd262676a2d23c4935e93958",
"score": "0.6231616",
"text": "def teaser(text, options = {})\n options.reverse_merge!(:length => 150, :omission => '...')\n format = options.delete(:format) if options[:format]\n truncate(strip_tags(to_html(text.to_s, format)).strip, options)\n end",
"title": ""
},
{
"docid": "0d14bb6505b733d558bffe61c15f66ec",
"score": "0.6225387",
"text": "def truncate_well_formed_html(input, len = 30, extension = \"...\")\n def attrs_to_s(attrs)\n return '' if attrs.empty?\n attrs.to_a.map { |attr| %{#{attr[0]}=\"#{attr[1]}\"} }.join(' ')\n end\n\n p = REXML::Parsers::PullParser.new(input)\n tags = []\n new_len = len\n results = ''\n while p.has_next? && new_len > 0\n p_e = p.pull\n case p_e.event_type\n when :start_element\n tags.push p_e[0]\n results << \"<#{tags.last} #{attrs_to_s(p_e[1])}>\"\n when :end_element\n results << \"</#{tags.pop}>\"\n when :text\n results << p_e[0].first(new_len)\n new_len -= p_e[0].length\n end\n end\n\n tags.reverse.each do |tag|\n results << \"</#{tag}>\"\n end\n\n (results.to_s + (input.length > len ? extension : '')).html_safe\n end",
"title": ""
},
{
"docid": "2b506f662885bcc99e24e0bb8998bd31",
"score": "0.62139535",
"text": "def trim(len)\r\n return self if self.length<len\r\n data = self.dup[0,len]+'…'\r\n data\r\n end",
"title": ""
},
{
"docid": "0ea5bd46d6cc24ff7e26d12332d1c056",
"score": "0.62119097",
"text": "def render_truncated_description(args)\n truncated_output = String.new\n content_tag :div, class: 'truncate-description' do\n description = args[:value].first\n button = \"<span class='view-more' href>Read More <div class='down-arrow'>»</div></span></br>\"\n truncated_output << \"<div class='description'>#{description}</div>#{button}</br>\"\n # return truncated_output.html_safe\n return description\n end\n end",
"title": ""
},
{
"docid": "72942d9b58ea6ff5f217b2480037af32",
"score": "0.62003314",
"text": "def truncate(arg0)\n end",
"title": ""
},
{
"docid": "4e5bcb3b85b116b9f60b112dd583c1e1",
"score": "0.61945105",
"text": "def truncate_attributes\n self.title = truncate(title, length: 1000)\n self.site_name = truncate(site_name, length: 200)\n self\n end",
"title": ""
},
{
"docid": "1d386147c16fe9c97615d042ef748865",
"score": "0.619376",
"text": "def truncate(*args)\n i=args[0]\n limit=args[1].to_i\n begin\n if i.split(\"\").size > limit\n k=0\n s=''\n for j in i.split(\"\")\n if k.to_i<limit\n s=s+j\n end\n k+=1\n end\n return s=s+'..'\n else\n return i\n end\n rescue Exception=>e\n puts \"DEBUG :: ERROR :: AdminXMLBuilder Component > truncate Action. Exception is #{e.to_s}\"\n return i\n end\n end",
"title": ""
},
{
"docid": "efda48eda2c31d81143ae1987d856dc3",
"score": "0.61900795",
"text": "def truncate(length, options = {})\n text = self.dup\n options[:omission] ||= \"...\"\n\n length_with_room_for_omission = length - options[:omission].mb_chars.length\n chars = text.mb_chars\n stop = options[:separator] ?\n (chars.rindex(options[:separator].mb_chars, length_with_room_for_omission) || length_with_room_for_omission) : length_with_room_for_omission\n\n (chars.length > length ? chars[0...stop] + options[:omission] : text).to_s\n end",
"title": ""
},
{
"docid": "2b27c36408bdba926339d0bb56611e14",
"score": "0.6188613",
"text": "def truncate\n push pop.truncate\n end",
"title": ""
},
{
"docid": "6b2ac0cdcb75a2ebfc8299129b30c994",
"score": "0.61841345",
"text": "def truncate_from_end(text)\n return text if text.blank? || text.size <= 20\n \n \"...#{text[-20, 20]}\"\n end",
"title": ""
},
{
"docid": "6b2ac0cdcb75a2ebfc8299129b30c994",
"score": "0.61841345",
"text": "def truncate_from_end(text)\n return text if text.blank? || text.size <= 20\n \n \"...#{text[-20, 20]}\"\n end",
"title": ""
},
{
"docid": "6b2670cffa89aa26000dbe7dfb3f72f9",
"score": "0.61799765",
"text": "def short_notes; RubyPants.new(Scrub.sanitize_and_strip(notes).truncate(SHORT_LENGTH, separator: /\\s/)).to_html.html_safe; end",
"title": ""
},
{
"docid": "84643e3ff55cdd8cc6c35e76942b437b",
"score": "0.6165889",
"text": "def driver\n paragraph = ParagraphTruncate.new\n puts \"This is going to be the sentence that I'll truncate.\".truncate(40, omission: \"... (continued)\")\n end",
"title": ""
},
{
"docid": "7783a1d80ce60243fb95880188ff96ae",
"score": "0.61601055",
"text": "def truncate(s, truncate_at, options = {})\n return s unless s.length > truncate_at\n omission = options[:omission] || '...'\n with_extra_room = truncate_at - omission.length\n stop = \\\n if options[:separator]\n rindex(options[:separator], with_extra_room) || with_extra_room\n else\n with_extra_room\n end\n \"#{s[0, stop]}#{omission}\"\n end",
"title": ""
},
{
"docid": "67d951d58f986eb5f8ae1b71f2c73840",
"score": "0.6158611",
"text": "def truncate(s, truncate_at, options = {})\r\n return s unless s.length > truncate_at\r\n omission = options[:omission] || '...'\r\n with_extra_room = truncate_at - omission.length\r\n stop = \\\r\n if options[:separator]\r\n rindex(options[:separator], with_extra_room) || with_extra_room\r\n else\r\n with_extra_room\r\n end\r\n \"#{s[0, stop]}#{omission}\"\r\n end",
"title": ""
},
{
"docid": "75224181af7d544c71eb6347ca59f0f5",
"score": "0.6155657",
"text": "def truncate\n title.chomp.slice(0...(width - 4))\n end",
"title": ""
},
{
"docid": "9fb1e0811d2bb183b53d014e4f33bb79",
"score": "0.61347896",
"text": "def truncate(truncate_at, options = {})\n return dup unless length > truncate_at\n\n options[:omission] ||= '...'\n length_with_room_for_omission = truncate_at - options[:omission].length\n stop = \\\n if options[:separator]\n rindex(options[:separator], length_with_room_for_omission) || length_with_room_for_omission\n else\n length_with_room_for_omission\n end\n\n self[0...stop] + options[:omission]\n end",
"title": ""
},
{
"docid": "04268621f984add339e1edeb80f72cad",
"score": "0.6127874",
"text": "def to_s\n (@text.size > @length_to_display ? @text[0, @length_to_display - 4] + \"...\" : @text).gsub(\"\\n\",\" \")\n end",
"title": ""
},
{
"docid": "6d5ed5077583a70a5d76d8570c274b23",
"score": "0.6120639",
"text": "def test_truncate\n name = 'Broadmark'\n truncated = truncate(name, 5)\n assert_equal('Br...', truncated, 'truncated Broadmark')\n\n truncated = truncate(name, 9)\n assert_equal('Broadmark', truncated, 'truncated Broadmark')\n\n truncated = truncate(name, 8)\n assert_equal('Broad...', truncated, 'truncated Broadmark')\n end",
"title": ""
},
{
"docid": "97cd20214f93a75852593889b0487e85",
"score": "0.60928035",
"text": "def truncate(input, length = T.unsafe(nil), truncate_string = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "1db2dc66ea51f0589d611076631bd816",
"score": "0.60892725",
"text": "def truncate(integer)\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "3e08f6ab9b5cdfe0e1afcba684b044de",
"score": "0.60805285",
"text": "def smart_truncate(opts = {})\n opts = {:words => 12}.merge(opts)\n if opts[:sentences]\n return self.split(/\\.(\\s|$)+/).reject{ |s| s.strip.empty? }[0, opts[:sentences]].map{|s| s.strip}.join('. ') + '...'\n end\n a = self.split(/\\s/) # or /[ ]+/ to only split on spaces\n n = opts[:words]\n a[0...n].join(' ') + (a.size > n ? '...' : '')\n end",
"title": ""
},
{
"docid": "0e8501bce2d8b26e607aa75d394f7955",
"score": "0.6076092",
"text": "def awesome_truncate(text, length = 30, truncate_string = \"...\")\n return if text.nil?\n l = length - truncate_string.mb_chars.length\n text.mb_chars.length > length ? text[/\\A.{#{l}}\\w*\\;?/m][/.*[\\w\\;]/m] + truncate_string : text\n end",
"title": ""
},
{
"docid": "0e8501bce2d8b26e607aa75d394f7955",
"score": "0.6076092",
"text": "def awesome_truncate(text, length = 30, truncate_string = \"...\")\n return if text.nil?\n l = length - truncate_string.mb_chars.length\n text.mb_chars.length > length ? text[/\\A.{#{l}}\\w*\\;?/m][/.*[\\w\\;]/m] + truncate_string : text\n end",
"title": ""
},
{
"docid": "0e8501bce2d8b26e607aa75d394f7955",
"score": "0.6076092",
"text": "def awesome_truncate(text, length = 30, truncate_string = \"...\")\n return if text.nil?\n l = length - truncate_string.mb_chars.length\n text.mb_chars.length > length ? text[/\\A.{#{l}}\\w*\\;?/m][/.*[\\w\\;]/m] + truncate_string : text\n end",
"title": ""
},
{
"docid": "03af429933291a41ca77f5b238ea0358",
"score": "0.6062017",
"text": "def awesome_truncate(text, length = 30, truncate_string = \"...\")\n return if text.nil?\n l = length - truncate_string.mb_chars.length\n text.mb_chars.length > length ? text[/\\A.{#{l}}\\w*\\;?/m][/.*[\\w\\;]/m] + truncate_string : text\nend",
"title": ""
},
{
"docid": "6a44769c5a952d4946a4b5be74bbf935",
"score": "0.60326236",
"text": "def truncate(text, length = 30, truncate_string = \"...\")\n if text.nil? then return end\n l = length - truncate_string.chars.length\n (text.chars.length > length ? text.chars[0...l] + truncate_string : text).to_s\n end",
"title": ""
},
{
"docid": "64ba23ad22203a84fafad966f6c55212",
"score": "0.60203075",
"text": "def truncate(max_length)\n output = deparse(@tree)\n\n # Early exit if we're already below the max length\n return output if output.size <= max_length\n\n truncations = find_possible_truncations\n\n # Truncate the deepest possible truncation that is the longest first\n truncations.sort_by! { |t| [-t.location.size, -t.length] }\n\n tree = deep_dup(@tree)\n truncations.each do |truncation|\n next if truncation.length < 3\n\n find_tree_location(tree, truncation.location) do |expr, k|\n expr[k] = { A_TRUNCATED => nil }\n expr[k] = [expr[k]] if truncation.is_array\n end\n\n output = deparse(tree)\n return output if output.size <= max_length\n end\n\n # We couldn't do a proper smart truncation, so we need a hard cut-off\n output[0..max_length - 4] + '...'\n end",
"title": ""
},
{
"docid": "bc77b47cb234630d99fa0eda4c48b47f",
"score": "0.6019019",
"text": "def truncate(text, length = 30, truncate_string = \"...\")\n return \"\" if text.nil?\n l = length - truncate_string.size\n text.size > length ? (text[0...l] + truncate_string).to_s : text\n end",
"title": ""
},
{
"docid": "d463961220507b038cfff5dc49e9d7ef",
"score": "0.6009272",
"text": "def truncate(str, width)\n return str if str.bytesize <= width\n\n ellipses = '...'\n truncated_width = width - 3 # leave room for elipses\n\n # Not handling UTF-8 at the moment\n str.slice(0, truncated_width) + ellipses\n end",
"title": ""
},
{
"docid": "2494cbe59f9c80703ccd163addefb064",
"score": "0.59819317",
"text": "def truncate\n Quantity.new(@value.truncate, @unit)\n end",
"title": ""
},
{
"docid": "f42eb8ee309f1eb6ba2bdebd7005086e",
"score": "0.59612024",
"text": "def truncate_formatted_filename f, unformatted_len, wid\n excess = unformatted_len - wid\n\n f = case @truncate_from\n\n when :right\n # FIXME: 2019-04-23 - do we need the control code at end ??\n f[0..wid - 3] + '$ '\n\n when :center\n\n # from central point calculate how much to remove in both directions\n center = unformatted_len / 2\n excess_half = excess / 2\n point = center + excess_half\n point1 = point - excess\n\n # remove text between point1 and point\n f[0..(point1 - 1)] + '$' + f[point + 2..-1] + ' '\n\n when :left\n\n # NOTE: we cannot remove the hint\n # for single hints we need to add extra space\n # there could be escape codes of varying length\n sindex = f.index(' ') || f.index('+')\n # 4 = 2 for literals, 2 to get ahead of sindex+1\n # FIXME crashing here, maybe there was a plus sign in place of space\n f[0..sindex + 0] + '<' + f[sindex + 3 + excess..-1] + ' '\n end\n return f\nend",
"title": ""
},
{
"docid": "0b2d2d212b228c74a7e782b3898f698c",
"score": "0.5953798",
"text": "def shortened_tweet_truncator(tweet_one)\n if tweet_one.length > 140\n tweet_one[0..139] \n else\n tweet_one\n end\nend",
"title": ""
},
{
"docid": "814b1d58d754dce93588083707c5b74d",
"score": "0.59512085",
"text": "def truncate(input, length)\n if input.length > length && input[0..(length - 1)] =~ /(.+)\\b.+$/im\n $1.strip + '...'\n else\n input\n end\n end",
"title": ""
},
{
"docid": "25b98f8fbe1b067ebf1fd215018789c4",
"score": "0.59484583",
"text": "def shortened_tweet_truncator(tweet)\n shortened_tweet = selective_tweet_shortener(tweet)\n if tweet.length < 140 \n tweet\n elsif\n shortened_tweet.length > 140 \n shortened_tweet[0...140-3] + \"...\" \n else\n shortened_tweet\nend\nend",
"title": ""
},
{
"docid": "62658fc6fefe8df4e14fbdaab630a8a0",
"score": "0.59267306",
"text": "def shortened_tweet_truncator(tweet_string)\n if tweet_string.length > 140\n tweet_string[0..136] + \"...\"\n else\n tweet_string\n end\nend",
"title": ""
},
{
"docid": "8f64602b1cd33e896a43dab6a9ffb075",
"score": "0.5921003",
"text": "def truncate(text, length = 30, truncate_string = \"...\")\n if text\n l = length - truncate_string.chars.length\n chars = text.chars\n #$log.info(chars[0..10])\n (chars.length > length ) ?\n (chars[0...l] + truncate_string.chars).join('').to_s :\n text\n end\n end",
"title": ""
},
{
"docid": "ac5db3d3b6d3977d50eb6ecfcb8154b3",
"score": "0.59126747",
"text": "def summarize(length = 100, elipsis = true)\n return truncate(length)\n end",
"title": ""
},
{
"docid": "6742bf42a4953ef03f7aa14487f15eeb",
"score": "0.5912029",
"text": "def truncate_without_splitting_words(text, length = 50, ellipsis = true)\n truncated_result = ''\n remaining_length = length\n stop = false\n truncated = false\n # lines\n text.split(\"\\n\").each do |l|\n # words\n l.split(' ').each do |w|\n # If we're going to go over the length, and we've not already\n if (remaining_length - w.length) <= 0 && !stop\n truncated = true\n stop = true\n # Decide if adding or leaving out the last word puts us closer to the desired length\n if (remaining_length - w.length).abs < remaining_length.abs\n truncated_result += (w + ' ')\n end\n elsif !stop\n truncated_result += (w + ' ')\n remaining_length -= (w.length + 1)\n end\n end\n truncated_result += \"\\n\"\n end\n # Need some kind of whitespace before elipses or auto-link breaks\n html = truncated_result.strip + (truncated && ellipsis ? \"\\n...\" : '')\n html.html_safe\n end",
"title": ""
},
{
"docid": "e227e6027793d003cf041c3fab35923d",
"score": "0.5907641",
"text": "def soft_truncate(string, length, soft_limit=nil)\n return '' unless string\n string.strip!\n return string if string.length <= length\n firstpart = string[0..(length-1)]\n afterpart = string[length..-1]\n does_not_start_with_whitespace = afterpart[/^\\S/]\n afterpart.strip!\n return firstpart if afterpart.empty?\n return firstpart << ' ...' unless soft_limit && does_not_start_with_whitespace\n afterword = afterpart[/(\\S+)/][0..(soft_limit-1)]\n afterword << ' ...' if afterpart.length > afterword.length\n firstpart << afterword\n end",
"title": ""
},
{
"docid": "fd0eb06a6705d5f768041814d1c71868",
"score": "0.5904798",
"text": "def truncate_inspect(object, opts = {})\n max_length = opts[:to] || 80\n full = object.inspect\n\n if full.length > max_length\n available_length = max_length - 5 # to account for the \" ... \"\n left_cutoff = available_length * 2 / 3\n right_cutoff = available_length - left_cutoff - 1\n\n \"#{full[0..left_cutoff]} ... #{full[-right_cutoff..-1]}\"\n else\n full\n end\n end",
"title": ""
},
{
"docid": "0197aac9ee6f1130dbbbe66e196dcccf",
"score": "0.5890701",
"text": "def shortened_tweet_truncator(tweet)\n selective_tweet_shortener(tweet)\n if tweet.length >= 140\n tweet[0...137].concat(\"...\") #(...) is 3 characters!\n else\n tweet if tweet.length < 140\n end\nend",
"title": ""
},
{
"docid": "b62da5c74f04c391d512590b11df917d",
"score": "0.58890355",
"text": "def shortened_tweet_truncator(tweet) \n if word_substitutor(tweet).length > 140 \n word_substitutor(tweet)[0...137] + \"...\"\n else \n tweet\n end \nend",
"title": ""
},
{
"docid": "c7cd892c905d549286216f374173d1e8",
"score": "0.58866894",
"text": "def shortened_tweet_truncator(tweet)\n\n if tweet.length <= 140\n tweet\n else\n word_substituter(tweet)[0..136] + \"...\"\n end\nend",
"title": ""
},
{
"docid": "9d008480103b1ac6a4dae862dc225126",
"score": "0.5876099",
"text": "def shortened_tweet_truncator(tweet)\n if word_substituter(tweet).length <= 140\n word_substituter(tweet)\n else\n word_substituter(tweet)[0..136] << \"...\" \n end\nend",
"title": ""
},
{
"docid": "d1aa207a20aec1b8a96148e6d509cb35",
"score": "0.5873674",
"text": "def shortened_tweet_truncator(tweet)\n if word_substituter(tweet).length > 140\n word_substituter(tweet)[0..136] + '...'\n else\n tweet\n end\nend",
"title": ""
},
{
"docid": "4055cafe500127cae9185ab233bc247b",
"score": "0.58679444",
"text": "def chopped_valve_note\n if !self.valve_note.blank? && self.valve_note.length > 200\n return self.valve_note[0..200] + \"...\"\n end\n return self.valve_note\n end",
"title": ""
},
{
"docid": "e1e210aa0f3ac252cf04157853bf986a",
"score": "0.5864581",
"text": "def test_truncate\n name = \"Broadmark\"\n truncated = truncate name, :length => 5\n assert_equal \"Br...\", truncated, \"truncated Broadmark\"\n\n truncated = truncate name, :length => 9\n assert_equal \"Broadmark\", truncated, \"truncated Broadmark\"\n\n truncated = truncate name, :length => 8\n assert_equal \"Broad...\", truncated, \"truncated Broadmark\"\n end",
"title": ""
},
{
"docid": "a9647058bfdded0e233be9e00fb64c81",
"score": "0.5855755",
"text": "def notebooktext_short\n truncate_text_words(self.notebooktext, 100)\n end",
"title": ""
},
{
"docid": "547108436de13908acb3114ad65ecbe9",
"score": "0.58481604",
"text": "def pruned_width\n width - ellipsis.size\n end",
"title": ""
},
{
"docid": "5dd76777dba67e518ac3796c33dd7ecb",
"score": "0.5840188",
"text": "def center_truncate(length, ellipsis = '...')\n ellipsis = MyString.new(ellipsis)\n if self.my_size <= length\n return self\n else\n left = self.my_left((length / 2.0).ceil - (ellipsis.my_size / 2.0).floor )\n right = self.my_right((length / 2.0).floor - (ellipsis.my_size / 2.0).ceil )\n return MyString.new(left + ellipsis + right)\n end\n end",
"title": ""
},
{
"docid": "faedb4af26b8b6e094b484fa975f637c",
"score": "0.5840139",
"text": "def shortened_tweet_truncator(tweet)\n shortened_tweet = selective_tweet_shortener(tweet)\n tweet_w_ellipses = \"\"\n char_array = []\n\n if shortened_tweet.length > 140\n shortened_tweet = shortened_tweet[0..136] + \"...\"\n else\n return shortened_tweet\n end\nend",
"title": ""
},
{
"docid": "616b90e65085dc95906602c4fa1b4c77",
"score": "0.58369404",
"text": "def truncate text\n length = text.length\n characters = @characters\n @characters += length\n\n return text if @characters < @character_limit\n\n remaining = @character_limit - characters\n\n text =~ /\\A(.{#{remaining},}?)(\\s|$)/m # TODO word-break instead of \\s?\n\n $1\n end",
"title": ""
},
{
"docid": "1e7ba731db9ff6e69cdd327a0316957d",
"score": "0.5832623",
"text": "def short_text_display content, path\n text = ((content.length > 90) ? HTML_Truncator.truncate(content, 3) : content )\n ((content.length > text.length) ? (text + \"<a href='#{path}' class='btn-link'> (more) </a>\") : text).html_safe\n end",
"title": ""
},
{
"docid": "580d55825fb9deed8e6b39674b687955",
"score": "0.5821233",
"text": "def truncate(max)\n length = Math.min(max, length)\n self\n end",
"title": ""
},
{
"docid": "230257d3f2ce84252df7091069083d6f",
"score": "0.5815284",
"text": "def truncate( text, num_words = 6, truncate_string = \"...\" )\n if text.nil? then return end\n arr = text.split( ' ' )\n arr.length > num_words ? arr[ 0...num_words ].join( ' ' ) + truncate_string : text\nend",
"title": ""
},
{
"docid": "5c73db6b79068f779f007eb7d2b8b81d",
"score": "0.5814845",
"text": "def draw_trimmed_str(str)\n s = str.split(//)\n if s.size > Edgarj::LIST_TEXT_MAX_LEN\n s = s[0..Edgarj::LIST_TEXT_MAX_LEN] << '...'\n end\n s.join('')\n end",
"title": ""
}
] |
8bcca5053ac1bac299901863ff79ae57
|
Triangulate whole file and save to original file
|
[
{
"docid": "adeca48cad4cdea6e3c72bdda05dd71e",
"score": "0.0",
"text": "def post_triangulate_original(name, opts = {})\n @api_client.request_token_if_needed\n data, _status_code, _headers = post_triangulate_original_with_http_info(name, opts)\n rescue ApiError => error\n if error.code == 401\n @api_client.request_token_if_needed\n data, _status_code, _headers = post_triangulate_original_with_http_info(name, opts)\n else\n raise\n end\n return data\n end",
"title": ""
}
] |
[
{
"docid": "d8bc598e7935ea6aa47903a86ec89077",
"score": "0.6342562",
"text": "def to_disk\n @file.close\n tmp = open(@file.path)\n final = Tempfile.new('codestrap')\n strip_modeline(tmp, final)\n\n tmp.close\n File.unlink(@file.path)\n final.close(unlink_now = false)\n\n FileUtils.mv final.path, self.dst\n end",
"title": ""
},
{
"docid": "da43d32f0c151e21f620ccc26ce06787",
"score": "0.61470485",
"text": "def reload_from_file\n @previous = self.to_s\n replace file.read\n end",
"title": ""
},
{
"docid": "ce1509b532027f0c0f77e250333b19b5",
"score": "0.6030886",
"text": "def reversion_file(name)\n lines = reversion(name)\n tmp_name = name + \"_tmp\"\n mv name, tmp_name\n begin\n File.open(name, \"w\") { |f| lines.each { |line| f.write line } }\n rescue\n mv tmp_name, name\n ensure\n rm tmp_name\n end\n end",
"title": ""
},
{
"docid": "22d8b64fb1b518936d8925b1a89d4d87",
"score": "0.6028923",
"text": "def replace_recipe_original(file_name)\n file_content_array = open_file(file_name)\n\n @title = file_content_array[0].chomp\n r = Recipe.find_by_name(@title)\n s = IO.read(file_name)\n r.original = s\n r.save! \nend",
"title": ""
},
{
"docid": "533a0bac576b2b27f74aabba303ddf1c",
"score": "0.59870476",
"text": "def prepare_original_file\n if(@file_data_to_write.is_a?(DataPath))\n [@file_data_to_write, false]\n else\n temp_file = File.join(Dir.tmpdir, \"original_#{random_tempfile_filename}\")\n # write the original file\n File.open(temp_file, 'w') do |original_file|\n if(@file_data_to_write.respond_to?(:read))\n original_file << @file_data_to_write.read\n else\n original_file << @file_data_to_write\n end\n end\n \n [temp_file, true]\n end\n end",
"title": ""
},
{
"docid": "533a0bac576b2b27f74aabba303ddf1c",
"score": "0.59870476",
"text": "def prepare_original_file\n if(@file_data_to_write.is_a?(DataPath))\n [@file_data_to_write, false]\n else\n temp_file = File.join(Dir.tmpdir, \"original_#{random_tempfile_filename}\")\n # write the original file\n File.open(temp_file, 'w') do |original_file|\n if(@file_data_to_write.respond_to?(:read))\n original_file << @file_data_to_write.read\n else\n original_file << @file_data_to_write\n end\n end\n \n [temp_file, true]\n end\n end",
"title": ""
},
{
"docid": "69f0873a480660c82bb5ef156b7bd3fe",
"score": "0.5986212",
"text": "def save\n File.open(\"file.tmp\", \"w\") {|f| f.write(@lines.join(\"\"))}\n FileUtils.mv(\"file.tmp\", patchor_file)\n end",
"title": ""
},
{
"docid": "6a8c34397d130744f7c13ef5fef14bfe",
"score": "0.59315145",
"text": "def replace_old_file\n \n\t\t# Close output file\n\t\t@out_file.close\n\n\t\t# Delete old file, rename new file to take its place\n\t\tFile.delete(@input_file)\n\t\tFile.rename(\"#{@input_file}.new\", \"#{@input_file}\")\t\n\tend",
"title": ""
},
{
"docid": "8bc475084f5ccfebedd83b1fe09612d1",
"score": "0.5929031",
"text": "def undo \n if(@hasExecuted == true and (not File::exist?(@fileName)))\n File::open(@fileName, \"w+\") { |f| \n for line in contents\n f.puts(line)\n end }\n @hasExecuted=false\n end\n end",
"title": ""
},
{
"docid": "d77cc4300cd2ba72639076c8eb26f465",
"score": "0.58672935",
"text": "def clipfix_file(filename)\n output = File.open(\"#{filename}.new\", 'w')\n input = File.open(filename)\n \n input.each do |line|\n # Assumes each sytle property begins and ends on the same line\n # which seems to be the case for Inkscape.\n output.puts(line.gsub(/style=\"(.*)clip-path:(.+?);(.*)\"/, \n 'clip-path=\"\\2\" style=\"\\1\\3\"'))\n end\n \n input.close()\n output.close()\n \n #File.move(filename, \"#{filename}.old\")\n File.move(\"#{filename}.new\", filename)\nend",
"title": ""
},
{
"docid": "9f8ab18fac71b0e3df70c2711eb53e48",
"score": "0.58504695",
"text": "def revertfile (content)\n if content.respond_to? \"each\" and content.respond_to? \"reverse\"\n content.reverse.each do |line|\n puts line.chomp.reverse\n end\n end\nend",
"title": ""
},
{
"docid": "33bd73e61a2929f1a98085081e310bda",
"score": "0.58213556",
"text": "def reverting; end",
"title": ""
},
{
"docid": "33bd73e61a2929f1a98085081e310bda",
"score": "0.58213556",
"text": "def reverting; end",
"title": ""
},
{
"docid": "49f3a41e7226df00ee4405c9ce7ad9ac",
"score": "0.581079",
"text": "def normalize(filename); end",
"title": ""
},
{
"docid": "0f6689314491be5ad503ab5fc7d65e02",
"score": "0.5792851",
"text": "def undo\r\n File.delete(@NewFilePath) if File.exist?(@NewFilePath)\r\n end",
"title": ""
},
{
"docid": "c5c2f3bca2265e59859d9bd8f2a79590",
"score": "0.5775195",
"text": "def normalize(file)\n unless file.is_a?(File) || file.is_a?(Tempfile)\n fail Error, \"expected File or Tempfile object as derivation result, got #{file.inspect}\"\n end\n\n file.open if file.is_a?(Tempfile) # refresh file descriptor\n file.binmode # ensure binary mode\n file\n end",
"title": ""
},
{
"docid": "b28a7169753c5014bedca472a5361495",
"score": "0.5755951",
"text": "def copy_temp_to_original\n\n require 'csv' \n File.truncate('customers_report.csv', 0)\n\n filename4 = File.open('tempo_report.csv').read\n filename5 = 'customers_report.csv'\n file_name5 = open(filename5,'a')\n\n filename4.each_line do |line|\n file_name5 << line\n end\n file_name5.close\n end",
"title": ""
},
{
"docid": "8364b9111188fdc38d545e967143347b",
"score": "0.5685558",
"text": "def undo\r\n File.delete(@FilePath) if File.exist?(@FilePath)\r\n end",
"title": ""
},
{
"docid": "fd0b79a8e9632c1865ceabbd528811a2",
"score": "0.5677389",
"text": "def reprocess!\n new_original = Tempfile.new(\"paperclip-reprocess-#{instance.id}-\")\n new_original.binmode\n old_original = to_file(:original)\n new_original.write( old_original.read )\n new_original.rewind\n @queued_for_write = { :original => new_original }\n post_process\n old_original.close if old_original.respond_to?(:close)\n save\n end",
"title": ""
},
{
"docid": "8bc768eeb963037d891b37fa98b29c25",
"score": "0.5677062",
"text": "def replace_file\n @temp_file.close\n # Moves the tempfile with the edits, into the path of the original file,\n # effectively replacing the original\n FileUtils.mv(@temp_file.path, @file_name)\n end",
"title": ""
},
{
"docid": "6e9824907db7c5ac78739dc020a6eeee",
"score": "0.5675588",
"text": "def re_encrypt_file(file_name)\n temp_file_name = \"__re_encrypting_#{file_name}\"\n SymmetricEncryption::Reader.open(file_name) do |source|\n SymmetricEncryption::Writer.encrypt(source: source, target: temp_file_name, compress: true, version: version)\n end\n File.delete(file_name)\n File.rename(temp_file_name, file_name)\n rescue StandardError\n File.delete(temp_file_name) if temp_file_name && File.exist?(temp_file_name)\n raise\n end",
"title": ""
},
{
"docid": "aeac7d22af45c3358c85ffb74025dba2",
"score": "0.5654809",
"text": "def rswag_to_oas!(filepath)\n temp_path = \"/tmp/#{SecureRandom.urlsafe_base64}.json\"\n File.open(temp_path, 'w') do |outfile|\n File.foreach(filepath) do |line|\n outfile.puts line unless line.include?('basePath')\n end\n end\n\n FileUtils.mv(temp_path, filepath)\nend",
"title": ""
},
{
"docid": "aeac7d22af45c3358c85ffb74025dba2",
"score": "0.5654809",
"text": "def rswag_to_oas!(filepath)\n temp_path = \"/tmp/#{SecureRandom.urlsafe_base64}.json\"\n File.open(temp_path, 'w') do |outfile|\n File.foreach(filepath) do |line|\n outfile.puts line unless line.include?('basePath')\n end\n end\n\n FileUtils.mv(temp_path, filepath)\nend",
"title": ""
},
{
"docid": "eeebb37502ab7328768862c0a8f8f800",
"score": "0.5647183",
"text": "def recreate_image\n self.orig_file1_id = nil\n self.orig_file2_id = nil\n self.save\n end",
"title": ""
},
{
"docid": "75b5a2f8b1fc8ece0a56b5ebb5a8fdaf",
"score": "0.56403416",
"text": "def transfer_and_cleanup\n transfer_and_cleanup_with_block do |type|\n if type == :original\n self.update_column(:original_file_processed, true)\n end\n\n if type == :edited\n self.update_column(:edited_file_processed, true)\n end\n\n if type == :proofread_reviewed\n self.update_column(:proofread_reviewed_file_processed, true)\n end\n\n if type == :proofread_final\n self.update_column(:proofread_final_file_processed, true)\n end\n end\n end",
"title": ""
},
{
"docid": "72a00498fc44bfa55db87ee8a8f451a1",
"score": "0.5626005",
"text": "def wipe_file\n File.truncate(file_path, 0)\n @averaged_statistics = StatisticsHelper.add_symbols_to_hash\n end",
"title": ""
},
{
"docid": "88175f49ebfb6d25ef454bf42155655a",
"score": "0.56248486",
"text": "def rebuild_rtf_file\n # On transforme le nouveau fichier texte en fichier RTF\n `textutil -format txt -convert rtf -output \"#{rtf_new_file_path}\" \"#{new_txt_file_path}\"`\n\n # On remet l'entête original\n rtf_new_file_prov = \"#{rtf_new_file_path}.prov\".freeze\n FileUtils.mv(rtf_new_file_path, rtf_new_file_prov)\n fileref = File.open(rtf_new_file_path, 'a')\n\n # On retire l'entête actuel\n is_header = true\n File.foreach(rtf_new_file_prov) do |line|\n if line.strip.empty?\n # fin de l'entete\n is_header = false\n # Il faut ajouter l'entête précédent\n File.foreach(original_header_path) do |hline|\n fileref.write(hline)\n end\n # On peut passer à la suite\n end\n next if is_header\n fileref.write(line)\n end\n # Destruction du fichier provisoire\n File.delete(rtf_new_file_prov)\nrescue Exception => e\n erreur(e)\n return false\nensure\n fileref.close if fileref\nend",
"title": ""
},
{
"docid": "1841a9469b2e42d8ca0f79feec3da445",
"score": "0.55908984",
"text": "def save\n # Change the inner filepath representation\n old_file = @file\n @file = generate_filepath\n # Move file on disk\n if old_file != @file\n if File.exists?(@file)\n puts \"WARNING: Can't rename #{@file}, destination already exists!\"\n return\n end\n puts \"Renamed to #{metadata_hierarchy}/#{File.basename(@file)}\"\n FileUtils.mkdir_p(File.dirname(@file))\n FileUtils.mv(old_file, @file) \n end\n end",
"title": ""
},
{
"docid": "c1dd31724df16ef580f2c812b37e425c",
"score": "0.5589716",
"text": "def to_file\n replace_with_tempfile unless @tempfile_in\n flush\n self\n end",
"title": ""
},
{
"docid": "24036428204eef92cd0bcafe55778691",
"score": "0.55835277",
"text": "def write_out_raw\r\n new_filepath = temp_filename(file_name, DIL::Application.config.processing_file_path)\r\n File.open(new_filepath, 'wb') do |f|\r\n f.write raw.content\r\n end\r\n logger.debug(\"New filepath:\" + new_filepath)\r\n FileUtils.chmod(0644, new_filepath)\r\n new_filepath\r\n end",
"title": ""
},
{
"docid": "f33e828c0208b23f7daa8e39477f0153",
"score": "0.5561421",
"text": "def write_file\n if @changes\n backup_pathname = original_pathname + \".old\"\n FileUtils.cp(original_pathname, backup_pathname, preserve: true)\n File.open(original_pathname, \"w\") do |newfile|\n editor.lines.each do |line|\n newfile.puts(line)\n end\n newfile.flush\n end\n @file_edited = true\n end\n @changes = false\n end",
"title": ""
},
{
"docid": "cffce29c1dae2a1bc42772007c559e5f",
"score": "0.5538596",
"text": "def encode_file(_file_suffix, _options = {})\n convert_to_format\n ensure\n FileUtils.rm_f(converted_file)\n # [hyc-override] clean up the parent temp dir\n FileUtils.rmdir(File.dirname(converted_file))\n end",
"title": ""
},
{
"docid": "1fae83a2ef2a7aacbf8b1aeaecba98b0",
"score": "0.5534308",
"text": "def clean_fasta_file(file)\n tmp_fh = nil\n tmp_path = nil\n begin\n if file =~ /\\.gz/\n tmp_path = Tempfile.new('MiGA.gz').tap(&:close).path\n File.unlink tmp_path\n tmp_path += '.gz'\n tmp_fh = Zlib::GzipWriter.open(tmp_path, 9)\n fh = Zlib::GzipReader.open(file)\n else\n tmp_fh = Tempfile.new('MiGA')\n tmp_path = tmp_fh.path\n fh = File.open(file, 'r')\n end\n buffer = ''.dup\n fh.each_line do |ln|\n ln.chomp!\n if ln =~ /^>\\s*(\\S+)(.*)/\n id, df = $1, $2\n tmp_fh.print buffer.wrap_width(80)\n buffer = ''.dup\n tmp_fh.puts \">#{id.gsub(/[^A-Za-z0-9_\\|\\.]/, '_')}#{df}\"\n else\n buffer << ln.gsub(/[^A-Za-z\\.\\-]/, '')\n end\n end\n tmp_fh.print buffer.wrap_width(80)\n tmp_fh.close\n fh.close\n FileUtils.mv(tmp_path, file)\n ensure\n begin\n tmp_fh.close unless tmp_fh.nil?\n File.unlink(tmp_path) unless tmp_path.nil?\n rescue\n end\n end\n end",
"title": ""
},
{
"docid": "03f610110a9b23b42f6c2190f993a702",
"score": "0.5522366",
"text": "def clean_output_file\n file = File.open(OUTPUT_FILE, \"a+\")\n file.truncate(0)\n end",
"title": ""
},
{
"docid": "0124d67e471df7f0d13282704a2088f0",
"score": "0.55128574",
"text": "def regenerate_files!(original_file)\n distribute_files!(original_file, variants: variants.without(original))\n purge_cached_urls!\n post.update_iqdb if post.present?\n end",
"title": ""
},
{
"docid": "730cb48b69f38f01fdff8ddb04e8f4bd",
"score": "0.55077577",
"text": "def clean_output_file\n file = File.open(\"#{@output_file}\", \"a+\")\n file.truncate(0)\n end",
"title": ""
},
{
"docid": "1a1ab996e3b57205c86a959dfff43565",
"score": "0.5503866",
"text": "def optimize!\n puts \"FILE ALREADY OPTIMIZED\" if get_missing_settings.empty?\n return true if get_missing_settings.empty?\n File.open(new_file_path, 'w') do |fo|\n get_missing_settings.each { |settings| fo.puts settings }\n File.foreach(@file_name) { |li| fo.puts li }\n #@db_file.foreach { |li| fo.puts li }\n\n fo.puts \"COMMIT;\"\n end\n\n File.delete @file_name\n File.rename new_file_path, @file_name\n end",
"title": ""
},
{
"docid": "0f36da486a3b8e4b50d3a20a7a425c0a",
"score": "0.5494421",
"text": "def do_fixup_rakefile( task, * )\n\t\tunless self.rakefile_needs_hoe_fixup?\n\t\t\tself.trace \"Not a hoe-based Rakefile; skipping\"\n\t\t\treturn\n\t\tend\n\n\t\toriginal = self.rakefile.read\n\n\t\tself.write_replacement_file( self.rakefile, encoding: 'utf-8' ) do |fh|\n\n\t\t\tself.trace \"Re-generating Rakefile from a template\"\n\t\t\ttemplate = Rake::DevEiate::Generate::RAKEFILE_TEMPLATE\n\t\t\tboilerplate = self.load_and_render_template( template, 'Rakefile' )\n\t\t\tfh.print( boilerplate )\n\n\t\t\tself.trace \"Appending the old Rakefile contents in an END section\"\n\t\t\tfh.puts\n\t\t\tfh.puts \"__END__\"\n\t\t\tfh.puts\n\t\t\tfh.print( original )\n\t\tend\n\tend",
"title": ""
},
{
"docid": "cd4d4783cc71e7c842be54e3262d56d8",
"score": "0.54904884",
"text": "def restore(file)\n OpenNebula.log_error(\"Not yet implemented\")\n end",
"title": ""
},
{
"docid": "8e8b8fc19216a32d163720f5a648f873",
"score": "0.54853725",
"text": "def process_contents! file_path\n contents = File.read file_path\n new_contents = process_string! contents\n\n # Overwrite the original file with the processed file\n File.open file_path, 'w' do |f|\n f.write new_contents\n end\n end",
"title": ""
},
{
"docid": "f39c290b2e48dd8a426c73acbc8421c3",
"score": "0.54788333",
"text": "def replace(path)\n original = open(path,\"r\") { |f| f.lines.map.join }\n modified = yield(original)\n open(path,\"w\") { |f| f.puts(modified) }\nend",
"title": ""
},
{
"docid": "b18b9aeb290398e79dcfc9e1f6bca7a1",
"score": "0.54775316",
"text": "def to_file( file = suggested_filename )\n execute do | contents |\n if file.is_a?(String)\n FileUtils.mv contents, file\n else\n file.write contents.read\n file.rewind\n end\n end\n file\n end",
"title": ""
},
{
"docid": "826c7f4d60abd42f887b7f868c547ba1",
"score": "0.5473415",
"text": "def obliterate!\n # TODO: should this raise an exception if the file does not exist?\n self.delete_from_store\n self.encodings.each do |e|\n e.delete_from_store\n e.destroy!\n end\n self.destroy!\n end",
"title": ""
},
{
"docid": "df737c1d5f7a83aff37108af5b2d9931",
"score": "0.5472452",
"text": "def last_clean_up(output_file)\n text = File.read(output_file)\n # MAIN TABLE STYLE\n new_contents = text.gsub(/([.\\n\\r\\s\\S]*?)(<table)([.\\s\\S]*?)(id=\"Table_01\")([.\\n\\r\\s\\S]*?)(<\\/table>)([.\\n\\r\\s\\S]*?<\\/html>)/, \"<table style='min-width:620px;' align='center'\\\\5\\\\6\\\\3\")\n # Delete amp; for tracking the URL. \n new_contents = new_contents.gsub(/amp;/,\"\")\n # Wrting the result\n File.open(output_file, \"w\") {|out| out << new_contents }\n end",
"title": ""
},
{
"docid": "21c6e2b502065be3cc89ee67a2f7f96d",
"score": "0.54722184",
"text": "def overwrite_file old_file, new_file\n @file_utils.mv new_file, old_file\n end",
"title": ""
},
{
"docid": "8e17cd4750f6830bbba8afba28ebff93",
"score": "0.54679626",
"text": "def clean_fasta_file(file)\n tmp_fh = nil\n begin\n if file =~ /\\.gz/\n tmp_path = Tempfile.new('MiGA.gz').tap(&:close).path\n tmp_fh = Zlib::GzipWriter.open(tmp_path)\n fh = Zlib::GzipReader.open(file)\n else\n tmp_fh = Tempfile.new('MiGA')\n tmp_path = tmp_fh.path\n fh = File.open(file, 'r')\n end\n buffer = ''\n fh.each_line do |ln|\n ln.chomp!\n if ln =~ /^>\\s*(\\S+)(.*)/\n id, df = $1, $2\n tmp_fh.print buffer.wrap_width(80)\n buffer = ''\n tmp_fh.puts \">#{id.gsub(/[^A-Za-z0-9_\\|\\.]/, '_')}#{df}\"\n else\n buffer << ln.gsub(/[^A-Za-z\\.\\-]/, '')\n end\n end\n tmp_fh.print buffer.wrap_width(80)\n tmp_fh.close\n fh.close\n FileUtils.cp(tmp_path, file)\n ensure\n begin\n tmp_fh.close unless tmp_fh.nil?\n File.unlink(tmp_path) unless tmp_path.nil?\n rescue\n end\n end\n end",
"title": ""
},
{
"docid": "5f357cf7a3d5fa9def64b563b4693f2e",
"score": "0.5446002",
"text": "def reprocess!\n new_original = Tempfile.new(\"paperclip-reprocess\")\n if old_original = to_file(:original)\n new_original.write( old_original.read )\n new_original.rewind\n\n @queued_for_write = { :original => new_original }\n post_process\n\n old_original.close if old_original.respond_to?(:close)\n\n save\n else\n true\n end\n end",
"title": ""
},
{
"docid": "5f357cf7a3d5fa9def64b563b4693f2e",
"score": "0.5446002",
"text": "def reprocess!\n new_original = Tempfile.new(\"paperclip-reprocess\")\n if old_original = to_file(:original)\n new_original.write( old_original.read )\n new_original.rewind\n\n @queued_for_write = { :original => new_original }\n post_process\n\n old_original.close if old_original.respond_to?(:close)\n\n save\n else\n true\n end\n end",
"title": ""
},
{
"docid": "0e3b528a9327efb9949f1accfff13860",
"score": "0.54416126",
"text": "def update_qrel(file_in, file_out)\n h_in, h_out = read_qrel(file_in), read_qrel(file_out)\n #p h_in\n h_out.each do |k,v|\n v.each{|k2,v2| h_out[k][k2] = h_in[k][k2] if h_in[k][k2]}\n end\n `cp #{file_out} #{file_out}.bak`\n write_qrel(file_out, h_out)\nend",
"title": ""
},
{
"docid": "1883eb1392eef5680e8c4a49514b9322",
"score": "0.5439329",
"text": "def restore(old_path, new_path)\n IO.copy_stream(old_path, new_path)\n end",
"title": ""
},
{
"docid": "e264bec051af28b25c59b01f9ed19aff",
"score": "0.5436713",
"text": "def cleanup\n File.delete(outfile) if File.exist?(outfile)\n File.delete(infile) if File.exist?(infile)\n end",
"title": ""
},
{
"docid": "bd31580f06c40d19e1d12cccef6a5294",
"score": "0.5422308",
"text": "def reprocess!\n new_original = Tempfile.new(\"attachment-reprocess\")\n new_original.binmode\n if old_original = to_file(:original)\n new_original.write( old_original.read )\n new_original.rewind\n\n @queued_for_write = { :original => new_original }\n post_process\n\n old_original.close if old_original.respond_to?(:close)\n\n save\n else\n true\n end\n end",
"title": ""
},
{
"docid": "6ce3ada931ce1468e20a57082f0f2404",
"score": "0.54190755",
"text": "def cleaned_file\n @cleaned_file ||=\n begin\n t = Tempfile.new\n MiniMagick::Tool::Convert.new do |convert|\n convert << file_object.disk_path.to_s\n convert.compress.+\n convert << t.path.to_s\n end\n t\n end\n end",
"title": ""
},
{
"docid": "320be9f329f6a6d488ebf38159278124",
"score": "0.5413439",
"text": "def restore\n Tobacco.log(\"Restoring: #{destination} => #{@filepath}\")\n\n if File.exists? destination\n FileUtils.mv(destination, @filepath)\n end\n end",
"title": ""
},
{
"docid": "c347b631b38e157865d07d5f353e9cb4",
"score": "0.54131615",
"text": "def daltonize(proc_type)\n cache_stored_file! unless cached?\n tmp_name = current_path.sub(/(\\.[a-z]+)$/i, '_tmp\\1')\n\n ::Daltonize.daltonize_file(current_path, tmp_name, proc_type)\n\n FileUtils.mv(tmp_name, current_path)\n rescue => e\n raise CarrierWave::ProcessingError.new(\"Failed to manipulate file. Original Error: #{e}\")\n end",
"title": ""
},
{
"docid": "7fa53370f0e2d6cd92ce4ac06202f716",
"score": "0.54037046",
"text": "def prepend_text_to_file(text, filename)\n `sed -e '1i\\\\\n#{text}' #{filename} > #{filename}.tmptmp`\n `cp #{filename}.tmptmp #{filename}` # CP to original file\n File.delete(\"#{filename}.tmptmp\") # Delete temporary file\n end",
"title": ""
},
{
"docid": "7fa53370f0e2d6cd92ce4ac06202f716",
"score": "0.54037046",
"text": "def prepend_text_to_file(text, filename)\n `sed -e '1i\\\\\n#{text}' #{filename} > #{filename}.tmptmp`\n `cp #{filename}.tmptmp #{filename}` # CP to original file\n File.delete(\"#{filename}.tmptmp\") # Delete temporary file\n end",
"title": ""
},
{
"docid": "da17ececbdb2b6358278de2ab34eed4c",
"score": "0.539843",
"text": "def operation(src_file, out_file, original)\n original_exif, src_file_exif = read_exif original, src_file\n values = missing_exif_fields(src_file_exif, original_exif)\n FileUtils.cp src_file, out_file\n write_exif out_file, values\n end",
"title": ""
},
{
"docid": "81165a0659b0596a97719dd9935ccded",
"score": "0.53921944",
"text": "def store(new_file); end",
"title": ""
},
{
"docid": "a9b54f66f58f2a2d62bd703d7317fa42",
"score": "0.538571",
"text": "def reify!\n # return unless @mapping.valid?\n code = reify\n code.each_pair do |filename, content|\n FileUtils.mkpath(File.dirname(\"#{@class_path_root}/#{filename}.rb\"))\n # Creo il file\n File.open(\"#{@class_path_root}/#{filename}.rb\", \"w\") do |f|\n f.write(content)\n end\n if File.exist?(\"#{@class_path_root}/#{filename}.rb\")\n # In questo caso devo ricaricarla in memoria\n reload\n end\n end\n end",
"title": ""
},
{
"docid": "c7d7a32eddc935df0cb72cc0abde9142",
"score": "0.5384069",
"text": "def restore(file, version)\n path_for_restore = restores_for(file)[version[1..nil].to_i - 1]\n content = File.read(path_for_restore)\n File.write(File.join(data_path, file), content)\nend",
"title": ""
},
{
"docid": "8ad5aa6e4331baac1a2ae23b72daf816",
"score": "0.53697866",
"text": "def replace_snippets_in_file(infile, snippets)\r\n input_data = File.open(infile){|f| f.readlines.join}\r\n output_data=input_data.clone\r\n\r\n @log.debug(\"replacing snippets in #{infile}\")\r\n\r\n replace_snippets_in_text(output_data, snippets)\r\n\r\n if (not input_data == output_data)\r\n File.open(infile, \"w\"){|f| f.puts output_data}\r\n end\r\n end",
"title": ""
},
{
"docid": "dd6feb30a94803161ce61dc26eded4cb",
"score": "0.536677",
"text": "def finish\n encoded_files = output.move_files\n tmp.remove_dir\n encoded_files\n end",
"title": ""
},
{
"docid": "70a8defdfe1be0c195bbb44d5dd9d52f",
"score": "0.5366579",
"text": "def replace_in_file(file_name, regex, to)\n reader = File.new(file_name, 'rb')\n txt = reader.read\n reader.close\n update = txt.gsub(regex, to)\n if update != txt\n backup_file = file_name.parent + (file_name.basename.to_s + '~')\n FileUtils::cp(file_name, backup_file)\n writer = File.new(file_name, 'w')\n writer.write(update)\n writer.close\n #puts file_name\n end\nrescue Exception, e\n puts \"Could not replace in file: #{file_name}\"\n raise e\nend",
"title": ""
},
{
"docid": "5ce975826ad8a5dc10d91413872de9c5",
"score": "0.5361876",
"text": "def process_input original\n file_dumper = file_dumper(original)\n\n if !settings[:gzip_output] && (!file_dumper.compressed_file? || (file_dumper.compressed_file? && !settings[:uncompress_input]))\n create_hardlink(original, path_for(original))\n else\n copy_or_uncompress_input_and_gzip_output(file_dumper)\n end\n end",
"title": ""
},
{
"docid": "18d1b880e3b050edbfbaf75b426f59d3",
"score": "0.5348228",
"text": "def update\n @secretary.reset!\n File.open(destination, 'w') do |file|\n file.write @secretary.concatenation.to_s\n @source_last_modified = @secretary.source_last_modified\n end\n end",
"title": ""
},
{
"docid": "a4e27ce4f654c8f749fcae1f80912786",
"score": "0.53474694",
"text": "def transform\n return if File.exist?(\"./census/#{@name}\")\n dest = File.open(\"./census/#{@name}\", 'w', :external_encoding=>'utf-8')\n uncompress_name = \"./uncompressed-data/#{@name}.raw\"\n uncompress(uncompress_name)\n File.open(uncompress_name, 'r').each do|line|\n if block_given?\n line = yield line\n end\n dest.puts line\n end\n dest.close\n end",
"title": ""
},
{
"docid": "f121db6b77dcceda15e0624c281287ce",
"score": "0.53442705",
"text": "def characterize(save: true)\n [:original_file, :intermediate_file, :preservation_file].each do |type|\n target_file = @file_set.try(type)\n next unless target_file\n @file_object = Valkyrie::StorageAdapter.find_by(id: target_file.file_identifiers[0])\n new_file = target_file.new(file_characterization_attributes.to_h)\n @file_set.file_metadata = file_set.file_metadata.select { |x| x.id != new_file.id } + [new_file]\n end\n @file_set = persister.save(resource: @file_set) if save\n @file_set\n end",
"title": ""
},
{
"docid": "d923339190f2318fc67fd9327ab044ae",
"score": "0.5342817",
"text": "def save(flatten = false)\n tmp_file = SecureRandom.uuid\n save_as(tmp_file, flatten)\n File.rename tmp_file, @file\n end",
"title": ""
},
{
"docid": "58ffe21a1651346a7a7340be37adb901",
"score": "0.53366244",
"text": "def with_replaced_file(filepath, contents)\n ::Dir.mktmpdir do |temp_dir|\n begin\n temp_path = ::File.join(temp_dir, ::File.basename(filepath))\n ::FileUtils.mkdir_p(::File.dirname(filepath))\n if ::File.file?(filepath)\n ::FileUtils.mv(filepath, temp_path, :force => true)\n end\n ::File.open(filepath, 'w') { |f| f.write(contents) }\n yield\n ensure\n begin\n if ::File.file?(temp_path)\n ::FileUtils.mv(temp_path, filepath, :force => true)\n elsif ::File.file?(filepath)\n ::File.unlink(filepath)\n end\n rescue ::Exception => e\n @logger.note_warning(\"Failed to restore #{filepath.inspect}: #{e.message}\")\n end\n end\n end\n end",
"title": ""
},
{
"docid": "8095510f36200f89f96932af7192e83a",
"score": "0.5334089",
"text": "def exec_\n\n# fname = \"text-1.txt\"\n fname_src = \"utils/text-1.txt\"\n fname_dst = \"utils/text-1.processed.#{get_timelabel_serial()}.txt\"\n \n begin\n \n f_src = File.open(fname_src, \"r\")\n f_dst = File.open(fname_dst, \"w\")\n# f_dst = File.open(fname_src, \"w\")\n \n puts \"files opened\"\n \n tab_string = \"\\t\"\n return_string = \"\\r\"\n \n count = 0\n \n #test\n# puts f_src.gets\n \n# File.readlines(fname_src).each do |line|\n f_src.each do |line|\n \n puts \"processing line...\"\n \n #test\n# puts f_src.gets\n puts line\n \n #ref http://ref.xaio.jp/ruby/classes/string/strip\n# tokens = line.split(tab_string)\n tokens = line.strip.split(tab_string)\n \n #test\n# p tokens\n# \n tokens_reverse = tokens.reverse\n \n line_final = tokens_reverse[0..-2].join(return_string)\n# line_final = tokens_reverse[0..-2].join(tab_string)\n# line_final = tokens_reverse.join(tab_string)\n \n f_dst.write(line_final)\n \n f_dst.write(\"\\n\")\n \n count += 1\n end\n# \n## end\n \n \n f_src.close\n f_dst.close\n \n puts \"lines => #{count} / file closed\"\n \n rescue => e\n \n p e\n \n end\n \n# puts \"hi\"\n \nend",
"title": ""
},
{
"docid": "a63f50d17921755d0ba285f92b859021",
"score": "0.53273356",
"text": "def pre_combine_file(file, file_content, settings)\n\tfile_content\nend",
"title": ""
},
{
"docid": "c2c0b86de9dc6bb9585f3a3ee0531057",
"score": "0.5325091",
"text": "def normalize_file(file)\n\n exposition_lines = []\n contents = []\n\tcontents << \"<boseason>\" # Missing start token, so add it manually\n\n\tFile.read(file).split(\"\\n\").each do |line|\n next if line.size == 0\n\n\t\ttoken = parse_structured_exposition(line)\n\n\t\tunless token.nil?\n\t\t\tcontents << token\n\t\t\tnext\n\t\tend\n\n\t\tthis_line_type = line_type(line)\n\t\tputs \"line=#{line}\"\n\t\tputs \"line_type=#{this_line_type}\"\n if this_line_type == :multi_exposition\n\t\t\texposition_lines << line\n\t\telse\n\t\t\tif exposition_lines.size > 0\n\t\t\t\tcontents << parse_exposition(exposition_lines)\n\t\t\t\texposition_lines = []\n\t\t\tend\n case this_line_type\n when :single_exposition\n contents << parse_single_exposition(line)\n else\n contents << parse_character_line(line)\n end\n\t\tend\n end\n contents << \"<eoseason>\"\n\tnew_file_name = file.gsub(\"raw\",\"normalized\")\n\tf = File.new(new_file_name, \"w\")\n\tf << fix_bad_characters(contents.compact.join(\"\\n\"))\nend",
"title": ""
},
{
"docid": "fa81df0a8947e71fcd7d5e15921bee46",
"score": "0.53095883",
"text": "def to_file(file); end",
"title": ""
},
{
"docid": "ce37684c1540549fa58dda39b611a8f8",
"score": "0.5302894",
"text": "def convert_image_resource(path)\n puts(\"Updating and trimming image file '#{path}'\")\n image = MiniMagick::Image.open(path)\n image.trim\n image.write(path)\nend",
"title": ""
},
{
"docid": "23a2977650ed271b70d807899f6e267a",
"score": "0.53021365",
"text": "def expected_output_file\n input_text = File.read(\"ex_8_text.txt\")\n File.open(\"ex_8_text_expected_output.txt\", \"w\") do |file|\n expected_output = input_text.gsub(\"a\", \"e\")\n file.write expected_output\n end\nend",
"title": ""
},
{
"docid": "640bfb2fe2924d573cb3013013e36de1",
"score": "0.5300232",
"text": "def convert_tei_file(id)\n begin\n f = BasicFile.find(id)\n\n f.datastreams['RELS-EXT'].content = f.datastreams['RELS-EXT'].content.gsub('info:fedora/afmodel:TeiFile', 'info:fedora/afmodel:BasicFile')\n f.save\n rescue ActiveFedora::ObjectNotFoundError => e\n logger.tagged('CONCEPTUAL_MODEL_MIGRATE') { logger.error e }\n return\n end\n end",
"title": ""
},
{
"docid": "25b80c4b11a1f18556df5fb2000fb305",
"score": "0.52958554",
"text": "def regenerate_modifications\n modifications.each do |frog|\n frog.local_path_to_file = transmogrify(frog.width, frog.height, frog.name, frog.crop)\n end\n end",
"title": ""
},
{
"docid": "bde27be2a27a1da81671103ccceb914f",
"score": "0.5292973",
"text": "def duplicate_original_file\n didWrite = false\n if (File.writable?(\"#{XML_FILE}\"))\n file = File.open(\"#{XML_FILE}\")\n linesArr = File.readlines(file)\n if (linesArr != nil)\n File.open(\"#{XML_FILE}.orig\", 'w') do |f|\n linesArr.each { |element| f.puts(element) }\n end\n didWrite = true\n end\n file.close\n end\n \n if didWrite\n puts \"original file copied to: #{XML_FILE}.orig\"\n end\nend",
"title": ""
},
{
"docid": "7ab378961d9097dc12ccaa23aeeaf2f9",
"score": "0.5290839",
"text": "def file_mod(file_path, backup = false)\r\n File.open(file_path, \"r\") do |fr|\r\n str = fr.read\r\n newstr = yield(str)\r\n str = newstr if nil? newstr\r\n File.open(\"temp\", \"w\") do |tf|\r\n tf.write(str)\r\n end\r\n end\r\n\r\n File.rename(file_path, file_path + \".bak\")\r\n File.rename(\"temp\", file_path)\r\n File.unlink(file_path + \".bak\") unless backup\r\n end",
"title": ""
},
{
"docid": "4452498066a26ad7377bc891e94f4006",
"score": "0.5284675",
"text": "def undo \n if(@hasExecuted==true and (File::exist?(@newPath)))\n FileUtils.cp(@newPath, @ogPath)\n File::delete(@newPath)\n @hasExecuted=false\n end\n end",
"title": ""
},
{
"docid": "9032e5d3308f8d508e8ca30ef03e776a",
"score": "0.527741",
"text": "def trimFile (fpath, toTrim)\n # todo....\nend",
"title": ""
},
{
"docid": "b271c2681a067dd7e1ca0dad85e5a165",
"score": "0.5277207",
"text": "def shuffle_file\n path = get_file\n\n line_ary = read_shuffle(path)\n\n write_file(line_ary, path)\n\nend",
"title": ""
},
{
"docid": "3d02c09e2b9838270d934a6e9dcbe550",
"score": "0.52748805",
"text": "def normalizeFileContents(file)\n transformed_lines = Array.new\n file.each_line do |line|\n # remove comments\n line = line.gsub(/\\/\\/(.*)$/, '')\n # remove classname\n line = line.gsub(/class (\\w*)/, 'class')\n line.strip!\n unless line.empty?\n transformed_lines << line\n end\n end\n transformed_lines.join(\"\\n\")\nend",
"title": ""
},
{
"docid": "f231b3f1fafbd6efaf802879c24eb8ce",
"score": "0.5262593",
"text": "def replace_file(filename, data)\n remove_file filename\n create_file filename, data\nend",
"title": ""
},
{
"docid": "b1b42baaf6e410269f58155649796ff4",
"score": "0.52618915",
"text": "def convert_file(srcFileName, desFileName, srcEncoding, desEncoding)\n f_src = File.open(srcFileName,\"r:utf-8\")\n f_des= File.open(desFileName,\"w:utf-8\")\n\n if srcEncoding == ENCODING_UNICODE and desEncoding == ENCODING_TRIPLE then\n while f_src.eof? == false do\n line = f_src.readline()\n buf = to_triple_array(line)\n f_des.write(buf+\"\\n\")\n end\n elsif srcEncoding == ENCODING_TRIPLE && desEncoding == ENCODING_UNICODE then\n while f_src.eof? == false do\n line = f_src.readline\n buf = to_string(line)\n bw.write(buf+\"\\n\")\n end\n\t\tend\n end",
"title": ""
},
{
"docid": "f9d5721167912e534fac8ce51f246994",
"score": "0.5255821",
"text": "def recover_in_use_file(file, full_path)\n file.seek(0, IO::SEEK_END)\n append_json_close_data(file)\n file.flush\n # and rename to indicate we have appended json data\n full_path =~ IN_USE_STRIPPER\n new_path = $1\n File.rename(full_path, new_path) rescue nil\n # position back to start\n file.seek(0, IO::SEEK_SET)\n\n return new_path\n end",
"title": ""
},
{
"docid": "7e326c46d9b054411a195aa23f5396ab",
"score": "0.525116",
"text": "def reprocess_file \n reprocess_data_file\n update_flags\n self.check_questions_for_changes_status = true\n return true\n end",
"title": ""
},
{
"docid": "799470c07af88575c2daffd068a6e43a",
"score": "0.52483404",
"text": "def reset_to_copied(original)\n original.update_attribute(:file_state, 'copied')\n end",
"title": ""
},
{
"docid": "046c26c851c8453f1faa11a092dbbdfd",
"score": "0.523014",
"text": "def write_file_after_save(file_data_to_write=nil)\n return unless(@file_data_to_write || (@file_data_to_write=file_data_to_write))\n \n # Check if we have the converted images already. In this case we write\n # them to the appropriate directories directly and call the super method\n return super if(direct_write!)\n \n # \"Prepare\" the original file for conversion, indicate if a temp file is being used\n original_file_path, orig_is_temp = prepare_original_file\n # Check if we need to delete the original/temp file\n will_delete_source = orig_is_temp || @delete_original_file\n # Path to the temporary thumbnail file\n destination_thumbnail_file_path = File.join(Dir.tmpdir, \"thumbnail_#{random_tempfile_filename}.gif\")\n \n begin\n self.class.benchmark(\"\\033[36mIipData\\033[0m Making thumb and pyramid for #{self.id}\", Logger::INFO) do\n \n # Create the thumbnail at the temporary location\n TaliaUtil::ImageConversions::create_thumb(original_file_path, destination_thumbnail_file_path)\n # Create the pyramidal image from the original\n create_pyramid(original_file_path) if orig_is_temp\n \n # Run the super implementation for the thumbnail, by using the temporary thumb file as the \"data\"\n @file_data_to_write = DataPath.new(destination_thumbnail_file_path)\n # The temp thumb file needs to be deleted by the superclass\n @delete_original_file = true\n \n end # end benchmarking\n super\n \n ensure\n # Delete the temporary \"original\" file, if necessary\n File.delete original_file_path if(File.exists?(original_file_path) && will_delete_source)\n end\n end",
"title": ""
},
{
"docid": "1de13886f8ba2fc258e980a0adbff657",
"score": "0.5229792",
"text": "def replace file, this, that\n content = File.read file\n if content.include?(this) && !is_binary?(file)\n puts \"#{file} (#{content.scan(this).count} occurrences of '#{this}')\"\n unless DRY\n content.gsub! this, that\n File.open(file, \"w\") { |f| f.puts content }\n end\n end\nend",
"title": ""
},
{
"docid": "a31e02ecf515f2566f61b7746d16ac0c",
"score": "0.5227852",
"text": "def preprocess_file\n file.tempfile.rewind\n encoding_options = {\n :invalid => :replace, # Replace invalid byte sequences\n :undef => :replace, # Replace anything not defined in ASCII\n :replace => '', # Use a blank for those replacements\n :universal_newline => true # Always break lines with \\n\n }\n first_two_lines = file.tempfile.readline\n first_two_lines += file.tempfile.readline unless file.tempfile.eof?\n\n if first_two_lines.include?(\"|\")\n raise ArgumentError, I18n.t(\"batchgrouper.detected_bfs\")\n end\n\n file.tempfile.rewind\n self.line_count = File.foreach(file.tempfile).inject(0) {|c, line| c+1}\n # assuming the first line is a header line, save first and second line of the querry.\n # TODO: refactor name of second_line\n self.second_line = first_two_lines.encode Encoding.find('ASCII'), encoding_options\n end",
"title": ""
},
{
"docid": "7203e6e40f14ad0cab54173d5478a85d",
"score": "0.5227617",
"text": "def store!(file); end",
"title": ""
},
{
"docid": "7203e6e40f14ad0cab54173d5478a85d",
"score": "0.5227617",
"text": "def store!(file); end",
"title": ""
},
{
"docid": "6ce5bda1b504339810e40aed877cb0bc",
"score": "0.52248883",
"text": "def upgrade\n\t\teach_pair do |tape, files|\n\t\t\tfiles.each do |file|\n\t\t\t\tif not File.exists?(file.filename)\n\t\t\t\t\tputs \"warning: #{file.filename} no longer exists, cannot hash\"\n\t\t\t\t\tnext\n\t\t\t\tend\n\n\t\t\t\tif file.sha1.nil?\n\t\t\t\t\tfile.sha1 = Digest::SHA1.file(file.filename).hexdigest\n\t\t\t\tend\n\n\t\t\t\tif file.mtime.nil?\n\t\t\t\t\tfile.mtime = File.mtime(file.filename)\n\t\t\t\tend\n\n\t\t\t\tif file.size.nil?\n\t\t\t\t\tfile.size = File.size(file.filename)\n\t\t\t\tend\n\n\t\t\t\tp file\n\t\t\t\twrite_file # so we don't lose all hashing work if interrupted\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "6b70da89f8d26cce930001f9bdef31e5",
"score": "0.5221418",
"text": "def reprocess!\n raise \"this attachment already has a file open to process\" unless uploaded_file.nil?\n save_temporary_and_process_attachment\n save!\n end",
"title": ""
},
{
"docid": "4e90be44fdaca4fcf6dda2fc6ea8828b",
"score": "0.52117616",
"text": "def transform_lines(outfile)\n file = File.open(outfile, 'w')\n @lines.each do |line|\n file.puts transform_line(line)\n end\n file.close\n end",
"title": ""
},
{
"docid": "894d48e42e2ee3dbdaef569f9f55dbde",
"score": "0.5209546",
"text": "def run\n normalize_count = 0\n\n if generate_gitattributes?\n output_options = {:prefix => '# DO NOT EDIT: File is auto-generated', :normalize => true}\n new_gitattributes = generate_gitattributes!\n new_content = new_gitattributes.as_file_contents(output_options)\n old_content = File.exist?(@attributes.attributes_file) ? IO.read(@attributes.attributes_file) : nil\n if new_content != old_content\n @attributes = new_gitattributes\n if check_only?\n puts 'Non-normalized .gitattributes file'\n else\n puts 'Fixing: .gitattributes'\n @attributes.write(output_options)\n end\n normalize_count += 1\n end\n end\n\n files = {}\n\n collect_file_attributes(files)\n\n files.each_pair do |filename, config|\n full_filename = \"#{@base_directory}/#{filename}\"\n original_bin_content = File.binread(full_filename)\n\n encoding = config[:encoding].nil? ? 'utf-8' : config[:encoding].gsub(/^UTF/,'utf-')\n\n content = File.read(full_filename, :encoding => \"bom|#{encoding}\")\n\n content =\n config[:dos] ?\n clean_dos_whitespace(filename, content, config[:eofnl], config[:allow_empty]) :\n clean_whitespace(filename, content, config[:eofnl], config[:allow_empty])\n if config[:nodupnl]\n while content.gsub!(/\\n\\n\\n/, \"\\n\\n\")\n # Keep removing duplicate new lines till they have gone\n end\n end\n if content.bytes != original_bin_content.bytes\n normalize_count += 1\n if check_only?\n puts \"Non-normalized whitespace in #{filename}\"\n else\n puts \"Fixing: #{filename}\"\n File.open(full_filename, 'wb') do |out|\n out.write content\n end\n end\n end\n end\n\n normalize_count\n end",
"title": ""
},
{
"docid": "825354d43d2168b20d7ed5670364f16f",
"score": "0.52064586",
"text": "def execute\r\n FileUtils.cp(@OldFilePath, @NewFilePath)\r\n #new_file.close\r\n end",
"title": ""
},
{
"docid": "c3fabdd92fddf3a69e70f60cb6b6426a",
"score": "0.5196342",
"text": "def test_restore_to_new_file\n file = tempfile\n text = \"asdf;lkajseofiqwekj\"\n File.open(file, \"w\") { |f| f.puts text }\n md5 = nil\n assert_nothing_raised(\"Could not send file\") do\n md5 = @dipper.backup(file)\n end\n\n newfile = tempfile\n assert_nothing_raised(\"could not restore to new path\") do\n @dipper.restore(newfile, md5)\n end\n\n assert_equal(File.read(file), File.read(newfile), \"did not restore correctly\")\n end",
"title": ""
},
{
"docid": "130ab7447c8edeb5f328edfe984f55b4",
"score": "0.51960206",
"text": "def replace(other)\n output do |f|\n f.puts File.read(other)\n end\n end",
"title": ""
}
] |
03748c3131c4c0b8702e6580879dcc00
|
GET /occaisions GET /occaisions.json
|
[
{
"docid": "9831593f1d8c360e0635e0b012dc366d",
"score": "0.7719728",
"text": "def index\n @occaisions = Occaision.all\n end",
"title": ""
}
] |
[
{
"docid": "766504de33a927cdcfc69a5b07268586",
"score": "0.6310068",
"text": "def index\n @competences = Competence.all\n authorize! :read, Competence\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @competences }\n end\n end",
"title": ""
},
{
"docid": "dc5872745a0fb61468c245f3c1baa117",
"score": "0.6036287",
"text": "def divisions\n self.class.get(\"/divisions.json\",:query => { :client_id => @api_key }).divisions\n end",
"title": ""
},
{
"docid": "d5e9d1c61179e92aec7f2868e02db061",
"score": "0.5883771",
"text": "def index\n @ocs = Oc.all\n end",
"title": ""
},
{
"docid": "1f5a7ef87feb2fd358e9332e3e14f416",
"score": "0.5864815",
"text": "def index\n @competitors = @ladder.competitors\n render json: @competitors, root: false\n end",
"title": ""
},
{
"docid": "5190d0f567ba4c7f011b296a4d3574aa",
"score": "0.5858555",
"text": "def index\n @olympics = Olympic.all\n end",
"title": ""
},
{
"docid": "4f9a5968c367dfb972c1887b90173a52",
"score": "0.5844836",
"text": "def index\n @olympics = policy_scope(Olympic)\n end",
"title": ""
},
{
"docid": "6c84f756cc95632a4db82b75738978a6",
"score": "0.5836459",
"text": "def show\n @oclc = Oclc.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @oclc }\n end\n end",
"title": ""
},
{
"docid": "f46ecd73de2c4a8101d5c84dd032dce6",
"score": "0.58041024",
"text": "def show\n @occasion = Occasion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @occasion }\n end\n end",
"title": ""
},
{
"docid": "2d7ee87e104e55023f1a31d30aa9b730",
"score": "0.580371",
"text": "def occasions_json\n if current_user\n occasions = current_user.relevant_occasions.map{|o| o.attributes_for_app(current_user_app_version)}\n logger.info \"occasions_json returning #{occasions.length} occasions with ids #{occasions.map{ |o| o['id'] }}\"\n render :json => occasions\n else\n render :json => []\n end\n end",
"title": ""
},
{
"docid": "5dd79d13dac4b766038251445973a0ba",
"score": "0.57981616",
"text": "def index\n @decisions = current_user.created_decisions\n base_json = []\n current_user.created_decisions.each do |d|\n base_json << d.as_json({:user_id => current_user.id})\n end\n @participating = current_user.participating_decisions\n @all_decisions = current_user.otherDecisions\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: base_json }\n end\n end",
"title": ""
},
{
"docid": "de22504687294fd38e680592b0f8d860",
"score": "0.57911944",
"text": "def divisions(**options) = get('/divisions', **options)",
"title": ""
},
{
"docid": "5f718313bf81e9a1f8616dc140dfbb0e",
"score": "0.57767826",
"text": "def index\n @olbigations = Olbigation.all\n end",
"title": ""
},
{
"docid": "ac5da2ada5d8b08c8ba4275830f9edfa",
"score": "0.57723707",
"text": "def index\n @decisions = current_user.decisions\n end",
"title": ""
},
{
"docid": "10aa2c4e5aab933240d391901473a333",
"score": "0.5749125",
"text": "def index\n @core_competencies = CoreCompetency.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @core_competencies }\n end\n end",
"title": ""
},
{
"docid": "0a7fa374a26b67edfa1bf624bd2dc15e",
"score": "0.57323444",
"text": "def index\n @existences = Existence.all\n\n render json: @existences\n end",
"title": ""
},
{
"docid": "4842a4b8dd951442b7efcb4cfd9d56d7",
"score": "0.5723992",
"text": "def index\n @missions = Mission.all\n @missions = @missions.where(parent_id: params[:parent_id]) unless params[:parent_id].nil?\n @missions = @missions.roots if params[:roots] == 'true'\n\n respond_to do |format|\n format.html\n format.json\n format.occurrence { render json: @missions.map(&:to_occurrences).flatten }\n end\n end",
"title": ""
},
{
"docid": "0e32269c38ed51800a4dbc64c529c04a",
"score": "0.5710055",
"text": "def set_occaision\n @occaision = Occaision.find(params[:id])\n end",
"title": ""
},
{
"docid": "d4191328b7eec3ee402c32753ab3b12d",
"score": "0.5696712",
"text": "def index\n @violence_acts = ViolenceAct.all\n\n render json: @violence_acts\n end",
"title": ""
},
{
"docid": "227d6c8422984298ccdeef25325a9a2a",
"score": "0.5691822",
"text": "def index\n\n @coral = Coral.find(params[:coral_id])\n @observation = Observation.find(params[:observation_id])\n @areas = @observation.areas.find(params[:observation_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @areas }\n end\n end",
"title": ""
},
{
"docid": "639238188217a84242adb01ed0f34018",
"score": "0.5691424",
"text": "def index\n # The right way to do this is with user has_many missions through collaborators. Couldn't get the routes or models to work, so I did it this klugy way insted. ideally, @missions = @user.missions.\n \n @collaborators = Collaborator.where(:user_id => current_user.id)\n if @collaborators[0] then @missions = Mission.where( :id => @collaborators[0].mission_id)\n for i in 1..(@collaborators.length-1)\n @missions = @missions + Mission.where( :id => @collaborators[i].mission_id)\n end\n end \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @missions }\n end\n end",
"title": ""
},
{
"docid": "ceeb861c8536c52f3829c6b45fe73adf",
"score": "0.56869584",
"text": "def index\n @divisions = @conference.divisions\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @divisions }\n end\n end",
"title": ""
},
{
"docid": "f835dd603ce08f39a89a1350066b11a9",
"score": "0.5620918",
"text": "def index\n @orgaos = Orgao.all\n\n render json: @orgaos\n end",
"title": ""
},
{
"docid": "c1f851f3b64c50f755bbf236d33320cb",
"score": "0.5609856",
"text": "def index\n @ocupacions = Ocupacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ocupacions }\n end\n end",
"title": ""
},
{
"docid": "3391527f87f64dd379570730a8ca17ae",
"score": "0.5584419",
"text": "def index\n @conductors = Conductor.all\n render :json => @conductors\n end",
"title": ""
},
{
"docid": "121d477554ed2da5933060722f113c9f",
"score": "0.5583774",
"text": "def index\n @casos = Caso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @casos }\n end\n end",
"title": ""
},
{
"docid": "9ef66520d26dea1c917b4148e1405445",
"score": "0.55806935",
"text": "def index\n @commission_statuses = CommissionStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commission_statuses }\n end\n end",
"title": ""
},
{
"docid": "64b0037e961c75cd11f588012d7c6fca",
"score": "0.5561689",
"text": "def index\n @organizations = Organization.all\n render json: @organizations.to_json(:include => :innovations)\n end",
"title": ""
},
{
"docid": "7d3993ab4e3c8659eb2a697026a85912",
"score": "0.55610245",
"text": "def index\n @circulation_statuses = CirculationStatus.order(:position)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @circulation_statuses }\n end\n end",
"title": ""
},
{
"docid": "4f78b7035eb982aa7ed154286ad20a1a",
"score": "0.55593115",
"text": "def show\n @competence = Competence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competence }\n end\n end",
"title": ""
},
{
"docid": "4f78b7035eb982aa7ed154286ad20a1a",
"score": "0.55593115",
"text": "def show\n @competence = Competence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competence }\n end\n end",
"title": ""
},
{
"docid": "efc6ad8d2ff0413b8eb6c36027716b51",
"score": "0.5558457",
"text": "def index\n begin\n conditions = [\"course_id = ?\",@course.id]\n @holes = Hole.find(:all, :order => 'number', :conditions => conditions)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @holes }\n end\n rescue\n render :layout => 'error', :template => 'errors/error'\n end\n end",
"title": ""
},
{
"docid": "3b1ea06498fbbde4dbdc1723dbdb7cc0",
"score": "0.5553539",
"text": "def index\n expert_opinions = ExpertOpinion.all\n json_response(expert_opinions)\n end",
"title": ""
},
{
"docid": "2986418d37f2b3b0a422e16f610a0e09",
"score": "0.5538859",
"text": "def index\n @opinions = Opinion.all\n end",
"title": ""
},
{
"docid": "2986418d37f2b3b0a422e16f610a0e09",
"score": "0.5538859",
"text": "def index\n @opinions = Opinion.all\n end",
"title": ""
},
{
"docid": "a68fcd9e506f6ef14dcdd3b35a63f87c",
"score": "0.55295366",
"text": "def index\n @elections = Election.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @elections }\n end\n end",
"title": ""
},
{
"docid": "4b3cfe4cf0e64326925772f10c77fbf6",
"score": "0.5527843",
"text": "def index\n @user_competences = UserCompetence.all\n end",
"title": ""
},
{
"docid": "a28c2e60b44f2620f06d413a08a81400",
"score": "0.55220824",
"text": "def index\n @missions = @game.missions\n end",
"title": ""
},
{
"docid": "de0bf9005137b4119b62e51b5923234d",
"score": "0.55163884",
"text": "def index\n \n\t return # not currently used\n\t \n @agcommisions = Agcommision.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @agcommisions }\n end\n end",
"title": ""
},
{
"docid": "39da60215c0f85ea45790165d5196d6f",
"score": "0.5510168",
"text": "def index\n @co_cycle_resps = CoCycleResp.all\n end",
"title": ""
},
{
"docid": "f83491b3d11f8913ad01ed02793c4cc6",
"score": "0.5509477",
"text": "def index\n\n @opinions = Opinion.all\n\n\n end",
"title": ""
},
{
"docid": "e1672527b2635e290db54d7937a6538a",
"score": "0.5502804",
"text": "def index\n @offences = Offence.all\n end",
"title": ""
},
{
"docid": "b0c4a007ddb18e674b3a201893265422",
"score": "0.5498214",
"text": "def index\n @candidates = Candidate.by_election(params[:election_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @candidates }\n end\n end",
"title": ""
},
{
"docid": "c4d9d67cf1b006e8cc0c8a104436a1c2",
"score": "0.5492517",
"text": "def competences\n ApplicationController::srlze object.competences, options\n end",
"title": ""
},
{
"docid": "47dfe2f8d344dd8b2bc21a2d2a736f35",
"score": "0.5489492",
"text": "def index\n # if current_user.admin?\n # @games = Game.all\n # else\n # @games = current_user.games.all\n # end\n # @owned_games = current_user.game_user_joins.owned.map(&:game)\n @owned_games = current_user.games.where(game_user_joins: {owner: true})\n @joined_games = current_user.games.all - @owned_games\n @open_games = Game.where(open: true) - @owned_games - @joined_games\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @open_games }\n end\n end",
"title": ""
},
{
"docid": "ad9a532ca197e570d7d11660168a109a",
"score": "0.54880476",
"text": "def divisions\n if @divisions.nil?\n @divisions = embedded['divisions'].map do |d|\n Lionactor::Division.new(d, @client)\n end\n end\n\n @divisions\n end",
"title": ""
},
{
"docid": "3b4c4eabe0f28bbccfd168e544c4b696",
"score": "0.5483318",
"text": "def available_achievements\n render json: achievements\n end",
"title": ""
},
{
"docid": "b3465cba40ba574f9d30425f32a9fee1",
"score": "0.5483117",
"text": "def index\n @political_parties = PoliticalParty.sorted\n @political_parties = @political_parties.by_election(params[:election_id]) if params[:election_id].present?\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @political_parties }\n end\n end",
"title": ""
},
{
"docid": "ea98b9e458302ad33dde363caa98a58c",
"score": "0.54783064",
"text": "def index\n @defects = Defect.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @defects }\n end\n end",
"title": ""
},
{
"docid": "eb4fa7c57c6fef200046e3b461629f78",
"score": "0.5473762",
"text": "def index\n @company_objectives = CompanyObjective.all\n end",
"title": ""
},
{
"docid": "343c41be6e963c15ff700c0de23eafd9",
"score": "0.54729104",
"text": "def index\n @criterions = Criterion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @criterions }\n end\n end",
"title": ""
},
{
"docid": "71a27acd9941a6ab08f0bfa1d4752a05",
"score": "0.5471186",
"text": "def index\n @occassions = Occassion.all\n end",
"title": ""
},
{
"docid": "92c106a5576a8f6ed8dd12e24826eb9d",
"score": "0.54683524",
"text": "def index\n # @over_achievements = OverAchievement.all\n end",
"title": ""
},
{
"docid": "a0d00727f73767719634e0984b0bd956",
"score": "0.5459638",
"text": "def index\n @ovos = Ovo.all\n end",
"title": ""
},
{
"docid": "c722779dd84fa14a6423affd748a9ccc",
"score": "0.54582125",
"text": "def index\n @collaborations = Collaboration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @collaborations }\n end\n end",
"title": ""
},
{
"docid": "ac6f4d7efd54c468e09239510c9ef752",
"score": "0.54580003",
"text": "def index\n @show_all = @user.is_admin?\n @decisions = @show_all ? Decision.all : current_user.decisions\n @title = \"#{@user.is_admin? ? 'Everybody' : @user.username}'s Decisions\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @decisions }\n end\n end",
"title": ""
},
{
"docid": "f80d7b693de7cf06b348061390dca6e9",
"score": "0.5454471",
"text": "def show\n @competetion_level = CompetetionLevel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competetion_level }\n end\n end",
"title": ""
},
{
"docid": "4377c1534db3f06ce27f99fa0e1e6f23",
"score": "0.5453254",
"text": "def index\n @constitution_mods = ConstitutionMod.all\n\n render json: @constitution_mods\n end",
"title": ""
},
{
"docid": "189ca89328b7893381ac54598dc6881e",
"score": "0.5451942",
"text": "def index\n @spell_circles = SpellCircle.all\n\n render json: @spell_circles\n end",
"title": ""
},
{
"docid": "e8de56a7d8dee32f2e8141f5c4151877",
"score": "0.5450868",
"text": "def show\n @core_competency = CoreCompetency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @core_competency }\n end\n end",
"title": ""
},
{
"docid": "59bd48cf99dbdb6ec627334f7bdd1e2c",
"score": "0.54439527",
"text": "def show\n @concentration = Concentration.find(params[:id])\n @business_sectors = BusinessSector.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @concentration }\n end\n end",
"title": ""
},
{
"docid": "7dceba98bb0684a0104f92d167a183db",
"score": "0.5442271",
"text": "def index\n @missions = Mission.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @missions }\n end\n end",
"title": ""
},
{
"docid": "cbd6cecdc32d99ffabf4c525482f30c3",
"score": "0.5438452",
"text": "def show\n @election = Election.find(params[:id])\n @contests = @election.contests.all\n @candidates = @election.candidates.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @election }\n end\n end",
"title": ""
},
{
"docid": "c017ae0b3933dac7bfe546cd60deed3b",
"score": "0.5436296",
"text": "def show\n render json: { contact: @contact, occasions: @contact.occasions }\n end",
"title": ""
},
{
"docid": "de90c1bc668e199525ee6aff786d3e10",
"score": "0.543148",
"text": "def index\n @representatives = current_company.representatives\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @representatives }\n end\n end",
"title": ""
},
{
"docid": "c1748921c7c0fdb4e337f8b86a3ff798",
"score": "0.54304045",
"text": "def index\n @absences = @employee.absences\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @absences }\n end\n end",
"title": ""
},
{
"docid": "e9fce682da467779e67e9eceb825119a",
"score": "0.54297864",
"text": "def index\n @potions = Potion.where(owner: params[:owner])\n render json: @potions\n end",
"title": ""
},
{
"docid": "56550e6df3d7fdd29d60cfa9d279f41b",
"score": "0.5426228",
"text": "def index\n @v1_orgnaizations = V1::Orgnaization.all\n end",
"title": ""
},
{
"docid": "a1e86b61ac545c6c93fb7ab6157be36c",
"score": "0.5424095",
"text": "def index\n @socio_cnhs = SocioCnh.all\n end",
"title": ""
},
{
"docid": "8b629a9dfa024ea63a7056ed18ae4f4d",
"score": "0.542256",
"text": "def index\n\t @elections = Election.all\n\n\t respond_to do |format|\n\t format.html # index.html.erb\n\t format.json { render json: @elections }\n\t end\n end",
"title": ""
},
{
"docid": "2253a552405c3a5bdb13b5849eefcd1f",
"score": "0.54184806",
"text": "def index\n @competencies = Competency.all\n end",
"title": ""
},
{
"docid": "2253a552405c3a5bdb13b5849eefcd1f",
"score": "0.54184806",
"text": "def index\n @competencies = Competency.all\n end",
"title": ""
},
{
"docid": "3c21f093236db7f335b3445c052b91a3",
"score": "0.5403377",
"text": "def index\n if current_user.nil?\n render 'public/404.html', layout: false\n end\n @officerships = Officership.all\n end",
"title": ""
},
{
"docid": "2eee354e124269f3daac24819d874af7",
"score": "0.5399268",
"text": "def index\n @point_of_interests = PointOfInterest.where(company_id: find_owner_company_id)\n\n render json: @point_of_interests, root: 'pois'\n end",
"title": ""
},
{
"docid": "c16eec8a5cb7810f2751865cc02f62ec",
"score": "0.5398929",
"text": "def show\n @overlap = Overlap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @overlap }\n end\n end",
"title": ""
},
{
"docid": "7d205d97268756300ddb0081405b4609",
"score": "0.53974295",
"text": "def index\n @competition = Competition.find(params[:competition_id])\n @competitors = @competition.competitors.all\n end",
"title": ""
},
{
"docid": "1776f4fdb9459e8c1ff2f296b979f7c4",
"score": "0.53970313",
"text": "def index\n @opportunities = current_company.opportunities\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @opportunities }\n end\n end",
"title": ""
},
{
"docid": "9fe5b74350eb744599a9ac97ec3148b4",
"score": "0.53965926",
"text": "def index\n @companies = current_user.company.agencies\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end",
"title": ""
},
{
"docid": "163f8e0491a453645af5db72fe2b9057",
"score": "0.53943765",
"text": "def show\n @competitor = Competitor.find(params[:id])\n @competitors = Competitor.by_elo.limit(10)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @competitor }\n end\n end",
"title": ""
},
{
"docid": "8f901bea7b876cdc2e387bc7a0b90b2f",
"score": "0.5390472",
"text": "def index\n @orginizations = Orginization.all\n end",
"title": ""
},
{
"docid": "2fb430a72c9dc503ea6257767b98f542",
"score": "0.5389879",
"text": "def index\n @opponents = Opponent.all\n end",
"title": ""
},
{
"docid": "12de999e483afed7488a971a46813b5f",
"score": "0.5387051",
"text": "def competitors(options = {})\n options.merge!({:query_type => 'company_competitors'})\n self.class.get(\"/\", :query => options)\n end",
"title": ""
},
{
"docid": "b4ba2dfe22480d057d0670175ec3bd05",
"score": "0.53796685",
"text": "def index\n @divisions = @project.divisions\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @divisions }\n end\n end",
"title": ""
},
{
"docid": "44ba4a0904fef4ef96490c1f0987cd27",
"score": "0.5373221",
"text": "def index\n @candidates = Candidate.all\n\n render json: @candidates\n end",
"title": ""
},
{
"docid": "48ccca0aec161c34ca55784f74008f2d",
"score": "0.53666353",
"text": "def index\n @agile_labors = AgileLabor.all\n @current_labors = current_user.agile_labors.current_labors\n @backlogged_labors = current_user.agile_labors.backlogged\n @iceboxed_labors = current_user.agile_labors.iceboxed\n end",
"title": ""
},
{
"docid": "d57a0cc880435c37e76beda8a8d5bfa4",
"score": "0.5364064",
"text": "def index\n @osmotics = Osmotic.all\n end",
"title": ""
},
{
"docid": "818e05de380d8350a68f7c5b149d671a",
"score": "0.53627264",
"text": "def index\n @opinions = @replied.opinions.paginate(page: params[:page])\n render json: @opinions\n end",
"title": ""
},
{
"docid": "d25b7c37c1678136361a6f6074c99e6b",
"score": "0.535861",
"text": "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @circulation_status }\n end\n end",
"title": ""
},
{
"docid": "bf3e96a9db57929f4a0ebf930d191e4c",
"score": "0.5353921",
"text": "def index\n @involvements = Involvement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @involvements }\n end\n end",
"title": ""
},
{
"docid": "2bdf9bc9e23a44f3ca97397d40dc7ffe",
"score": "0.5349414",
"text": "def index\n @councils = Council.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @councils }\n end\n end",
"title": ""
},
{
"docid": "cf74e6fa1b84820d48ca253f1e9b5df0",
"score": "0.53411484",
"text": "def show\n @colaboration_area = ColaborationArea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colaboration_area }\n end\n end",
"title": ""
},
{
"docid": "2e0ae8ea08891cd7890ee7a47be1601a",
"score": "0.533996",
"text": "def index\n @organizations = Organization.all\n\n render json: @organizations\n end",
"title": ""
},
{
"docid": "2e0ae8ea08891cd7890ee7a47be1601a",
"score": "0.533996",
"text": "def index\n @organizations = Organization.all\n\n render json: @organizations\n end",
"title": ""
},
{
"docid": "796dc6561482fe0dc848d4f4030eb965",
"score": "0.5336579",
"text": "def index\n @candidates = Candidate.all\n respond_to do |format|\n format.json { render :json => @candidates }\n end\n end",
"title": ""
},
{
"docid": "03669196a7b0ff47a7581777310c2ec9",
"score": "0.5335432",
"text": "def index\n @loceods = Loceod.all\n end",
"title": ""
},
{
"docid": "b2a6e2def703542ad106fd14e876f6e2",
"score": "0.53292614",
"text": "def index\n init_oco if !session[:organization]\n if session[:organization] != '0'\n @collective_agreements = CollectiveAgreement.where(organization_id: session[:organization]).paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n else\n @collective_agreements = CollectiveAgreement.paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @collective_agreements }\n end\n end",
"title": ""
},
{
"docid": "181b8e653c22084d8774815f71faaac1",
"score": "0.53243095",
"text": "def index\n @competence_types = CompetenceType.all\n end",
"title": ""
},
{
"docid": "cecd9f1e80f7455b380bf608ccd65006",
"score": "0.5324176",
"text": "def index\n @experience_occurances = ExperienceOccurance.all\n end",
"title": ""
},
{
"docid": "65b12acb99e698441d16c55ead97c52d",
"score": "0.5321881",
"text": "def index\n @traits = Trait.all\n\n render json: @traits\n end",
"title": ""
},
{
"docid": "7b13f289d22c2af9ae8f2105e154b8a7",
"score": "0.5320133",
"text": "def index\n @loco_evaluations = LocoEvaluation.all\n end",
"title": ""
},
{
"docid": "c005817a26c9e7f89e3062e951dcab32",
"score": "0.5320056",
"text": "def index\n @cages = Cage.where(query_params)\n render json: @cages\n end",
"title": ""
}
] |
77613ac9c590efbedefc46f0da466303
|
GET /specializations/new GET /specializations/new.xml
|
[
{
"docid": "a8a7467b79c0bc10abe33303ca174045",
"score": "0.7432959",
"text": "def new\n @specialization = Specialization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @specialization }\n end\n end",
"title": ""
}
] |
[
{
"docid": "6f7a4c900b0b10e925072578d6cca4ea",
"score": "0.71622145",
"text": "def new\n @specie = Species.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @specie }\n end\n end",
"title": ""
},
{
"docid": "83598f47d29b2b98365c01ecc0804984",
"score": "0.6998637",
"text": "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @specification }\n end\n end",
"title": ""
},
{
"docid": "83598f47d29b2b98365c01ecc0804984",
"score": "0.6998637",
"text": "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @specification }\n end\n end",
"title": ""
},
{
"docid": "70d3b0fc9c7803c54d5615e388db8e09",
"score": "0.69636273",
"text": "def new\n @specification = Specification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @specification }\n end\n end",
"title": ""
},
{
"docid": "7d74f62f0b88568b21301cfb0cbf3e8e",
"score": "0.6938003",
"text": "def new\n @species = Species.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @species }\n end\n end",
"title": ""
},
{
"docid": "f0fea292624df09c902f0d2da9175091",
"score": "0.6676525",
"text": "def new\n @test_specification = TestSpecification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @test_specification }\n end\n end",
"title": ""
},
{
"docid": "94ceaaf9250cdc3d062aeb18bbab1a52",
"score": "0.66666174",
"text": "def new\n @newstuff = Newstuff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @newstuff }\n end\n end",
"title": ""
},
{
"docid": "db57367ca4f2a6d1db2e38b029e1ecf7",
"score": "0.6618515",
"text": "def new\n @specificaton = Specificaton.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @specificaton }\n end\n end",
"title": ""
},
{
"docid": "70a29d8cfd81e44a1fba682dabd19d94",
"score": "0.6557071",
"text": "def new\n @pet_type = PetType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pet_type }\n end\n end",
"title": ""
},
{
"docid": "51e495fda620a9aba14aab1fb7b6b537",
"score": "0.6546223",
"text": "def new\n @spec_attribute = SpecAttribute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @spec_attribute }\n end\n end",
"title": ""
},
{
"docid": "2edaa98a78ff322f67677f6455e30fb3",
"score": "0.65357786",
"text": "def new\n @spec = Spec.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spec }\n end\n end",
"title": ""
},
{
"docid": "35a151f47edee959fe071a0112e8a8ad",
"score": "0.6535315",
"text": "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @part }\n end\n end",
"title": ""
},
{
"docid": "23cdde8d4b1a2be0bc3eecca07b39e74",
"score": "0.6504373",
"text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end",
"title": ""
},
{
"docid": "2048827e02580f8ffaa44b0f7f865b41",
"score": "0.65011775",
"text": "def new\n @part_type = PartType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @part_type }\n end\n end",
"title": ""
},
{
"docid": "72704808567a3660b7305d8790efdac1",
"score": "0.64907885",
"text": "def new\n @collection_thing = CollectionThing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collection_thing }\n end\n end",
"title": ""
},
{
"docid": "7bfa3f5c81b02571b736e2877ede6fe7",
"score": "0.6474182",
"text": "def new\n @vet_specialty = VetSpecialty.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vet_specialty }\n end\n end",
"title": ""
},
{
"docid": "ef0488cc3bb45e57c88d66dc2c098308",
"score": "0.6468329",
"text": "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @specification_group }\n end\n end",
"title": ""
},
{
"docid": "08fb690d6790d6c5dfee541833f74928",
"score": "0.6468075",
"text": "def new\n @speciman = Speciman.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @speciman }\n end\n end",
"title": ""
},
{
"docid": "dc09df5ef7d49a3f79f12d53de7f902d",
"score": "0.64635193",
"text": "def new #DESC: Crear nuevos talento.\n @talento = Talento.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @talento }\n end\n end",
"title": ""
},
{
"docid": "c94f5aea6f11800402163079cbd837ec",
"score": "0.6456381",
"text": "def new\n @especie = Especie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @especie }\n end\n end",
"title": ""
},
{
"docid": "13c1a64e8209192c076f6c8c0266b10b",
"score": "0.6455154",
"text": "def new\n @people = People.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @people }\n end\n end",
"title": ""
},
{
"docid": "91f6cb7da866b604b00c9ac68b60e0ef",
"score": "0.64370376",
"text": "def new\n @cattype = Cattype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cattype }\n end\n end",
"title": ""
},
{
"docid": "2cda636ee7a969364ea02bc1e2338fea",
"score": "0.64204675",
"text": "def new\n @choice = Choice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @choice }\n end\n end",
"title": ""
},
{
"docid": "2b1d98cd97769e4087f23bb2c20747ea",
"score": "0.6415371",
"text": "def new\n @part = Part.new\n @part_types = PartType.all\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @part }\n end\n end",
"title": ""
},
{
"docid": "f61eccff62dd79007ac2ed26c849fa55",
"score": "0.64082617",
"text": "def new\n @pet = Pet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pet }\n end\n end",
"title": ""
},
{
"docid": "f61eccff62dd79007ac2ed26c849fa55",
"score": "0.64081",
"text": "def new\n @pet = Pet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pet }\n end\n end",
"title": ""
},
{
"docid": "cf8ba412aaad4be46f8d76835d454fe8",
"score": "0.640085",
"text": "def new\n @participation_type = ParticipationType.new(ParticipationType::RDF_PARTICIPATION_TYPE_NEW_URI, \"\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @participation_type }\n end\n end",
"title": ""
},
{
"docid": "99ea754d5d910e73ad03238a716c82ad",
"score": "0.6392881",
"text": "def new\n @part = Part.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @part }\n end\n end",
"title": ""
},
{
"docid": "99ea754d5d910e73ad03238a716c82ad",
"score": "0.6392881",
"text": "def new\n @part = Part.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @part }\n end\n end",
"title": ""
},
{
"docid": "9a8e44dede8ab475baa762ff57f8a688",
"score": "0.63912493",
"text": "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @product_specification }\n end\n end",
"title": ""
},
{
"docid": "8b4e44185b3f39b550fa325139fa6e7d",
"score": "0.63874453",
"text": "def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing }\n end\n end",
"title": ""
},
{
"docid": "8b4e44185b3f39b550fa325139fa6e7d",
"score": "0.63874453",
"text": "def new\n @thing = Thing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing }\n end\n end",
"title": ""
},
{
"docid": "0ba707c5683fac93c535545c609922aa",
"score": "0.63800055",
"text": "def new\n @cat = Cat.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cat }\n end\n end",
"title": ""
},
{
"docid": "5bd6322e526272287d3e94ff14046ad3",
"score": "0.6355639",
"text": "def new\n @plant_template = PlantTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @plant_template }\n end\n end",
"title": ""
},
{
"docid": "91020c12f63ed0ef5309c9b7db443a9e",
"score": "0.6348659",
"text": "def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recipe }\n end\n end",
"title": ""
},
{
"docid": "91020c12f63ed0ef5309c9b7db443a9e",
"score": "0.6348659",
"text": "def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recipe }\n end\n end",
"title": ""
},
{
"docid": "91020c12f63ed0ef5309c9b7db443a9e",
"score": "0.6348659",
"text": "def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recipe }\n end\n end",
"title": ""
},
{
"docid": "91020c12f63ed0ef5309c9b7db443a9e",
"score": "0.6348659",
"text": "def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recipe }\n end\n end",
"title": ""
},
{
"docid": "91020c12f63ed0ef5309c9b7db443a9e",
"score": "0.6348659",
"text": "def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recipe }\n end\n end",
"title": ""
},
{
"docid": "0216144750bba4b160468bf6163b9432",
"score": "0.6347865",
"text": "def new\n @tiposcaracteristica = Tiposcaracteristica.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tiposcaracteristica }\n end\n end",
"title": ""
},
{
"docid": "cdae62e94642c56fe758af59b578c208",
"score": "0.63477373",
"text": "def new\n @lectura = Lectura.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lectura }\n end\n end",
"title": ""
},
{
"docid": "c2be97fc25bcb6dfdc4a609505922b85",
"score": "0.6335169",
"text": "def new\n @resource_type = ResourceType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @resource_type }\n format.xml { render :xml => @resource_type }\n end\n end",
"title": ""
},
{
"docid": "a121c5a9bf593d04ae642680c093ac24",
"score": "0.63322395",
"text": "def new\n @election = Election.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @election }\n end\n end",
"title": ""
},
{
"docid": "f1a58ac0c055f5801dd6897220a22286",
"score": "0.6329812",
"text": "def new\n @slit_spec = SlitSpec.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @slit_spec }\n end\n end",
"title": ""
},
{
"docid": "9cb378f2553d12b9bbb0f99a9b40ed3b",
"score": "0.6325894",
"text": "def new_rest\n @entry_question = EntryQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry_question }\n end\n end",
"title": ""
},
{
"docid": "f20c3691b027f76aa5a0487eca3c4c7a",
"score": "0.63200366",
"text": "def new\n @vet = Vet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vet }\n end\n end",
"title": ""
},
{
"docid": "747cb048f0097da3178a91be2fc02fef",
"score": "0.63165116",
"text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @type }\n end\n end",
"title": ""
},
{
"docid": "d364e92db1692a7f0e8dc70d5b0079ea",
"score": "0.6315552",
"text": "def new\n @version = @page.versions.new\n\n respond_to do |format|a\n format.html # new.html.erb\n format.xml { render :xml => @version }\n end\n end",
"title": ""
},
{
"docid": "c2c496dfcd1d9bc44e095758667345bf",
"score": "0.63088614",
"text": "def new\n @patch = Patch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patch }\n end\n end",
"title": ""
},
{
"docid": "c2c496dfcd1d9bc44e095758667345bf",
"score": "0.63088614",
"text": "def new\n @patch = Patch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patch }\n end\n end",
"title": ""
},
{
"docid": "1cb4beae4b85af05dfbb33e756b46b0c",
"score": "0.6289066",
"text": "def new\n @poet = Poet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @poet }\n end\n end",
"title": ""
},
{
"docid": "5a55b848245a2a7ef79c19389eeb88dd",
"score": "0.62885153",
"text": "def new\n @catalogs_resource = Catalogs::Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalogs_resource }\n end\n end",
"title": ""
},
{
"docid": "a5fba027873b2cfbc18ac5d06dda6d9e",
"score": "0.6280629",
"text": "def new\n @society = Society.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @society }\n end\n end",
"title": ""
},
{
"docid": "fdce56494ef0700b0866e1bbc2688257",
"score": "0.62762356",
"text": "def new\n @caracteristica = Caracteristica.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @caracteristica }\n end\n end",
"title": ""
},
{
"docid": "fdce56494ef0700b0866e1bbc2688257",
"score": "0.62762356",
"text": "def new\n @caracteristica = Caracteristica.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @caracteristica }\n end\n end",
"title": ""
},
{
"docid": "18a910a0c98bf131fc1934568f209449",
"score": "0.6273652",
"text": "def new\n @feed_spec = FeedSpec.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feed_spec }\n end\n end",
"title": ""
},
{
"docid": "d2321482716ff91720ed014f90dc8925",
"score": "0.62734365",
"text": "def new\n @specs_status = SpecsStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @specs_status }\n end\n end",
"title": ""
},
{
"docid": "35ad7c9c2d8c1b5fc54560c101b5d472",
"score": "0.6268515",
"text": "def new\n @type = Type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @type }\n end\n end",
"title": ""
},
{
"docid": "35ad7c9c2d8c1b5fc54560c101b5d472",
"score": "0.6268515",
"text": "def new\n @type = Type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @type }\n end\n end",
"title": ""
},
{
"docid": "5196007cd42c80156c69206c11776d70",
"score": "0.62680185",
"text": "def new\n @new_vehicle = NewVehicle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @new_vehicle }\n end\n end",
"title": ""
},
{
"docid": "ce4b29a7ade0124905432e0eb17b0e12",
"score": "0.6264351",
"text": "def new\n @tag = Tag.new\n\n respond_to do |wants|\n wants.html # new.html.erb\n wants.xml { render :xml => @tag }\n end\n end",
"title": ""
},
{
"docid": "cf5e6954fbd243f808c021bbfe28a03d",
"score": "0.62619483",
"text": "def new\n @criteria = Criteria.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @criteria }\n end\n end",
"title": ""
},
{
"docid": "0d1b931f592c1189aed9ad990fc009a0",
"score": "0.62615764",
"text": "def new\n @division = Division.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @division }\n end\n end",
"title": ""
},
{
"docid": "a0381c42e91e2a7b329e5aa6d5fb73e2",
"score": "0.62580353",
"text": "def new\n @what_new = WhatNew.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @what_new }\n end\n end",
"title": ""
},
{
"docid": "36cef25a22e1eeb4abe619fd2192b234",
"score": "0.6255712",
"text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @artist_tier }\n end\n end",
"title": ""
},
{
"docid": "86d7e5001304b2ec899dc066855630ce",
"score": "0.6254695",
"text": "def new\n @collection = Collection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collection }\n end\n end",
"title": ""
},
{
"docid": "86d7e5001304b2ec899dc066855630ce",
"score": "0.6254695",
"text": "def new\n @collection = Collection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collection }\n end\n end",
"title": ""
},
{
"docid": "86d7e5001304b2ec899dc066855630ce",
"score": "0.6254695",
"text": "def new\n @collection = Collection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collection }\n end\n end",
"title": ""
},
{
"docid": "03ee4d9f647cc42ed5ce6338af8b6623",
"score": "0.62543905",
"text": "def new\n @factlect = Factlect.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @factlect }\n end\n end",
"title": ""
},
{
"docid": "31c35aa4cee2839afc75efbd34be448d",
"score": "0.62543297",
"text": "def new\n @pig = Pig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pig }\n end\n end",
"title": ""
},
{
"docid": "fd82c0be67ab72bcc93704a7885fda38",
"score": "0.6253856",
"text": "def new\n @testing = Testing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @testing }\n end\n end",
"title": ""
},
{
"docid": "a2a6800af16e8c661c220b0a1c3dc26c",
"score": "0.62533027",
"text": "def new\n @fuel_type = FuelType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fuel_type }\n end\n end",
"title": ""
},
{
"docid": "16b9569dda70acebb63f5bd8a1a2b09a",
"score": "0.62524015",
"text": "def new_rest\n @page_usage = PageUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page_usage }\n end\n end",
"title": ""
},
{
"docid": "39179f71677196371e2c8091ae965886",
"score": "0.62522244",
"text": "def new\n @specialty = Specialty.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @specialty }\n end\n end",
"title": ""
},
{
"docid": "41433d74e36719684775ad2d50c3eabe",
"score": "0.62489736",
"text": "def new\n @new = New.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @new }\n end\n end",
"title": ""
},
{
"docid": "b7b933afdd3b3166f0ce369fa8d91846",
"score": "0.6246442",
"text": "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @vip_programmer_location }\n end\n end",
"title": ""
},
{
"docid": "53c50f5ddcc3691230e4070995a8e469",
"score": "0.62426287",
"text": "def new\n pftsspecies = PftsSpecies.new\n\n respond_to do |format|\n format.xml { render :xml => pftsspecies }\n format.csv { render :csv => pftsspecies }\n format.json { render :json => pftsspecies }\n end\n end",
"title": ""
},
{
"docid": "c5d95a399bd00af711876ab3ad8485c6",
"score": "0.6229348",
"text": "def new\n @type = Type.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @type }\n end\n end",
"title": ""
},
{
"docid": "14887aefefd484ce71597351d4a0d731",
"score": "0.6228916",
"text": "def new\n @contacter = Contacter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contacter }\n end\n end",
"title": ""
},
{
"docid": "e27ddbb6cbcb896deeaa7368175b2718",
"score": "0.6222474",
"text": "def new_rest\n @v1_data_element = V1DataElement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @v1_data_element }\n end\n end",
"title": ""
},
{
"docid": "dd413f9968a216bc33c228c50c02d001",
"score": "0.62214965",
"text": "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @contact_territory }\n end\n end",
"title": ""
},
{
"docid": "496f4e1979106575a785ea173c0a5c87",
"score": "0.6220361",
"text": "def new\n @specification_field = SpecificationField.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @specification_field }\n end\n end",
"title": ""
},
{
"docid": "a32956928f961632506764184a58a306",
"score": "0.6219284",
"text": "def new\n @tlectura = Tlectura.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tlectura }\n end\n end",
"title": ""
},
{
"docid": "0a795f118de917440dfb1b58ade51675",
"score": "0.6218586",
"text": "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @brand }\n end\n end",
"title": ""
},
{
"docid": "559997f005899f47a7514517bf9355d7",
"score": "0.62174934",
"text": "def new\n @major = Major.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @major }\n end\n end",
"title": ""
},
{
"docid": "4a76a8df197da01a12918a6a4835ef50",
"score": "0.6212906",
"text": "def new\r\n @recipe = Recipe.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @recipe }\r\n end\r\n end",
"title": ""
},
{
"docid": "b662c61eae8fc1ac76c3125e09cb3525",
"score": "0.62109065",
"text": "def new\n @make = Make.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @make }\n end\n end",
"title": ""
},
{
"docid": "dcd128bd19731c78901e1cee41681295",
"score": "0.6208281",
"text": "def new\n @petsitter = Petsitter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @petsitter }\n end\n end",
"title": ""
},
{
"docid": "360d6bc2926b75154ae9636f9ee14cd4",
"score": "0.6204451",
"text": "def new\n @my_collection = MyCollection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @my_collection }\n end\n end",
"title": ""
},
{
"docid": "02d8ca928dfd49f464234b41db3795c8",
"score": "0.6195476",
"text": "def new\n @taxonomy = Taxonomy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @taxonomy }\n end\n end",
"title": ""
},
{
"docid": "0186de454da1bbacc0c0e11f5e4361ac",
"score": "0.6195287",
"text": "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end",
"title": ""
},
{
"docid": "0186de454da1bbacc0c0e11f5e4361ac",
"score": "0.6195287",
"text": "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end",
"title": ""
},
{
"docid": "0186de454da1bbacc0c0e11f5e4361ac",
"score": "0.6195287",
"text": "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end",
"title": ""
},
{
"docid": "0186de454da1bbacc0c0e11f5e4361ac",
"score": "0.6195287",
"text": "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end",
"title": ""
},
{
"docid": "0186de454da1bbacc0c0e11f5e4361ac",
"score": "0.6195287",
"text": "def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end",
"title": ""
},
{
"docid": "e284720809fd9693be4160c34e056810",
"score": "0.6195227",
"text": "def new\n @lookup_set = LookupSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_set }\n end\n end",
"title": ""
},
{
"docid": "046f5704fd2dd93804bc25010619928c",
"score": "0.61935365",
"text": "def new\n @tagtype = Tagtype.new\n\t@title = \"New tag type\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tagtype }\n end\n end",
"title": ""
},
{
"docid": "cb900df92dcedc5e3b95042c7c045ac8",
"score": "0.61931187",
"text": "def new\n @study_template = StudyTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @study_template }\n end\n end",
"title": ""
},
{
"docid": "2f550ad824c54b6b03d96796842aa20b",
"score": "0.6181551",
"text": "def new\n @prospect = Prospect.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prospect }\n end\n end",
"title": ""
},
{
"docid": "8cae0f9f2ad3ac614828b8747fefe0ec",
"score": "0.6181379",
"text": "def new\n @competence = Competence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @competence }\n end\n end",
"title": ""
}
] |
e7dc53463ed43fc0f9868a209fc7a052
|
rubocop:enable Metrics/MethodLength rubocop:enable Metrics/LineLength rubocop:enable Metrics/AbcSize
|
[
{
"docid": "95f13881f91ef26e0fca8e31b3698dd4",
"score": "0.0",
"text": "def visits_by_day\n render json: Ahoy::Visit.this_month.group_by_day(:started_at).count\n end",
"title": ""
}
] |
[
{
"docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1",
"score": "0.77017593",
"text": "def private; end",
"title": ""
},
{
"docid": "0b8b7b9666e4ed32bfd448198778e4e9",
"score": "0.63603234",
"text": "def probers; end",
"title": ""
},
{
"docid": "3660c5f35373aec34a5a7b0869a4a8bd",
"score": "0.62909",
"text": "def implementation; end",
"title": ""
},
{
"docid": "3660c5f35373aec34a5a7b0869a4a8bd",
"score": "0.62909",
"text": "def implementation; end",
"title": ""
},
{
"docid": "65ffca17e416f77c52ce148aeafbd826",
"score": "0.61621577",
"text": "def schubert; end",
"title": ""
},
{
"docid": "d8ae3e2b236950074c4632d180274b8a",
"score": "0.61554575",
"text": "def specie; end",
"title": ""
},
{
"docid": "d8ae3e2b236950074c4632d180274b8a",
"score": "0.61554575",
"text": "def specie; end",
"title": ""
},
{
"docid": "d8ae3e2b236950074c4632d180274b8a",
"score": "0.61554575",
"text": "def specie; end",
"title": ""
},
{
"docid": "d8ae3e2b236950074c4632d180274b8a",
"score": "0.61554575",
"text": "def specie; end",
"title": ""
},
{
"docid": "2cc9969eb7789e4fe75844b6f57cb6b4",
"score": "0.61205065",
"text": "def refutal()\n end",
"title": ""
},
{
"docid": "a02f7382c73eef08b14f38d122f7bdb9",
"score": "0.592451",
"text": "def custom; end",
"title": ""
},
{
"docid": "a02f7382c73eef08b14f38d122f7bdb9",
"score": "0.592451",
"text": "def custom; end",
"title": ""
},
{
"docid": "0a39799e76643367f1b6bfac65569895",
"score": "0.5885952",
"text": "def used?; end",
"title": ""
},
{
"docid": "d88aeca0eb7d8aa34789deeabc5063cf",
"score": "0.5847999",
"text": "def offences_by; end",
"title": ""
},
{
"docid": "06b6203baf3c9311f502228839c5ab4e",
"score": "0.5830973",
"text": "def intensifier; end",
"title": ""
},
{
"docid": "005e6fc140cba1f79535dcb415d4bcd9",
"score": "0.5828887",
"text": "def strategy; end",
"title": ""
},
{
"docid": "530e65cba197567f73b8125444ac33cc",
"score": "0.581092",
"text": "def private_method\n end",
"title": ""
},
{
"docid": "6a6ed5368f43a25fb9264e65117fa7d1",
"score": "0.58054453",
"text": "def internal; end",
"title": ""
},
{
"docid": "ad244bd0c45d5d9274f7612fa6fee986",
"score": "0.58046687",
"text": "def suivre; end",
"title": ""
},
{
"docid": "072514f3348fe62556dcdfd4b06e3d08",
"score": "0.5754132",
"text": "def spec; end",
"title": ""
},
{
"docid": "072514f3348fe62556dcdfd4b06e3d08",
"score": "0.5754132",
"text": "def spec; end",
"title": ""
},
{
"docid": "bb2cf20999efd9fcacf7668301ebe565",
"score": "0.5749588",
"text": "def missing; end",
"title": ""
},
{
"docid": "7ff2011fa3dc45585a9272310eafb765",
"score": "0.574158",
"text": "def isolated; end",
"title": ""
},
{
"docid": "7ff2011fa3dc45585a9272310eafb765",
"score": "0.574158",
"text": "def isolated; end",
"title": ""
},
{
"docid": "2dbabd0eeb642c38aad852e40fc6aca7",
"score": "0.57230395",
"text": "def operations; end",
"title": ""
},
{
"docid": "2dbabd0eeb642c38aad852e40fc6aca7",
"score": "0.57230395",
"text": "def operations; end",
"title": ""
},
{
"docid": "cdd16ea92eae0350ca313fc870e10526",
"score": "0.56984675",
"text": "def who_we_are\r\n end",
"title": ""
},
{
"docid": "a29c5ce532d6df480df4217790bc5fc7",
"score": "0.5695476",
"text": "def extra; end",
"title": ""
},
{
"docid": "991b6f12a63ef51664b84eb729f67eed",
"score": "0.56729484",
"text": "def formation; end",
"title": ""
},
{
"docid": "5ec366fbdcda59614c9cf8751dff8a08",
"score": "0.56496376",
"text": "def celebration; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.5647993",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.5647993",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.5647993",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.5647993",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.5647993",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.5647993",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.5647993",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.5647993",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.5647993",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.5647993",
"text": "def initialize; end",
"title": ""
},
{
"docid": "27b17d3efbfa96fcae1899acb992e406",
"score": "0.5647993",
"text": "def initialize; end",
"title": ""
},
{
"docid": "a67c8aefa80f5367822530a6ee72a3df",
"score": "0.56360316",
"text": "def requirements; end",
"title": ""
},
{
"docid": "a67c8aefa80f5367822530a6ee72a3df",
"score": "0.56360316",
"text": "def requirements; end",
"title": ""
},
{
"docid": "a67c8aefa80f5367822530a6ee72a3df",
"score": "0.56360316",
"text": "def requirements; end",
"title": ""
},
{
"docid": "a67c8aefa80f5367822530a6ee72a3df",
"score": "0.56360316",
"text": "def requirements; end",
"title": ""
},
{
"docid": "8742865b78eb755e40bb1bff22199433",
"score": "0.5633999",
"text": "def internship_passed; end",
"title": ""
},
{
"docid": "bc658f9936671408e02baa884ac86390",
"score": "0.562257",
"text": "def anchored; end",
"title": ""
},
{
"docid": "cdd58dace22c11a7043a695fbef6319a",
"score": "0.5611376",
"text": "def initialize\n\n end",
"title": ""
},
{
"docid": "cdd58dace22c11a7043a695fbef6319a",
"score": "0.5611376",
"text": "def initialize\n\n end",
"title": ""
},
{
"docid": "07388179527877105fd7246db2b49188",
"score": "0.56050235",
"text": "def villian; end",
"title": ""
},
{
"docid": "0eb3d9fe5f9f25d5d4681707022b9ab6",
"score": "0.55845386",
"text": "def ignores; end",
"title": ""
},
{
"docid": "2d8d9f0527a44cd0febc5d6cbb3a22f2",
"score": "0.5577717",
"text": "def weber; end",
"title": ""
},
{
"docid": "d882f3a248ba33088a4284a47c263d0d",
"score": "0.55702555",
"text": "def missing?; end",
"title": ""
},
{
"docid": "14187174b07e4c51e8d38b1dd3593d4a",
"score": "0.55642754",
"text": "def macro; raise NotImplementedError; end",
"title": ""
},
{
"docid": "14187174b07e4c51e8d38b1dd3593d4a",
"score": "0.55642754",
"text": "def macro; raise NotImplementedError; end",
"title": ""
},
{
"docid": "14187174b07e4c51e8d38b1dd3593d4a",
"score": "0.55642754",
"text": "def macro; raise NotImplementedError; end",
"title": ""
},
{
"docid": "d88825898c6b9898e549cc4320aeaf0a",
"score": "0.5560695",
"text": "def initialize\n \n end",
"title": ""
},
{
"docid": "d5b2c651ef02f091c61a5639e05783d2",
"score": "0.55490154",
"text": "def initialize\n \n end",
"title": ""
},
{
"docid": "cf2231631bc862eb0c98d89194d62a88",
"score": "0.5544012",
"text": "def identify; end",
"title": ""
},
{
"docid": "e6431ff47476c9014fb64198d5853e1e",
"score": "0.5538181",
"text": "def overrides; end",
"title": ""
},
{
"docid": "30db4e5d165a6098d1aeb8f8dd7b66e8",
"score": "0.55250627",
"text": "def initialize() end",
"title": ""
},
{
"docid": "bd395ef5570ec94ad67ca3120a943fca",
"score": "0.5522615",
"text": "def operation; end",
"title": ""
},
{
"docid": "99c45295b028f717a8585f1d17d2245e",
"score": "0.5514988",
"text": "def ignore; end",
"title": ""
},
{
"docid": "8e10117902ff3282a42ea5b72dde9df5",
"score": "0.5512487",
"text": "def initialize\n end",
"title": ""
},
{
"docid": "8e10117902ff3282a42ea5b72dde9df5",
"score": "0.5512487",
"text": "def initialize\n end",
"title": ""
},
{
"docid": "8e10117902ff3282a42ea5b72dde9df5",
"score": "0.5512487",
"text": "def initialize\n end",
"title": ""
},
{
"docid": "8e10117902ff3282a42ea5b72dde9df5",
"score": "0.5512487",
"text": "def initialize\n end",
"title": ""
},
{
"docid": "8e10117902ff3282a42ea5b72dde9df5",
"score": "0.5512487",
"text": "def initialize\n end",
"title": ""
},
{
"docid": "8e10117902ff3282a42ea5b72dde9df5",
"score": "0.5512487",
"text": "def initialize\n end",
"title": ""
},
{
"docid": "8e10117902ff3282a42ea5b72dde9df5",
"score": "0.5512487",
"text": "def initialize\n end",
"title": ""
},
{
"docid": "8e10117902ff3282a42ea5b72dde9df5",
"score": "0.5512487",
"text": "def initialize\n end",
"title": ""
},
{
"docid": "8e10117902ff3282a42ea5b72dde9df5",
"score": "0.5512487",
"text": "def initialize\n end",
"title": ""
},
{
"docid": "8e10117902ff3282a42ea5b72dde9df5",
"score": "0.5512487",
"text": "def initialize\n end",
"title": ""
},
{
"docid": "41f058c46bfa2f9ee34b89cd410c3094",
"score": "0.5510261",
"text": "def code_of_conduct; end",
"title": ""
},
{
"docid": "18250542a2b1999be90588db1d071d92",
"score": "0.5506568",
"text": "def initialize\n\t\t\n\tend",
"title": ""
},
{
"docid": "4a8a45e636a05760a8e8c55f7aa1c766",
"score": "0.55035806",
"text": "def terpene; end",
"title": ""
},
{
"docid": "e524ba185c05b88d0475b0fc4d95cde9",
"score": "0.5499114",
"text": "def common\n \n end",
"title": ""
},
{
"docid": "13289d4d24c54cff8b70fcaefc85384e",
"score": "0.54962033",
"text": "def verdi; end",
"title": ""
},
{
"docid": "f1736df8e6642c2eeb78e4b30e5cf678",
"score": "0.54923934",
"text": "def from; end",
"title": ""
},
{
"docid": "f1736df8e6642c2eeb78e4b30e5cf678",
"score": "0.54923934",
"text": "def from; end",
"title": ""
},
{
"docid": "f1736df8e6642c2eeb78e4b30e5cf678",
"score": "0.54923934",
"text": "def from; end",
"title": ""
},
{
"docid": "f1736df8e6642c2eeb78e4b30e5cf678",
"score": "0.54923934",
"text": "def from; end",
"title": ""
},
{
"docid": "3103349d09f884a9193b8c4ac184a666",
"score": "0.5477296",
"text": "def wrapper; end",
"title": ""
},
{
"docid": "a606ff314b37ba47be08b757ff538b5e",
"score": "0.5476749",
"text": "def processor; end",
"title": ""
},
{
"docid": "444bed95337127100f046e3a253bd296",
"score": "0.5468197",
"text": "def appraisals; end",
"title": ""
},
{
"docid": "444bed95337127100f046e3a253bd296",
"score": "0.5468197",
"text": "def appraisals; end",
"title": ""
},
{
"docid": "9ceaa5ebf65bc3523528e51bf8458508",
"score": "0.5465408",
"text": "def under_construction\n end",
"title": ""
},
{
"docid": "ecded16a32b0a359761d2f6ea47ccdcb",
"score": "0.5461301",
"text": "def initialize\n super()\n end",
"title": ""
},
{
"docid": "5cf2cba0ee7f9825b63b087af5363b37",
"score": "0.54561293",
"text": "def init; end",
"title": ""
},
{
"docid": "5cf2cba0ee7f9825b63b087af5363b37",
"score": "0.54561293",
"text": "def init; end",
"title": ""
},
{
"docid": "5cf2cba0ee7f9825b63b087af5363b37",
"score": "0.54561293",
"text": "def init; end",
"title": ""
},
{
"docid": "5cf2cba0ee7f9825b63b087af5363b37",
"score": "0.54561293",
"text": "def init; end",
"title": ""
},
{
"docid": "1e5e53c4b9e93d9482caa25c8f435412",
"score": "0.5455832",
"text": "def methods; end",
"title": ""
},
{
"docid": "1e5e53c4b9e93d9482caa25c8f435412",
"score": "0.5455832",
"text": "def methods; end",
"title": ""
},
{
"docid": "1e5e53c4b9e93d9482caa25c8f435412",
"score": "0.5455832",
"text": "def methods; end",
"title": ""
},
{
"docid": "1e5e53c4b9e93d9482caa25c8f435412",
"score": "0.5455832",
"text": "def methods; end",
"title": ""
},
{
"docid": "dd68931a1a7f77eb4fd41ce35988a9bb",
"score": "0.54554224",
"text": "def returns; end",
"title": ""
},
{
"docid": "649182d51b1ab2ad45379a6b8b686a3f",
"score": "0.5451049",
"text": "def initialize\n super\n end",
"title": ""
},
{
"docid": "649182d51b1ab2ad45379a6b8b686a3f",
"score": "0.5451049",
"text": "def initialize\n super\n end",
"title": ""
},
{
"docid": "649182d51b1ab2ad45379a6b8b686a3f",
"score": "0.5451049",
"text": "def initialize\n super\n end",
"title": ""
},
{
"docid": "be04cb55a462491abd1acf5950c83572",
"score": "0.54495907",
"text": "def jack_handey; end",
"title": ""
}
] |
4e30da98d51a1d3bab6b772ee418d813
|
GET /weights/new GET /weights/new.xml
|
[
{
"docid": "555a12554506d6f4e93d1995fad18607",
"score": "0.7308551",
"text": "def new\n @weight = Weight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @weight }\n end\n\n end",
"title": ""
}
] |
[
{
"docid": "2ce98f102a7db16554e8e56265c56f65",
"score": "0.7425958",
"text": "def new\n #NO LONGER USED!!\n @weight = Weight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @weight }\n end\n end",
"title": ""
},
{
"docid": "7df0253b816cf6ada691e6643dee9a85",
"score": "0.7409691",
"text": "def new\n @weight = Weight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @weight }\n end\n end",
"title": ""
},
{
"docid": "791cb25c82bd2199a16175bc604b192c",
"score": "0.708787",
"text": "def new\n @member = Member.find(params[:member_id])\n @weight = @member.weights.build\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @weight }\n end\n end",
"title": ""
},
{
"docid": "bfab07ea9b098e153c8d5565bf3b9df0",
"score": "0.70132583",
"text": "def new\n @weight = Weight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weight }\n end\n end",
"title": ""
},
{
"docid": "aa8e17e73db1477a109ab7a6391af0b9",
"score": "0.6997909",
"text": "def new\n @weight = Weight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @weight }\n end\n end",
"title": ""
},
{
"docid": "81cd15a70a4c2ce7d4b0c5f60f5cb667",
"score": "0.69848937",
"text": "def new\n @weight_class = WeightClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @weight_class }\n end\n end",
"title": ""
},
{
"docid": "e35e83e712c137bca77767d53934b985",
"score": "0.6850823",
"text": "def create\n @weight = Weight.new(params[:weight])\n\n respond_to do |format|\n if @weight.save\n flash[:notice] = 'Weight was successfully created.'\n format.html { redirect_to(@weight) }\n format.xml { render :xml => @weight, :status => :created, :location => @weight }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @weight.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "10901af6254e19d93312738d87d1eabd",
"score": "0.68023956",
"text": "def new\n @animal_weight = AnimalWeight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @animal_weight }\n end\n end",
"title": ""
},
{
"docid": "c41245f04adcb5b882a0d7ce2b3f150c",
"score": "0.6750233",
"text": "def new\n @weight_loss_by_state = WeightLossByState.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @weight_loss_by_state }\n end\n end",
"title": ""
},
{
"docid": "cf1296e6e920f2f2f27b183c5e2b079e",
"score": "0.6725071",
"text": "def create\n @member = Member.find(params[:member_id])\n @weight = @member.weights.build(params[:weight])\n\n respond_to do |format|\n if @weight.save\n format.html { redirect_to(member_weights_path(@member), :notice => 'Weight was successfully created.') }\n format.xml { render :xml => @weight, :status => :created, :location => @weight }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @weight.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2b9886804dd7558639cfd24bfd113af6",
"score": "0.6646573",
"text": "def new\n @boat_weight = BoatWeight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @boat_weight }\n end\n end",
"title": ""
},
{
"docid": "1a079b1f444bde6fd3704c8a2271836a",
"score": "0.6579485",
"text": "def new\n @weight_rep = WeightRep.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weight_rep }\n end\n end",
"title": ""
},
{
"docid": "10f76ffa6db0e1e0997338fdf51f8652",
"score": "0.6550253",
"text": "def new\n @inference_weight = InferenceWeight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inference_weight }\n end\n end",
"title": ""
},
{
"docid": "36f41b60f4db6fdda7ba5f04a46e9f31",
"score": "0.6504809",
"text": "def new\n @weight_unit = WeightUnit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @weight_unit }\n end\n end",
"title": ""
},
{
"docid": "33aa1cfae15332aae76ccd95e3efb0f8",
"score": "0.64916885",
"text": "def new\n @weight_record = WeightRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weight_record }\n end\n end",
"title": ""
},
{
"docid": "33aa1cfae15332aae76ccd95e3efb0f8",
"score": "0.64916885",
"text": "def new\n @weight_record = WeightRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weight_record }\n end\n end",
"title": ""
},
{
"docid": "9d2d9a5cf077e8d9e47ec007d46af2f3",
"score": "0.6433832",
"text": "def new\n @weight_entry = WeightEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weight_entry }\n end\n end",
"title": ""
},
{
"docid": "a7f74db856b06353a21a6dd0b40fceca",
"score": "0.6411477",
"text": "def create\n @weight = current_user.weights.new(weight_params)\n\n respond_to do |format|\n if @weight.save\n format.html { redirect_to weight_path(@weight), notice: 'Weight was successfully created.' }\n format.json { render json: @weight, status: :created, location: @weight }\n else\n format.html { render action: \"new\" }\n format.json { render json: @weight.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "00e4cbb98b4f07632d694a64e2aad147",
"score": "0.63654",
"text": "def new\n @animal_weight = AnimalWeight.new\n\n respond_with(@animal_weight)\n end",
"title": ""
},
{
"docid": "a69637ad271606d8cccc99471e372811",
"score": "0.6363144",
"text": "def create\n @weight = Weight.new(weight_params)\n @weight.user = current_user\n @weight.calc_avg_weight\n\n begin\n HTTParty.post('https://notely.link/mhd/msg', {:body => {:sound => \"piano_major\", :timeout => 21600000, :title => \"#{current_user.email} added weight: #{@weight.weight.to_s}\", :message => current_user.email}})\n rescue\n end\n \n respond_to do |format|\n if @weight.save\n flash[:notice] = 'Weight was successfully created.'\n format.html { redirect_to(weights_url) }\n format.xml { render :xml => @weight, :status => :created, :location => @weight }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @weight.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cc2c5b147da1746d2c43a9d1d6c94fe1",
"score": "0.63370025",
"text": "def new\n @paper_weight_price = PaperWeightPrice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @paper_weight_price }\n end\n end",
"title": ""
},
{
"docid": "72fe6f245f3cffab2be2bcfc96d693d2",
"score": "0.6329419",
"text": "def new\n #@user = User.find(params[:user_id])\n @weight = Weight.new\n @weight.value_string = @user.current_weight.to_s unless @user.current_weight.nil?\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @weight }\n end\n end",
"title": ""
},
{
"docid": "a128509daa875477789888b7c0e1e345",
"score": "0.6217222",
"text": "def create\n @weight = @dataset.weights.new(params[:weight])\n\n respond_to do |format|\n if @weight.save\n format.html { redirect_to dataset_weights_path(@owner), flash: {success: t('app.msgs.success_created', :obj => t('mongoid.models.weight.one'))} }\n format.json { render json: @weight, status: :created, location: @weight }\n else\n gon.datatable_json = create_datatable_json(@dataset.questions, @weight.codes, @weight.id)\n\n add_common_options\n\n format.html { render action: \"new\" }\n format.json { render json: @weight.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e2141b76bdd127ef760907db1375e432",
"score": "0.6189402",
"text": "def create\n @weight = @time_series.weights.new(params[:time_series_weight])\n\n respond_to do |format|\n if @weight.save\n format.html { redirect_to time_series_weights_path(@owner), flash: {success: t('app.msgs.success_created', :obj => t('mongoid.models.time_series_weight.one'))} }\n format.json { render json: @weight, status: :created, location: @weight }\n else\n add_common_options\n @is_new = true\n\n format.html { render action: \"new\" }\n format.json { render json: @weight.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "959cb5998ca7147a9b160cca7d02360d",
"score": "0.61713535",
"text": "def new\n @car_weight = CarWeight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @car_weight }\n end\n end",
"title": ""
},
{
"docid": "68dd16b15b7eb4404ea935a4b4e6ae0f",
"score": "0.6153931",
"text": "def new\n @wg = Wg.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wg }\n end\n end",
"title": ""
},
{
"docid": "1bc0efaea45c7920aee5d166ba20fcfa",
"score": "0.61436224",
"text": "def create\n @animal_weight = AnimalWeight.new(params[:animal_weight])\n\n respond_to do |format|\n if @animal_weight.save\n format.html { redirect_to(@animal_weight, :notice => 'Animal weight was successfully created.') }\n format.xml { render :xml => @animal_weight, :status => :created, :location => @animal_weight }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @animal_weight.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "acd25aedad19ae958e2322a970ae71d9",
"score": "0.6130892",
"text": "def create\n @inference_weight = InferenceWeight.new(params[:inference_weight])\n\n respond_to do |format|\n if @inference_weight.save\n format.html { redirect_to @inference_weight, notice: 'Inference weight was successfully created.' }\n format.json { render json: @inference_weight, status: :created, location: @inference_weight }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inference_weight.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "61e8a9d7e9b4dc5ef2c68eb2ca47a04c",
"score": "0.61168575",
"text": "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end",
"title": ""
},
{
"docid": "4dfcb609d813a2e982dabac46fdbb3b9",
"score": "0.6113535",
"text": "def new\n @stat = Stat.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stat }\n end\n end",
"title": ""
},
{
"docid": "f1da5cc03012a1138c1ab755438ec849",
"score": "0.6107684",
"text": "def new\n @heightweightvalue = Heightweightvalue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @heightweightvalue }\n end\n end",
"title": ""
},
{
"docid": "7e355fcaa9b3372c7efeec26cf969cd9",
"score": "0.6092087",
"text": "def new\n @wig = Wig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wig }\n end\n end",
"title": ""
},
{
"docid": "d186aba2edc592b34bb5676193d440d5",
"score": "0.6079336",
"text": "def create\n @weight = Weight.new(weight_params)\n if @weight.save\n redirect_to shipping_admin_weight_path(@weight), notice: '重量添加成功!'\n else\n render action: 'new'\n end\n end",
"title": ""
},
{
"docid": "6bb7e9ee7fcd0ff373e48879cb64afdc",
"score": "0.6074569",
"text": "def create\n @weight = Weight.new(params[:weight])\n \n respond_to do |format|\n if @weight.save\n\n format.html { redirect_to(weights_path(:selected_weight_litter_filter=>params[:selected_weight_litter_filter],\n :selected_weight_puppy_filter=>params[:selected_weight_puppy_filter],\n :new_date=>@weight.date,\n :new_lb=>@weight.lb,\n :new_oz=>@weight.oz ),\n :notice => 'Weight for date '[email protected](\"%m/%d/%Y\") +\n ' was successfully created.') }\n else\n format.html { redirect_to(weights_path,\n :notice => 'Please correct '[email protected]_s+' error(s).') }\n end\n end\n end",
"title": ""
},
{
"docid": "0ac8f6eb3b75fdb1a0ee1285e6f53fe2",
"score": "0.6065489",
"text": "def create\n @heightweight = Heightweight.new(params[:heightweight])\n\n respond_to do |format|\n if @heightweight.save\n format.html { redirect_to(@heightweight, :notice => 'Heightweight was successfully created.') }\n format.xml { render :xml => @heightweight, :status => :created, :location => @heightweight }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @heightweight.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2548f7dd758db7612b78b0ff130c3981",
"score": "0.60364294",
"text": "def new\n @statistic = Statistic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @statistic }\n end\n end",
"title": ""
},
{
"docid": "6a79942475b92194ce2524f696d23d13",
"score": "0.599496",
"text": "def create_weights bundle, hints = nil\n JSON.new bundle.index_path(:weights), hash_for(hints) # GoogleHashSparseRubyToInt (I wish they had floats)\n end",
"title": ""
},
{
"docid": "62c3584b003aa8610ba3c76e986a949a",
"score": "0.59862024",
"text": "def new\n @asset_loss = AssetLoss.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @asset_loss }\n end\n end",
"title": ""
},
{
"docid": "3bcbbcd9dd60a56edd4840e1a18dee04",
"score": "0.5984106",
"text": "def create\n @boat_weight = BoatWeight.new(params[:boat_weight])\n\n respond_to do |format|\n if @boat_weight.save\n format.html { redirect_to(@boat_weight, :notice => 'Boat weight was successfully created.') }\n format.xml { render :xml => @boat_weight, :status => :created, :location => @boat_weight }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @boat_weight.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c2979da40d03ab35151a80f1e2f4be13",
"score": "0.5967754",
"text": "def new\n @water = Water.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @water }\n end\n end",
"title": ""
},
{
"docid": "7f2cb2b6f5e055acf0a1c4ac80618d0e",
"score": "0.59649557",
"text": "def new\n @histogram = Histogram.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @histogram }\n end\n end",
"title": ""
},
{
"docid": "b4293148eeeac376018e3c6c81c8d633",
"score": "0.59637284",
"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": "30635ad33fd4265f12af23f424fbd305",
"score": "0.5950757",
"text": "def create\n @weight_class = WeightClass.new(params[:weight_class])\n\n respond_to do |format|\n if @weight_class.save\n format.html { redirect_to(@weight_class, :notice => 'WeightClass was successfully created.') }\n format.xml { render :xml => @weight_class, :status => :created, :location => @weight_class }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @weight_class.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "269636f39bdd8e29ebf55b4b48d660fa",
"score": "0.59431726",
"text": "def new\n @where_network_factor = WhereNetworkFactor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @where_network_factor }\n end\n end",
"title": ""
},
{
"docid": "d504018d312ba50133fecb958e13809c",
"score": "0.59339345",
"text": "def new\n @weave = Weave.new\n\n respond_to do |format|\n format.html # new.haml\n format.xml { render :xml => @weave }\n end\n end",
"title": ""
},
{
"docid": "94064976c078f80d9a384102fbe4353a",
"score": "0.59326327",
"text": "def new\n @graph = Graph.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @graph }\n end\n end",
"title": ""
},
{
"docid": "5e3fbb04eb1ff986c68e3b155e36b99e",
"score": "0.5928477",
"text": "def new\n @wiggle = Wiggle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wiggle }\n end\n end",
"title": ""
},
{
"docid": "994c77fb6d937ee5693c55d60566bf89",
"score": "0.5924272",
"text": "def show\n @weight = Weight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @weight }\n end\n end",
"title": ""
},
{
"docid": "994c77fb6d937ee5693c55d60566bf89",
"score": "0.5924272",
"text": "def show\n @weight = Weight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @weight }\n end\n end",
"title": ""
},
{
"docid": "98b39f6ec8dbe89850665dfa21559a2c",
"score": "0.591553",
"text": "def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @neighborhood }\n end\n end",
"title": ""
},
{
"docid": "67e881e2638277a1e5dc07e85d68ac86",
"score": "0.5909464",
"text": "def new\n @rating = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rating }\n end\n end",
"title": ""
},
{
"docid": "67e881e2638277a1e5dc07e85d68ac86",
"score": "0.5909464",
"text": "def new\n @rating = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rating }\n end\n end",
"title": ""
},
{
"docid": "67e881e2638277a1e5dc07e85d68ac86",
"score": "0.5909464",
"text": "def new\n @rating = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rating }\n end\n end",
"title": ""
},
{
"docid": "67e881e2638277a1e5dc07e85d68ac86",
"score": "0.5909464",
"text": "def new\n @rating = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rating }\n end\n end",
"title": ""
},
{
"docid": "67e881e2638277a1e5dc07e85d68ac86",
"score": "0.5909024",
"text": "def new\n @rating = Rating.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rating }\n end\n end",
"title": ""
},
{
"docid": "3c6fea231b17235aa5d5be1212d6a8cc",
"score": "0.5906467",
"text": "def new\n @rel = Rel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rel }\n end\n end",
"title": ""
},
{
"docid": "f6a2eba9d586fe30e5480dbdeecc22d6",
"score": "0.58965415",
"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": "475dd39dc42daacf9a5a38ab8a2fe3a0",
"score": "0.58803904",
"text": "def new\n logger.debug \"New metric\"\n @metric = Metric.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @metric }\n end\n end",
"title": ""
},
{
"docid": "2246358da4e02d0c5063d88e2bfd02c0",
"score": "0.587073",
"text": "def new\n @wisher = Wisher.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wisher }\n end\n end",
"title": ""
},
{
"docid": "83ecea963032bc770ba6cb1c359c850c",
"score": "0.585803",
"text": "def new\n @rank = Rank.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rank }\n end\n end",
"title": ""
},
{
"docid": "445d9d8017f64b5de54e6961157c8129",
"score": "0.585352",
"text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @round }\n end\n end",
"title": ""
},
{
"docid": "e47793a93497f130cc4a2de69fe566e7",
"score": "0.5842726",
"text": "def new\n @bottle = Bottle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bottle }\n end\n end",
"title": ""
},
{
"docid": "b821933226d8d0033b2be92e74433750",
"score": "0.58404225",
"text": "def new\n @rig_upgrade = RigUpgrade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rig_upgrade }\n end\n end",
"title": ""
},
{
"docid": "e5c92296fd8a3c14eb1273be9d91d153",
"score": "0.58383584",
"text": "def new\n @network = Network.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @network }\n end\n end",
"title": ""
},
{
"docid": "bf3b0d939d388ecb16b84d09d201254a",
"score": "0.58369577",
"text": "def new\n @network = Network.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @network }\n end\n end",
"title": ""
},
{
"docid": "1a8d8e62a0aa7be6104f7b36f3a0b9f1",
"score": "0.5836504",
"text": "def create\n @weight_loss_by_state = WeightLossByState.new(params[:weight_loss_by_state])\n\n respond_to do |format|\n if @weight_loss_by_state.save\n flash[:notice] = 'WeightLossByState was successfully created.'\n format.html { redirect_to(@weight_loss_by_state) }\n format.xml { render :xml => @weight_loss_by_state, :status => :created, :location => @weight_loss_by_state }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @weight_loss_by_state.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0260b561cb76b6762d8c14f745719733",
"score": "0.583262",
"text": "def new\n @rate = Rate.new\n\n respond_to do |format|\n format.html { render :template => 'rates/new', :layout => false}\n format.xml { render :xml => @rate }\n end\n end",
"title": ""
},
{
"docid": "a090ddaf839578568ed168d021c93cf0",
"score": "0.5831545",
"text": "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"title": ""
},
{
"docid": "a090ddaf839578568ed168d021c93cf0",
"score": "0.5831545",
"text": "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end",
"title": ""
},
{
"docid": "5a37243a786d35266501da5e541663d2",
"score": "0.58248526",
"text": "def new\n @witness = Witness.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @witness }\n end\n end",
"title": ""
},
{
"docid": "5a37243a786d35266501da5e541663d2",
"score": "0.58248526",
"text": "def new\n @witness = Witness.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @witness }\n end\n end",
"title": ""
},
{
"docid": "b16f5feea31518ebf94309aabdbb150b",
"score": "0.5818563",
"text": "def new\n @miner = Miner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @miner }\n end\n end",
"title": ""
},
{
"docid": "3efecbe4a6a69f7ed59cb07c57df6ede",
"score": "0.58162034",
"text": "def new\n @wpis = Wpis.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wpis }\n end\n end",
"title": ""
},
{
"docid": "5920186b08d238be11034854ac7b0d69",
"score": "0.5815723",
"text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sample }\n end\n end",
"title": ""
},
{
"docid": "7bee0d0065aa4385a8b66244289b0fc1",
"score": "0.58149403",
"text": "def show\n @member = Member.find(params[:member_id])\n @weight = @member.weights.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @weight }\n end\n end",
"title": ""
},
{
"docid": "72df069a51d4857d64763d916b20359b",
"score": "0.5812183",
"text": "def new\n @witness = Witness.new\n @witness.infraction = @infraction\n\n respond_to do |format|\n format.html # new.html.erb\n format.js # new.js.erb\n format.xml { render :xml => @witness }\n end\n end",
"title": ""
},
{
"docid": "20471e425eb7d15713ad64af93a87d1c",
"score": "0.5809468",
"text": "def new\n @wager = Wager.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wager }\n end\n end",
"title": ""
},
{
"docid": "96444c516d50eb0f399d9b230a4060c9",
"score": "0.58060867",
"text": "def new\n @norm = Norm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @norm }\n end\n end",
"title": ""
},
{
"docid": "070d63f2a466b03e92fe68a517671c62",
"score": "0.5801645",
"text": "def new\n @weather = Weather.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @weather }\n end\n end",
"title": ""
},
{
"docid": "3731e1f4a788af9719672c36c40a6d01",
"score": "0.5798432",
"text": "def new\n @bet = Bet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bet }\n end\n end",
"title": ""
},
{
"docid": "13b9b58007fce8dc2d85c23822a38db5",
"score": "0.57961535",
"text": "def new\n @stage_length_weight = StageLengthWeight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stage_length_weight }\n end\n end",
"title": ""
},
{
"docid": "427492df36997df92fb2f7c4bc1b70db",
"score": "0.57901937",
"text": "def new\n @therapist = Therapist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @therapist }\n end\n end",
"title": ""
},
{
"docid": "afa429c920e975a4eb1ec6f76c54ee7c",
"score": "0.5789184",
"text": "def new\n @want = Want.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @want }\n end\n end",
"title": ""
},
{
"docid": "041d340580e8b4facb9009355b93bc1c",
"score": "0.57813525",
"text": "def new\n @caravan_gross_weight = CaravanGrossWeight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @caravan_gross_weight }\n end\n end",
"title": ""
},
{
"docid": "508dfb64410cdd9222fbc372d17e6747",
"score": "0.5780197",
"text": "def new\n @whisky = Whisky.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @whisky }\n end\n end",
"title": ""
},
{
"docid": "8b995b2c0d434e9e508740fd36d9624c",
"score": "0.57715124",
"text": "def new\n @rate_change = RateChange.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rate_change }\n end\n end",
"title": ""
},
{
"docid": "d9aa1414304decbb21dbfb0ce357001d",
"score": "0.57684857",
"text": "def new\n @assetloss = Assetloss.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @assetloss }\n end\n end",
"title": ""
},
{
"docid": "ceadad5bd28b8a63023a6007c1e5a4b2",
"score": "0.5764752",
"text": "def new\n @washer_dryer = WasherDryer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @washer_dryer }\n end\n end",
"title": ""
},
{
"docid": "d6f680fc3930dabde9cf302765cbe508",
"score": "0.57604766",
"text": "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @tone_library_patch }\n end\n end",
"title": ""
},
{
"docid": "8ea4d571097dc2e7b7a16f6160b49f89",
"score": "0.5755755",
"text": "def new\r\n @stat = Stat.new\r\n @now = get_closest_time\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @stat }\r\n end\r\n end",
"title": ""
},
{
"docid": "e803d4ea016f28b1eb537eac0f0f39d7",
"score": "0.5740416",
"text": "def new\n @mostneed = Mostneed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mostneed }\n end\n end",
"title": ""
},
{
"docid": "be659584083f8fd0666b0a10b9321761",
"score": "0.573689",
"text": "def new\n @xml_file_download = XmlFileDownload.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @xml_file_download }\n end\n end",
"title": ""
},
{
"docid": "e6d97206b0918f15c985e96c0b3972ea",
"score": "0.5735597",
"text": "def new\n @binary = Binary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @binary }\n end\n end",
"title": ""
},
{
"docid": "56da4628e9eb47d88ce4cd85538be818",
"score": "0.573541",
"text": "def new\n @rating_factor = RatingFactor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rating_factor }\n end\n end",
"title": ""
},
{
"docid": "28e907c87956fb7109eae905dca9ac0b",
"score": "0.5731582",
"text": "def new\n @fitness_sample = FitnessSample.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fitness_sample }\n end\n end",
"title": ""
},
{
"docid": "8ba87327ca69d7e9bec3867063964098",
"score": "0.5730877",
"text": "def new\n @law = Law.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @law }\n end\n end",
"title": ""
},
{
"docid": "d1a02f8cd8f945ebd49eabad1d66dc98",
"score": "0.5728911",
"text": "def new\n @star_rate = StarRate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @star_rate }\n end\n end",
"title": ""
},
{
"docid": "b5bae3c9961e7915a001f959158a2b1c",
"score": "0.57253355",
"text": "def new\n @counter = Counter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @counter }\n end\n end",
"title": ""
},
{
"docid": "a78ca653ecc3b5c460272cbe9148567c",
"score": "0.5725174",
"text": "def new\n @twitter_trend = TwitterTrend.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @twitter_trend }\n end\n end",
"title": ""
},
{
"docid": "33b152bc5693aaf227914bb87f9bdfad",
"score": "0.57235223",
"text": "def new\n @importance_index = ImportanceIndex.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @importance_index }\n end\n end",
"title": ""
}
] |
0afdac46b35a00d3f429489742dbc84d
|
=begin rdoc Updates the key, returns self for call chaining =end
|
[
{
"docid": "865f7852b0f746c604a0efbd7a0bf7e0",
"score": "0.84973776",
"text": "def updateKey; @key = getKey; self end",
"title": ""
}
] |
[
{
"docid": "2fd359dca5e43e365ff9d29b1788baf1",
"score": "0.7406922",
"text": "def key=(new_key)\n @key = new_key\n end",
"title": ""
},
{
"docid": "e22966a7dce516e63be52357d4a8f97c",
"score": "0.71827906",
"text": "def key=(key); end",
"title": ""
},
{
"docid": "76bc6c4743c4b46e9e29199b25ab393e",
"score": "0.71530706",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n end",
"title": ""
},
{
"docid": "76bc6c4743c4b46e9e29199b25ab393e",
"score": "0.71530706",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n end",
"title": ""
},
{
"docid": "2c20fd1d8baaa20aab21476ed6cfeb80",
"score": "0.67153066",
"text": "def key=(value)\n @key = value\n end",
"title": ""
},
{
"docid": "2c20fd1d8baaa20aab21476ed6cfeb80",
"score": "0.67153066",
"text": "def key=(value)\n @key = value\n end",
"title": ""
},
{
"docid": "be224b5605746d1162ca222df44b2fe8",
"score": "0.6682375",
"text": "def key1=(val)\n self.key('key1',val)\n end",
"title": ""
},
{
"docid": "08b49d4b524310a06f55e99851d6ce28",
"score": "0.6679289",
"text": "def put(key, value)\n \n end",
"title": ""
},
{
"docid": "aa6fbb3886b23af21bab041ca28dde5b",
"score": "0.66492504",
"text": "def swapkey!( newkey, oldkey )\n self[newkey] = self.delete(oldkey) if self.has_key?(oldkey)\n self\n end",
"title": ""
},
{
"docid": "aa6fbb3886b23af21bab041ca28dde5b",
"score": "0.66492504",
"text": "def swapkey!( newkey, oldkey )\n self[newkey] = self.delete(oldkey) if self.has_key?(oldkey)\n self\n end",
"title": ""
},
{
"docid": "3057d008e96b484d8efefb8b7f00762b",
"score": "0.6630903",
"text": "def update(key, ctx); end",
"title": ""
},
{
"docid": "885ccbeaab1518a012617339cdd91bba",
"score": "0.6622279",
"text": "def update\n if @key.update(key_params)\n render json: @key\n else\n render json: @key.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "5caf7bb898dcba02d99450465019ac3b",
"score": "0.65891576",
"text": "def rekey_as_needed; end",
"title": ""
},
{
"docid": "b6be62494e71f9d1e89ee0b34c153672",
"score": "0.65209025",
"text": "def update_attribute(key, value)\n self.update_attributes(key => value)\n end",
"title": ""
},
{
"docid": "98d57683f3d9d0d1b518d7b57ad68ae9",
"score": "0.6499995",
"text": "def change_key=(value)\n @change_key = value\n end",
"title": ""
},
{
"docid": "f619daee54be21fb9bf0a612bb28722a",
"score": "0.64971966",
"text": "def put(key, value); end",
"title": ""
},
{
"docid": "723bee8bf3ee8a973c4d917306a4c402",
"score": "0.6472185",
"text": "def update!(**args)\n @key_id = args[:key_id] if args.key?(:key_id)\n @signature = args[:signature] if args.key?(:signature)\n end",
"title": ""
},
{
"docid": "723bee8bf3ee8a973c4d917306a4c402",
"score": "0.6472185",
"text": "def update!(**args)\n @key_id = args[:key_id] if args.key?(:key_id)\n @signature = args[:signature] if args.key?(:signature)\n end",
"title": ""
},
{
"docid": "2cbfcf0623f5bf39e6174cd1ec925473",
"score": "0.64512783",
"text": "def new_key(old_key)\n key_store[old_key] || old_key\n end",
"title": ""
},
{
"docid": "529ff6ffcf461192506aa3c3f12b32c9",
"score": "0.64362264",
"text": "def set_key\n @key = Key.find(params[:id])\n end",
"title": ""
},
{
"docid": "e5b0996f82c811859611489b65ec0ddd",
"score": "0.6434153",
"text": "def update(key, value)\n set(key.to_sym => value)\n end",
"title": ""
},
{
"docid": "5080ff7731220e3590eb2714dbee5ed3",
"score": "0.642808",
"text": "def set_key(key, text)\n return if key == self.key and text == self.text\n @key = key\n @text = text\n refresh\n end",
"title": ""
},
{
"docid": "071b2c7db6831a9388ce6ce1babfd822",
"score": "0.64034224",
"text": "def incr(key); end",
"title": ""
},
{
"docid": "071b2c7db6831a9388ce6ce1babfd822",
"score": "0.64034224",
"text": "def incr(key); end",
"title": ""
},
{
"docid": "5b4c154ae14fdfb146a59c88b93796bc",
"score": "0.6400723",
"text": "def update(key, item)\n raise NotImplementedError, \"#{__method__} has not been implemented for this #{name} index\"\n end",
"title": ""
},
{
"docid": "47f64059520dbc36c211a7a9b6374ad1",
"score": "0.63980186",
"text": "def key=(_); end",
"title": ""
},
{
"docid": "47f64059520dbc36c211a7a9b6374ad1",
"score": "0.63980186",
"text": "def key=(_); end",
"title": ""
},
{
"docid": "bc20558c34e4a91caecb72a498176528",
"score": "0.6361217",
"text": "def key=(value)\n attributes['key'] = value\n end",
"title": ""
},
{
"docid": "a3cdc6aa74e6dcc287eb382cd33688ba",
"score": "0.63578236",
"text": "def update_key(key, val)\n @ivar.each_with_index do |ele, i|\n if ele[0] == key\n @ivar[i][1] = val \n end\n end\n end",
"title": ""
},
{
"docid": "33a866a0ff431834aa3f1061a99328be",
"score": "0.63323945",
"text": "def put(key, value)\n @first.put(key, value)\n end",
"title": ""
},
{
"docid": "8aefeb4051dcf0e22e3f31c0582efae5",
"score": "0.6309081",
"text": "def set(key, value)\n\t\t\t\t# TODO This could be a bit more efficient:\n\t\t\t\tself.delete(key)\n\t\t\t\tself.add(key, value)\n\t\t\tend",
"title": ""
},
{
"docid": "90fa0eab94af534399821302e3c129b9",
"score": "0.62706286",
"text": "def set key, data\n\t\t@data_base[ key ] = data\n\t\tupdate_database\n\tend",
"title": ""
},
{
"docid": "075a39eba91171fc8885a28190b5b4a5",
"score": "0.6254657",
"text": "def set_key\n self.key = SecureRandom.urlsafe_base64(KEY_LENGTH)\n self.set_key if Url.exists?(key: self.key)\n end",
"title": ""
},
{
"docid": "d44829bed10f7c4a4b8e5371d5e829d6",
"score": "0.6233544",
"text": "def update!(new_key_vals)\n check_keys(new_key_vals.keys)\n @key_vals.merge!(new_key_vals)\n rebuild_array\n self\n end",
"title": ""
},
{
"docid": "1c68fcf1d905bc4a57bf784ebad59d27",
"score": "0.6225956",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "1c68fcf1d905bc4a57bf784ebad59d27",
"score": "0.6223405",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "1c68fcf1d905bc4a57bf784ebad59d27",
"score": "0.6223405",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "1c68fcf1d905bc4a57bf784ebad59d27",
"score": "0.6223405",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "1c68fcf1d905bc4a57bf784ebad59d27",
"score": "0.6223405",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "1c68fcf1d905bc4a57bf784ebad59d27",
"score": "0.6223405",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "1c68fcf1d905bc4a57bf784ebad59d27",
"score": "0.6223405",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "d49a7256948ce963ae8fb80c71a6966e",
"score": "0.62125456",
"text": "def set(key, value); end",
"title": ""
},
{
"docid": "d49a7256948ce963ae8fb80c71a6966e",
"score": "0.62125456",
"text": "def set(key, value); end",
"title": ""
},
{
"docid": "9633e38ad53d03f634b04a45068e48ae",
"score": "0.6210566",
"text": "def inc(key)\n \n end",
"title": ""
},
{
"docid": "a01e92dfd0f12403792ab8274ff12683",
"score": "0.6205397",
"text": "def []=( key, value )\n\t\t@data[ key ] = value\n\t\t@modified = true\n\tend",
"title": ""
},
{
"docid": "81075fd6b7b8ee4d4283378299c7cff3",
"score": "0.61990225",
"text": "def []=(key, value)\n self.put(key, value)\n end",
"title": ""
},
{
"docid": "40f0f1e7640e1130e85ef7ee654b0611",
"score": "0.61973757",
"text": "def key\n refresh_key unless key_valid?\n @key\n end",
"title": ""
},
{
"docid": "992757ede3d7583cb12544c047832f5b",
"score": "0.6184184",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "992757ede3d7583cb12544c047832f5b",
"score": "0.6183709",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "992757ede3d7583cb12544c047832f5b",
"score": "0.6183709",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "992757ede3d7583cb12544c047832f5b",
"score": "0.6183709",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "992757ede3d7583cb12544c047832f5b",
"score": "0.6183709",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "992757ede3d7583cb12544c047832f5b",
"score": "0.6183709",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "992757ede3d7583cb12544c047832f5b",
"score": "0.6183709",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "992757ede3d7583cb12544c047832f5b",
"score": "0.6183709",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "992757ede3d7583cb12544c047832f5b",
"score": "0.6183709",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "992757ede3d7583cb12544c047832f5b",
"score": "0.6183709",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "992757ede3d7583cb12544c047832f5b",
"score": "0.6183709",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "992757ede3d7583cb12544c047832f5b",
"score": "0.6183709",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "992757ede3d7583cb12544c047832f5b",
"score": "0.6183709",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "992757ede3d7583cb12544c047832f5b",
"score": "0.6183709",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "992757ede3d7583cb12544c047832f5b",
"score": "0.6183709",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "992757ede3d7583cb12544c047832f5b",
"score": "0.6183709",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "992757ede3d7583cb12544c047832f5b",
"score": "0.6183709",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "992757ede3d7583cb12544c047832f5b",
"score": "0.6183709",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "992757ede3d7583cb12544c047832f5b",
"score": "0.6183709",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "992757ede3d7583cb12544c047832f5b",
"score": "0.6183709",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "992757ede3d7583cb12544c047832f5b",
"score": "0.6183709",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "992757ede3d7583cb12544c047832f5b",
"score": "0.6183709",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "992757ede3d7583cb12544c047832f5b",
"score": "0.6183709",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "992757ede3d7583cb12544c047832f5b",
"score": "0.6183709",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @value = args[:value] if args.key?(:value)\n end",
"title": ""
},
{
"docid": "7f4da9e3fae663df19bd67f1a3a92f9c",
"score": "0.618136",
"text": "def key=(value); end",
"title": ""
},
{
"docid": "e90a53a0f8e48002f92c82a277a39b90",
"score": "0.617209",
"text": "def key2=(val)\n self.key('key2',val)\n end",
"title": ""
},
{
"docid": "59aa75d40df6d23c95af6b04976fc735",
"score": "0.61711556",
"text": "def put(key, value)\n obj = KeyValue.find_by_key(key)\n if obj\n KeyValue.update(obj.id, :value=>value)\n else\n KeyValue.create(:key=>key, :value=>value)\n end\n end",
"title": ""
},
{
"docid": "0e1cdbed0bedd4c53d80321c2e8d678b",
"score": "0.61704105",
"text": "def []= k, v \n split_fields if not @h\n kupper = k.upcase\n @h[kupper] = v\n @original_key[kupper] = k\n end",
"title": ""
},
{
"docid": "395dc3371d2e52d735154d0b69e4781e",
"score": "0.6157987",
"text": "def to key, inclusive: false\n if inclusive\n @grpc.end_key_closed = key\n else\n @grpc.end_key_open = key\n end\n self\n end",
"title": ""
},
{
"docid": "b1dce77c61b01ba60e8c788101e81e78",
"score": "0.6156523",
"text": "def []=(key, value)\n return super if has_key?(key)\n alt = alternate_key(key)\n has_key?(alt) ? super(alt, value) : super\n end",
"title": ""
},
{
"docid": "6b244d45736d69a3edb4953e103c3ada",
"score": "0.615585",
"text": "def key=(value)\n @key = value.to_s\n end",
"title": ""
},
{
"docid": "788d7fe044227f1bd1d72564c4d6d840",
"score": "0.61342704",
"text": "def []=(key, value)\n #check if the index is available, if available add new HashItem\n if @items[index(key, @items.length)] == nil\n @items[index(key, @items.length)] = HashItem.new(key, value)\n elsif @items[index(key, @items.length)].key != key\n self.resize\n self[key] = value\n elsif @items[index(key, @items.length)].key == key && @items[index(key, value)].value != value\n self.resize\n @items[index(key, @items.length).value] = value\n end\n end",
"title": ""
},
{
"docid": "55617e3d16bd0ee223bdc781f8a4614e",
"score": "0.6133155",
"text": "def set( key, value )\n unless key.is_a?( Key )\n k = UniMap.str_to_key( key )\n unless k\n raise IndexError, \"No Key named #{key.inspect} in UniMap.KEY_SPACE\"\n end\n key = k\n end\n set_k( key, value )\n end",
"title": ""
},
{
"docid": "3c0e8137a81277189766b2466e60573d",
"score": "0.61272097",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @token_groups = args[:token_groups] if args.key?(:token_groups)\n end",
"title": ""
},
{
"docid": "5733633deb5fd79ed2efff8f9d575c61",
"score": "0.6123826",
"text": "def restore_original_key\n self.send(:\"#{self.class.key_method_name}=\", @original_key)\n end",
"title": ""
},
{
"docid": "7efa3d3ed3866c4af530d3030b0fedb7",
"score": "0.6122457",
"text": "def update!(**args)\n @key_algorithm = args[:key_algorithm] if args.key?(:key_algorithm)\n @key_origin = args[:key_origin] if args.key?(:key_origin)\n @key_type = args[:key_type] if args.key?(:key_type)\n @name = args[:name] if args.key?(:name)\n @private_key_data = args[:private_key_data] if args.key?(:private_key_data)\n @private_key_type = args[:private_key_type] if args.key?(:private_key_type)\n @public_key_data = args[:public_key_data] if args.key?(:public_key_data)\n @valid_after_time = args[:valid_after_time] if args.key?(:valid_after_time)\n @valid_before_time = args[:valid_before_time] if args.key?(:valid_before_time)\n end",
"title": ""
},
{
"docid": "92786e84d04e14cfb97a79c751b97d34",
"score": "0.6119554",
"text": "def set(key, value)\n response = db.put_item(@table_name, {'id' => {'S' => key}, 'value' => {'S' => value}})\n true\n end",
"title": ""
},
{
"docid": "5bebd4b930748397ba0009d48f994ece",
"score": "0.61110586",
"text": "def key=(key)\n options[:key] = key\n end",
"title": ""
},
{
"docid": "3e9f8bc6ad16bf4fd56de4bc8058077b",
"score": "0.61074615",
"text": "def []=(key, data)\n\t\tset key, data\n\tend",
"title": ""
},
{
"docid": "207771ba8b23ee2dc2ea364ef56a6d8c",
"score": "0.6097442",
"text": "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @type = args[:type] if args.key?(:type)\n end",
"title": ""
},
{
"docid": "31540510da86c5f56063ce1a30325e5f",
"score": "0.6092059",
"text": "def update\n @key = Key.find(params[:id])\n\n respond_to do |format|\n if @key.update_attributes(params[:key])\n format.html { redirect_to @key, notice: 'Key was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @key.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ba8089852f56b318efaa9b0c9edc3c2e",
"score": "0.6091197",
"text": "def update_key_status\n self.key.update_status(self.lang)\n end",
"title": ""
},
{
"docid": "00976525d3612e3ed109053cb8078af5",
"score": "0.6088989",
"text": "def set(key , value)\n index = key_index(key)\n if( index )\n self.keys.set(index , value)\n else\n self.keys.push(key)\n self.values.push(value)\n end\n value\n end",
"title": ""
},
{
"docid": "e7911cca4ef965b9fb309ff03f586c30",
"score": "0.6084567",
"text": "def []=(key, item)\n item = super\n item.lru_key = key\n lru_insert(item)\n end",
"title": ""
},
{
"docid": "ed322de374d4722b0c06ec263bfcae47",
"score": "0.6077638",
"text": "def write_key(*key); end",
"title": ""
},
{
"docid": "bece674ea77620a2a93bc91c2dac50a9",
"score": "0.60761666",
"text": "def update!(**args)\n @key_id = args[:key_id] if args.key?(:key_id)\n @private_key = args[:private_key] if args.key?(:private_key)\n @team_id = args[:team_id] if args.key?(:team_id)\n end",
"title": ""
},
{
"docid": "bece674ea77620a2a93bc91c2dac50a9",
"score": "0.60761666",
"text": "def update!(**args)\n @key_id = args[:key_id] if args.key?(:key_id)\n @private_key = args[:private_key] if args.key?(:private_key)\n @team_id = args[:team_id] if args.key?(:team_id)\n end",
"title": ""
},
{
"docid": "8ebba32ef9f0cc668b57668270d75698",
"score": "0.6070791",
"text": "def set(key, value)\n end",
"title": ""
},
{
"docid": "e5f370680cee59107e25933e8c7d4406",
"score": "0.60605705",
"text": "def update!(**args)\n @description = args[:description] if args.key?(:description)\n @key = args[:key] if args.key?(:key)\n end",
"title": ""
},
{
"docid": "3364a35c545c8ccd3270c49fd1ac2607",
"score": "0.60520905",
"text": "def key(method)\n @_key = method\n end",
"title": ""
},
{
"docid": "2ef8d5d3d57281586e2d0bffb5a489ed",
"score": "0.6049443",
"text": "def []=(key, item)\n item.set_collection_key(key)\n add(item)\n end",
"title": ""
},
{
"docid": "39b1a369d86d67eee4e2368d6ffe8c31",
"score": "0.60293806",
"text": "def assoc(key)\n super(convert_key(key))\n end",
"title": ""
},
{
"docid": "7343fe7832e3b786e774eca56ed15cdd",
"score": "0.6022705",
"text": "def add_key_data(key_data_); end",
"title": ""
}
] |
8b94716d8192501036f7e1a183781b5e
|
Apply gravity to the specified objects.
|
[
{
"docid": "b353ad04f3f8f57a58e2a39b590f2211",
"score": "0.88652205",
"text": "def apply_gravity_to(objects)\n objects.each {|object| object.body.apply_force *gravitational_forces }\n end",
"title": ""
}
] |
[
{
"docid": "52d2bb694198efc71c56f4eec2077e2e",
"score": "0.69898224",
"text": "def apply_gravity(other_moon)\n apply_gravity_to_dimension(X, other_moon)\n apply_gravity_to_dimension(Y, other_moon)\n apply_gravity_to_dimension(Z, other_moon)\n end",
"title": ""
},
{
"docid": "1b1f753115afa66144a5dd1f5d7ebead",
"score": "0.69158",
"text": "def gravity_affects(object)\n victims_of_gravity.push object\n end",
"title": ""
},
{
"docid": "372d5b5532a4e2de8dcce0cde83bdbf9",
"score": "0.6829341",
"text": "def apply_gravity!\n @acceleration += gravity if @acceleration < gravity\n @speed += @acceleration\n end",
"title": ""
},
{
"docid": "91e32b2a07693065387f6328acd9dc1c",
"score": "0.6810888",
"text": "def apply_gravity!\n @moons.permutation(2).each do |(moon1, moon2)|\n moon1.apply_gravity(moon2)\n end\n end",
"title": ""
},
{
"docid": "427a08792e9ca5e5c1da2f95ec8da909",
"score": "0.6617999",
"text": "def gravity\n end",
"title": ""
},
{
"docid": "df34694582193c282e26ad74ed9535fa",
"score": "0.6244111",
"text": "def process_gravity(moon, other_moon)\n if moon.pos.x < other_moon.pos.x\n moon.vel.x += 1\n # other_moon.vel.x -= 1\n elsif moon.pos.x > other_moon.pos.x\n moon.vel.x -= 1\n # other_moon.vel.x += 1\n end\n\n if moon.pos.y < other_moon.pos.y\n moon.vel.y += 1\n # other_moon.vel.y -= 1\n elsif moon.pos.y > other_moon.pos.y\n moon.vel.y -= 1\n # other_moon.vel.y += 1\n end\n\n if moon.pos.z < other_moon.pos.z\n moon.vel.z += 1\n # other_moon.vel.z -= 1\n elsif moon.pos.z > other_moon.pos.z\n moon.vel.z -= 1\n # other_moon.vel.z += 1\n end\nend",
"title": ""
},
{
"docid": "1129c23fbb5c1dd17a53b1e9bce053f0",
"score": "0.62098646",
"text": "def applyGravity(theSystem)\n\n\tlastIndex = theSystem.size - 1;\n\n\t0.upto(lastIndex) do |startIndex|\n\t\t(startIndex+1).upto(lastIndex) do |otherIndex|\n\t\t\n\t\t\tattractMoons(theSystem[startIndex], theSystem[otherIndex]);\n\n\t\tend\t\n\tend\n\nend",
"title": ""
},
{
"docid": "fc12bba106f55a739e48d555279d9b1c",
"score": "0.61645293",
"text": "def gravity\n impacting_positions.each do |other_position|\n # Reuse `x <=> y` to get \"how will y move to get to x\". Has the following cases:\n # x <=> y when x == y => 0\n # x <=> y when x < y => -1\n # x <=> y when x > y => 1\n # Note the flipping of position / other position\n @velocity[0] += other_position[0] <=> @position[0]\n @velocity[1] += other_position[1] <=> @position[1]\n @velocity[2] += other_position[2] <=> @position[2]\n end\n end",
"title": ""
},
{
"docid": "e2066a2d5a6f2f0800517e61ad51d75d",
"score": "0.606686",
"text": "def allocate_gravity(params, allocations)\n g = params['gravity']\n\n allocations.each_index do |i|\n next unless allocations[i].is_a?(ItemAllocation)\n allocations[i].gravity =\n case g\n when nil then 0.5\n when Numeric then [ 0, g, 1 ].sort[1]\n when 'left', 'top' then 0\n when 'right', 'bottom' then 1\n when 'outer' then distrib_gravity(allocations, i)\n when 'center' then 1 - distrib_gravity(allocations, i)\n else 0.5\n end\n end\n end",
"title": ""
},
{
"docid": "3aa425716c5b3d15b949d5fed809bbe6",
"score": "0.6066531",
"text": "def force_gravity_(mass1, position1_, mass2, position2_)\n ((-G * mass1 * mass2) / (position1_.distance(position2_)**2)) * position1_.unit_(position2_)\n end",
"title": ""
},
{
"docid": "51845b4d6b17bc537d40f027d36877c0",
"score": "0.60616064",
"text": "def surface_gravity\n G * mass / (radius * radius)\n end",
"title": ""
},
{
"docid": "ab9d44c4ff90c2c130310d1c562ed1c7",
"score": "0.5966798",
"text": "def setGravity(gravity)\n @wind = 5*gravity.dx\n gravity.dx = 0\n physicsWorld.gravity = gravity\n end",
"title": ""
},
{
"docid": "f023869f0a26e7381b643503aefd1c83",
"score": "0.59527177",
"text": "def update_gravity()\n @velocity.y += GRAVITY;\n check_collision()\n end",
"title": ""
},
{
"docid": "5da5f7cdd0cb0ec158b24113350f92d7",
"score": "0.5940598",
"text": "def applyForce(vector)\n vector = vector.clone\n force = vector / @material.mass\n @grounded = false #just use this opportunity to check if it really is grounded\n @acceleration += force #adds the force to this frames acceleration\n end",
"title": ""
},
{
"docid": "e5c296f53dc875026b114a623040675a",
"score": "0.575726",
"text": "def do(actor, targets)\n #Acceleration will be limited by elapsed time.\n push_force = delta\n targets.each do |target|\n #Angle to target is also angle of push force.\n push_angle = Utility.find_angle(actor.location, target.location)\n #Apply the force to the creature's movement vector.\n target.vector += Vector.new(push_force, push_angle)\n end\n end",
"title": ""
},
{
"docid": "92feef540a048b64e14942dc7a0be13e",
"score": "0.5671426",
"text": "def apply_gravity_to_dimension(dimension, other_moon)\n if other_moon.position[dimension] > @position[dimension]\n @velocity[dimension] += 1\n elsif other_moon.position[dimension] < @position[dimension]\n @velocity[dimension] -= 1\n end\n end",
"title": ""
},
{
"docid": "9f0709ff3bc644c268446effcd36533d",
"score": "0.5585902",
"text": "def gravity=(gravity_or_x)\n if gravity_or_x.kind_of? Numeric\n @world.set_gravity(0, gravity_or_x)\n else\n raise \"Not implemented yet\"\n# @world.set_gravity(gravity_or_x)\n end\n end",
"title": ""
},
{
"docid": "4309ac759a396e6423ecd052a43f8365",
"score": "0.5565992",
"text": "def apply_force(force)\n f = force.get\n f.div(@mass)\n @acceleration.add(f)\n end",
"title": ""
},
{
"docid": "4309ac759a396e6423ecd052a43f8365",
"score": "0.5565992",
"text": "def apply_force(force)\n f = force.get\n f.div(@mass)\n @acceleration.add(f)\n end",
"title": ""
},
{
"docid": "6b2fa2987601826919ac657b590dbded",
"score": "0.5503078",
"text": "def player_gravity(player)\n # Acceleration/gravity\n # By adding 0.01 each frame, players velocity will increase in the y direction\n player.vy += 0.01\n\n # Vertical movement and horizontal movement\n # if falling else rising\n if player.vy > 0 \n # check if impact\n if would_fit(player, 0, 1) && would_fit(player, 1, 0) && would_fit(player, -1, 0)\n player.y += player.vy # exponetial falling of the players y axis\n player.x = player.x + player.vx # constant x velocity\n player.velocityStoredy = player.vy # stored velocities y and x for landing pads \n player.velocityStoredx = player.vx\n else \n # impact means landed or crashed and velocity y is set to 0\n player.vy = 0\n end \n else \n if would_fit(player, 0, -1) && would_fit(player, 1, 0) && would_fit(player, -1, 0)\n player.y += player.vy + 0.1 # exponetial rising of the players y axis\n player.x += player.vx # exponential x velocity (rocket would be on)\n else \n player.vy = 0\n end \n end\nend",
"title": ""
},
{
"docid": "45b0f8c12f57b384676efd6733a72d9d",
"score": "0.5462015",
"text": "def clean_up\n space_objects.each {|object| object.body.reset_forces }\n end",
"title": ""
},
{
"docid": "4495cabdd7f7d50072b05dba4449d4c9",
"score": "0.5458788",
"text": "def apply_gravity_change(moon, change)\n return moon unless moon[:name] == change[:moon_name]\n if change[:dimension] == 'x'\n Moon.new(moon[:name], moon[:position], Coord.new(moon[:velocity][:x] + change[:change], moon[:velocity][:y], moon[:velocity][:z]))\n elsif change[:dimension] == 'y'\n Moon.new(moon[:name], moon[:position], Coord.new(moon[:velocity][:x], moon[:velocity][:y] + change[:change], moon[:velocity][:z]))\n elsif change[:dimension] == 'z'\n Moon.new(moon[:name], moon[:position], Coord.new(moon[:velocity][:x], moon[:velocity][:y], moon[:velocity][:z] + change[:change]))\n end\nend",
"title": ""
},
{
"docid": "354c5629e28fce0971aba2150cf99d9b",
"score": "0.54266256",
"text": "def gravity\n @options[:gravity] || 'center'\n end",
"title": ""
},
{
"docid": "681e8d6324448624eafedf500efee30c",
"score": "0.5421543",
"text": "def update\n #@objects.each { |o| o.center.move(LinearAlgebra::Vector3D.new(0,0,-1)) }\n #@objects.each { |o| o.center.rotate(1,0,2) }\n #@objects.each { |o| o.spots.each { |x| x.center.rotate(0,0,1) }}\n #if @step_count == 10 # 6 times / s\n # @step_count = 0\n # @objects.each { |o| o.spots.each { |x| x.center.rotate(0,0,1) }}\n #else\n # @step_count += 1\n #end\n end",
"title": ""
},
{
"docid": "331362daf105a071255b0cf0c1c6d440",
"score": "0.541577",
"text": "def setup(gravity = false)\n @space = Space.new\n @space.damping = 0.0\n if gravity\n @space.gravity = Vec2.new(0.0, 25.0)\n end\n end",
"title": ""
},
{
"docid": "6eb61868e729f4e868ee555e4344f290",
"score": "0.5412144",
"text": "def computeForces\n\t\n\t\t#\n\t\t# First Clear out the forces on the particles\n\t\t#\n\t\tfor p1 in @particles\n\t\t\tp1.force.zero()\n\t\tend\n\t\t\n\t\tfor p1 in @particles\n\t\t\tfor p2 in @particles\n\t\t\t\tif ( p1 == p2 )\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t#\n \t\t\t# The delta position vector\n \t\t\t#\t\t\n \t\t\tdeltaS = p2.pos - p1.pos\n\t\t\n \t\t\t#\n \t\t\t# Get the sq of the distance.\n \t\t\t#\n \t\t\tdistance2 = deltaS.magnitude2\n\n\t\t\t\t#\n \t\t\t# Get the distance\n \t\t\t#\n \t\t\tdistance = sqrt(distance2)\n\t\t\t\t\n\t\t\t\tif ( distance > 100 )\n \t\t\t\t#\n \t\t\t\t# Normalize the position vector\n \t\t\t\t#\n \t\t\t\tforce = deltaS.scalarDiv(distance)\n\n \t\t\t\t#\n \t\t\t\t# Now compute the total force of gravity\n \t\t\t\t#\n \t\t\t\tg = 10.0 * p1.mass * p2.mass / distance2\n\n \t\t\t\t#\n \t\t\t\t# Compute the components of the force\n \t\t\t\t#\n \t\t\t\tforce.scalarMul!(g)\n\n \t\t\t\tp1.force.add!( force )\n\t\t\t\t\tp2.force.sub!( force )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "0e926e90ec0dd587f9c70a4aab7a44c1",
"score": "0.54023546",
"text": "def move\n\[email protected] do |go|\n\t\tgo.move\n\t\t\n\t\[email protected](go) if go.kind_of? PTorpedo and (go.xCenter > @xMax or go.yCenter > @yMax)\n\tend\n\t\n\t# check for collisions between objects and act accordingly\n\tcollisions if not @ship.destroyed\n end",
"title": ""
},
{
"docid": "62803c1d6555abfe05dacab5a2d8abd3",
"score": "0.5354867",
"text": "def gravity=(value)\n end",
"title": ""
},
{
"docid": "23e2905b778c78c95ea5d82e12c7b3bd",
"score": "0.53512377",
"text": "def do(actor, targets)\n #Acceleration will be limited by elapsed time.\n pull_force = delta\n targets.each do |target|\n #Angle from target to actor is also angle of pull force (opposite of that for push).\n pull_angle = Utility.find_angle(target.location, actor.location)\n #Apply the force to the creature's movement vector.\n target.vector += Vector.new(pull_force, pull_angle)\n end\n end",
"title": ""
},
{
"docid": "ea70429640dc61bb3e19597da88f4a4e",
"score": "0.53294545",
"text": "def gravity=(acceleration)\n acceleration = acceleration.to_f\n Sketchup.active_model.set_attribute('MSPhysics', 'Gravity', acceleration)\n sim = MSPhysics::Simulation.instance\n sim.world.set_gravity(0, 0, acceleration) if sim\n end",
"title": ""
},
{
"docid": "200df6b109f53f9793b5e719c8b13183",
"score": "0.53090554",
"text": "def gravity_effected=(flag)\n @body.gravity_effected = flag\n end",
"title": ""
},
{
"docid": "e7e66eff18a8f473849afc05cb2f498f",
"score": "0.5234664",
"text": "def step\n apply_gravity\n apply_velocity\n end",
"title": ""
},
{
"docid": "38db104d672d3b806bde0cde6db2033c",
"score": "0.52123016",
"text": "def shift_gravity\n\t\t@dash_layer.hidden = true\n\t\[email protected] = @edge_catmask \n\t\tcase @marker.side\n\t\twhen :top \n\t\t\tself.physicsWorld.gravity=CGVectorMake(0, -@pull_value)\n\t\twhen :left\n\t\t\tself.physicsWorld.gravity=CGVectorMake(@pull_value, 0)\n\t\twhen :bottom\n\t\t\tself.physicsWorld.gravity=CGVectorMake(0, @pull_value)\n\t\twhen :right\n\t\t\tself.physicsWorld.gravity=CGVectorMake(-@pull_value, 0)\n\t\t\[email protected] = @leaky_catmask \n\t\t\t@dash_layer.hidden = false\n\t\tend\n\tend",
"title": ""
},
{
"docid": "49ba6b4c674ea6025eb49b7ade8ea5c5",
"score": "0.5211116",
"text": "def wrap_objects\r\n moving_objects.each do |item|\r\n item.vector.x %= @width\r\n item.vector.y %= @height\r\n end\r\n end",
"title": ""
},
{
"docid": "3a275d8bf0f59dbc1dd21a2219e690b1",
"score": "0.5203314",
"text": "def accumulate_forces\r\n @particles.each do |p|\r\n p.acc = MVector.new(0,0,0)\r\n p.forces.each do |f|\r\n case f.type\r\n when :gravity\r\n p.acc += @gravity\r\n else\r\n p.acc += f.vector\r\n end\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "fdf59b6491b16f55582ada510c7144ed",
"score": "0.52031076",
"text": "def apply_force(force:)\n @acceleration += force\n end",
"title": ""
},
{
"docid": "100b0a8393f838b73f48b3c6f1f93bd9",
"score": "0.51986146",
"text": "def bounce other_object\n #Calculate new velocity, after the hit \n if other_object.type == :vertical\n #If the object was vertical change x velocity\n @shape.body.v.x = [email protected] \n else\n #If the object was horizontal change y velocity\n @shape.body.v.y = [email protected] \n end \n #Show bounce effect\n @z_bounce = @z\n end",
"title": ""
},
{
"docid": "5a44e84e4d4ee93aed23dda4b3febad4",
"score": "0.5187816",
"text": "def act(environment, elapsed_time:)\n environment.objects.each do |object|\n #Slow object.\n acceleration = @force * elapsed_time\n speed = object.vector.speed\n if speed > 0\n speed -= acceleration \n speed = 0 if speed < 0\n elsif speed < 0\n speed += acceleration\n speed = 0 if speed > 0\n end\n object.vector.speed = speed\n end\n end",
"title": ""
},
{
"docid": "d82f76b7fb953b365710989fbd1652d6",
"score": "0.5150424",
"text": "def mark_gravity(name, direction = None)\n if direction == None\n execute('mark', 'gravity', name)&.to_sym\n else\n execute_only('mark', 'gravity', name, direction)\n end\n end",
"title": ""
},
{
"docid": "05359752778ad3f60184f27760f207c7",
"score": "0.5148021",
"text": "def compute_forces (pa,pb,dt)\n\t\t#first calculate the distance between the two objects\n\t\tr = pa.pos - pb.pos;#vectors\n\t\t#Using Gravitation law and Newton second law, find the acceleration imparted on pa\n\t\tpa.acceleration = ((- G*pb.mass) / r.magnitude**2) * r.normalize\n\t\t# ...now that we know acceleration, do step-calculation of the velocity\n\t\tpa.velocity += pa.acceleration * dt\n # ... what is left is to calculate the new position..... from the velocity\n\tend",
"title": ""
},
{
"docid": "237756915dbb8a593390d3ea255b6cd9",
"score": "0.5115691",
"text": "def tick_by_matrix\n # apply gravity by updating velocity\n @objects.each_with_index do |o1, i1|\n m1 = Matrix.zero(1,3)\n d1 = [0, 0, 0]\n @objects.each_with_index do |o2, i2|\n d2 = [0, 0, 0]\n [0, 1, 2].each do |axis|\n a1 = o1[axis]\n a2 = o2[axis]\n value = if a1 < a2\n 1\n elsif a1 > a2\n -1\n else\n 0\n end\n d2[axis] = value\n d1[axis] += value\n end\n m2 = Matrix[d2]\n m1 = m1 + m2\n puts '%d %d o1: %p o2: %p d1: %p d2: %p' % [i1, i2, o1[0,3], o2[0,3], d1, d2]\n end\n d1.each_with_index do |d,i|\n o1[i] += 1\n end\n end\n @tick_count += 1\n self\n end",
"title": ""
},
{
"docid": "8e07500ef3ec1c2b38dde61fd8617e71",
"score": "0.51130235",
"text": "def act(environment, elapsed_time:)\n environment.objects.each do |object|\n if (object.location.x < @left) then\n object.location.x = @left\n object.vector.pitch = Utility.find_reflection_angle(90, object.vector.pitch)\n elsif (object.location.x > @right) then\n object.location.x = @right\n object.vector.pitch = Utility.find_reflection_angle(270, object.vector.pitch)\n end\n if (object.location.y > @top) then\n object.location.y = @top\n object.vector.pitch = Utility.find_reflection_angle(0, object.vector.pitch)\n elsif (object.location.y < @bottom) then\n object.location.y = @bottom\n object.vector.pitch = Utility.find_reflection_angle(180, object.vector.pitch)\n end\n end\n end",
"title": ""
},
{
"docid": "3bfd5b14faf81c9beac75997afd701ee",
"score": "0.5111316",
"text": "def gravity_from(options)\n position = options[:position] || :forget\n \n position = position.to_s.downcase.to_sym unless position.is_a?(Array)\n position = position.collect{ |s| s.to_s.downcase }.sort.join(\"_\").to_sym if position.is_a?(Array)\n \n case position\n when :left_top, :northwest then Magick::NorthWestGravity\n when :top, :center_top, :north then Magick::NorthGravity\n when :right_top, :northeast then Magick::NorthEastGravity\n when :left, :center_left, :west then Magick::WestGravity\n when :center, :center_center then Magick::CenterGravity\n when :right, :center_right, :east then Magick::EastGravity\n when :bottom_left, :southwest then Magick::SouthWestGravity\n when :bottom, :bottom_center, :south then Magick::SouthGravity\n when :bottom_right, :southeast then Magick::SouthEastGravity \n else Magick::ForgetGravity\n end\n end",
"title": ""
},
{
"docid": "2e193e7d5efcbeae07c63c15c3312f9d",
"score": "0.5098245",
"text": "def accelerate\n @body.apply_force((@body.a.radians_to_vec2 * (50.0)), CP::Vec2.new(0.0, 0.0))\n end",
"title": ""
},
{
"docid": "764994efbc4abd2f506bc8498ee2d2c8",
"score": "0.5054618",
"text": "def act(environment, elapsed_time:)\n environment.objects.each do |object|\n if (object.location.x < @left) then\n object.location.x = @right\n elsif (object.location.x > @right) then\n object.location.x = @left\n end\n if (object.location.y > @top) then\n object.location.y = @bottom\n elsif (object.location.y < @bottom) then\n object.location.y = @top\n end\n end\n end",
"title": ""
},
{
"docid": "a909d501ef0372803b5af11aef8a91f7",
"score": "0.5054195",
"text": "def gravity\n original.wider? ? \"center\" : \"north\"\n end",
"title": ""
},
{
"docid": "3c60ff13db1fd370d03a2ba661bf2e1e",
"score": "0.5035529",
"text": "def update_velocity(gravity, damping, dt); end",
"title": ""
},
{
"docid": "3c60ff13db1fd370d03a2ba661bf2e1e",
"score": "0.5035529",
"text": "def update_velocity(gravity, damping, dt); end",
"title": ""
},
{
"docid": "3c60ff13db1fd370d03a2ba661bf2e1e",
"score": "0.5035529",
"text": "def update_velocity(gravity, damping, dt); end",
"title": ""
},
{
"docid": "8fbd1f7f991241aefc64ddced0951bb9",
"score": "0.50242335",
"text": "def physics\n # Clean up from last run, so collision detection can begin anew.\n cannidates = Array.new\n @grounded = false\n\n # Find all the objects we're touching, so we can work with them instead of every gameobject.\n self.game.objects.each do |object|\n if self.box.collides?(object.box)\n \n # Check all the objects we're touching for tags we care about\n if object.tags.include? \"kill\"\n self.die\n elsif object.tags.include? \"goal\"\n self.at_goal\n end\n \n cannidates.push(object)\n end\n end\n\n # Deal with our lucky winners and see what's what.\n cannidates.each do |cannidate|\n \n # Are one of our feet between the cannidates left and right bounds?\n # Holy moley.\n if self.box.left_foot.x > cannidate.box.origin.x and self.box.left_foot.x < cannidate.box.origin.x + cannidate.box.width or self.box.right_foot.x < cannidate.box.origin.x + cannidate.box.width and self.box.right_foot.x > cannidate.box.origin.x\n if cannidate.tags.include? \"solid\" \n @grounded = true\n @current_jump = 0\n debug(\"Grounded. Feet Y: #{self.box.left_foot.y} Boxtop Y: #{cannidate.box.origin.y}\")\n end\n end\n end\n end",
"title": ""
},
{
"docid": "c599f60ae479ffb1706cf2c5d8c34931",
"score": "0.4998687",
"text": "def moving_objects\r\n @asteroids + @effects + @shots + [@ship]\r\n end",
"title": ""
},
{
"docid": "897d7706dc4d604351c0e3f4e3b128dc",
"score": "0.4978885",
"text": "def apply\n\t\tmin = 10\n\t\t\n\t\t# NOTE: Group update resizes the rectangle, which can cause jitter and other problems when that resizing intersects with the resizing happening in this action.\n\t\t\n\t\t\n\t\t# TODO: should be calling a Entity-specific resize method, so like, Text can use the \"exact dimension resize\" logic currently seen in the Text resize action.\n\t\t# TODO: make sure this works with n-level nested groups\n\t\t\n\t\t\n\t\t# NOTE: you must limit the rescaling of the group such that you do not scale any member below it's minimum size. If you do not, then you will get distortion.\n\t\t\n\t\t# === resize all entities\n\t\t# TODO: should only really compute either dx or dy\n\t\t# TODO: consider using (delta / old + 1) rather than (delta + old / old) to get dx or dy\n\t\t\n\t\t\n\t\t@memo = @entity.resize!(\n\t\t\t@grab_handle, :world_space, point:@point,\n\t\t\tminimum_dimension:1, lock_aspect:true, limit_by: :smaller\n\t\t)\n\tend",
"title": ""
},
{
"docid": "28665220aa1047af6c8733b3bceff54b",
"score": "0.4955016",
"text": "def accelerate\n @shape.body.apply_force(@shape.body.rot * (3000.0/SUBSTEPS), CP::Vec2.new(0.0, 0.0))\n end",
"title": ""
},
{
"docid": "67d633d4f14268fcb2b611af67bab2c5",
"score": "0.49039558",
"text": "def applyVelocity(theSystem)\n\n\ttheSystem.each do |theMoon|\n\t\ttheMoon[:pos].add(theMoon[:vel]);\n\tend\t\t\n\nend",
"title": ""
},
{
"docid": "ab38a50d7f041e6c1dcb86f2d7dfb684",
"score": "0.4899094",
"text": "def act(environment, elapsed_time:)\n environment.objects.each do |object|\n object.vector.speed = Utility.constrain_value(object.vector.speed, @maximum)\n end\n end",
"title": ""
},
{
"docid": "2ea10ef670fe9a9b42bf3d02470b4a56",
"score": "0.48361248",
"text": "def bird_fly\n move\n margin = 20\n @y += @velocityY * @window.delta if @y > @velocityY * @window.delta + margin\n @gravity += INCREASE_GRAVITY\n @a += 0.5\n @a = [@a,90].min\n @y += @gravity * @window.delta\n end",
"title": ""
},
{
"docid": "520f2441461e4426c5979095191a50e6",
"score": "0.4798443",
"text": "def enable_gravity(state)\n Body.validate(self)\n MSPhysics::Newton::Body.enable_gravity(@_address, state)\n end",
"title": ""
},
{
"docid": "b2a40387125e8633f6d9cb0da0443787",
"score": "0.47879615",
"text": "def gravityMove()\n if (@gravity_counter == getGravityThreshold())\n @gravity_counter = 0\n @can_move = false\n return moveDown()\n end\n return true\n end",
"title": ""
},
{
"docid": "9d16dc56e5d54d09ad8bbcc79423a4ca",
"score": "0.47837174",
"text": "def computeGravitationalForce( p1, p2 )\n \n\n\n end",
"title": ""
},
{
"docid": "9b0ab4b7f6c26e0a037bdff29ca43c49",
"score": "0.477239",
"text": "def adjust_x\n @attached_objects_x.each_pair do |object, x|\n object.x = self.x + x\n end\n end",
"title": ""
},
{
"docid": "37d155c6996a1162d3cbb6b6b11a9057",
"score": "0.4772024",
"text": "def update\n return unless @running\n start = Time.new\n @spt.times do\n @elapsed += 1\n bc = barycenter\n @energy = 0\n @bodies.each do |body|\n # Add KE\n @energy += 0.5 * body.mass * body.vel.magnitude ** 2\n body.acc.x = body.acc.y = 0\n @bodies.each do |body2|\n next if body2 == body\n # Add PE\n @energy += G * body.mass * body2.mass / ( body2.pos - body.pos ).magnitude\n\n # Accel of body2 on body\n d = Math.sqrt((body.pos.x - body2.pos.x)**2 + (body.pos.y - body2.pos.y)**2)\n acc_vect = Vector.new((body2.pos.x - body.pos.x) / d, (body2.pos.y - body.pos.y) / d)\n body.acc.add! (acc_vect * (G * body2.mass / (d*d)))\n end\n end\n colliding = []\n @bodies.each do |body|\n body.vel.add! body.acc\n body.pos.add! body.vel\n @bodies.each do |body2|\n if body.collides?(body2)\n colliding << [body, body2]\n end\n end\n end\n colliding.each do |pair|\n body1 = pair.first\n body2 = pair.last\n @bodies.delete(body1.collide_with(body2, elapsed))\n end\n end\n if @bodies.size <= 1\n @running = false\n end\n stop = Time.new\n if (delta_t = stop.to_f - start.to_f) > 1.0\n puts \"WARN: TICK TOOK #{((stop.to_f - start.to_f) * 1000.0).round(1)} ms\"\n end\n end",
"title": ""
},
{
"docid": "0af1391d7dc88151ce571ab5bff4612d",
"score": "0.47704086",
"text": "def reset_forces() @body.reset_forces(); @body.w *= 0.98 end",
"title": ""
},
{
"docid": "cb93e4b8037d1d1355cce8e1b28f723a",
"score": "0.47627857",
"text": "def behavior_hungry\n @world.food.each do |food|\n if distance_from_point(food.position) < (food.quantity + @vision_range)\n @delta -= self.position - food.position\n end \n if distance_from_point(food.position) <= food.quantity + 5\n eat food\n end \n end \n end",
"title": ""
},
{
"docid": "9588e212d6a28e1eb3dfc0e1a85e36ee",
"score": "0.47571403",
"text": "def total_gravity_calculation(hash_of_document_type_wise)\n hash_of_document_type_wise.map { |_, (_, gravity_per_doc)| gravity_per_doc }.inject(:+)\n end",
"title": ""
},
{
"docid": "2084f791e79cf002a60dd839a7ff1f46",
"score": "0.4755096",
"text": "def position_gravity_acceleration_(position0_, velocity0_, time)\n position_constant_acceleration_(position0_, velocity0_, ACCELERATION_GRAVITY_, time)\n end",
"title": ""
},
{
"docid": "12e5d6809a1e60c68a0874ae9adb21d0",
"score": "0.47399226",
"text": "def calculate_gravity_of_each_document(document_information,document_type)\n ((document_information.map(&:first).inject(:+) * @@gravities_of_files[document_type])/1000).round(2)\n end",
"title": ""
},
{
"docid": "b6fbbdfcf701b94ca2bd7ec49cae55e6",
"score": "0.4713262",
"text": "def added_gravity_calculation(hash_of_document_type_wise)\n hash_of_document_type_wise.map do |document_type,(number_of_documents, _)|\n number_of_documents * @@gravities_of_files[document_type]\n end.inject(:+).round(2)\n end",
"title": ""
},
{
"docid": "3930d1e14e97f5bf854bfb4537615f6b",
"score": "0.47070378",
"text": "def accelerate\n @shape.body.apply_force((@shape.body.a.radians_to_vec2 * (10000.0/SUBSTEPS)), CP::Vec2.new(0.0, 0.0))\n end",
"title": ""
},
{
"docid": "e0dd043dfc25d75f19383c9bb448dffe",
"score": "0.4702785",
"text": "def move_objects_to_quadtrees\n return if (@objects.empty?)\n @objects.each do |object|\n get_quadtrees.detect do |quadtree|\n next quadtree.add_object_to_quadtree(object)\n end\n end\n @objects.clear\n end",
"title": ""
},
{
"docid": "d6c3f14b3434ffed4b0446eedbb51af8",
"score": "0.47014946",
"text": "def gc(*objects)\n objects = if objects.empty?\n object_space.keys\n else\n objects.map { |obj| obj.__id__ }\n end\n\n objects.each do |id|\n finalizers = object_space.delete(id)\n if finalizers\n finalizers.each{|finalizer| finalizer.call(id)}\n end\n end\n end",
"title": ""
},
{
"docid": "88891e662cf46ec5b0f1e9f9bad79830",
"score": "0.4689947",
"text": "def set_force(x, y)\n @body.set_force(x, y)\n end",
"title": ""
},
{
"docid": "07eb3c4bea74ec6c9c59edf0dcf9ef7c",
"score": "0.4686881",
"text": "def boost\n @shape.body.apply_force(@shape.body.rot * (3000.0), CP::Vec2.new(0.0, 0.0))\n end",
"title": ""
},
{
"docid": "756737eeaa82d62e7c5de1834965a74e",
"score": "0.4672719",
"text": "def computeForces\n #puts \">computeForces\"\n @energy = 0.0\n 0.upto(@forces.length-1) do |i|\n if @dimension == 2\n @forces[i] = Coord2d.new(0.0, 0.0)\n elsif @dimension == 3\n @forces[i] = Coord3d.new(0.0, 0.0, 0.0)\n end\n end\n\n # Loop over all pairs\n 0.upto(@forces.length-2) do |i|\n (i+1).upto(@forces.length-1) do |j|\t\n\tseparation = @newPositions[i].minus(@newPositions[j])\n\t# Periodic boundary condition\n\tboxImage = separation.elementDivide(@box)\n\n if @dimension == 2\n\t boxImage = Coord2d.new(boxImage.x.round,\n boxImage.y.round)\n elsif @dimension == 3\n\t boxImage = Coord3d.new(boxImage.x.round,\n boxImage.y.round,\n boxImage.z.round)\n end\n\n\tseparation = separation.minus(@box.elementTimes(boxImage))\n\tsepLength = separation.length\n\t#puts \"(#{i},#{j}) sepLength: #{sepLength}\"\n\n\tif sepLength < @cutoff then\n\t sepSquared = separation.dot(separation)\n\t sep2i = 1.0 / sepSquared\n\t sep6i = sep2i ** 3.0\n\t force = 48 * sep2i * sep6i * (sep6i-0.5)\n\t #force = 48 * sep6i * (sep2i-0.5)\n\t #puts \"force: #{force}\"\n\t @forces[i] = @forces[i].plus(separation.times(force))\n\t @forces[j] = @forces[j].minus(separation.times(force))\n\t @energy += 4 * sep6i * (sep6i - 1.0) - @cutoffEnergy\n\t #@energy += 4 * sep6i * (sep2i - 1.0) - @cutoffEnergy\n\t #puts \"energy: #{@energy}\"\n\tend\n end\n end\n #puts \"<computeForces\"\n end",
"title": ""
},
{
"docid": "617df2dc6f5936d6df33b40937517d1d",
"score": "0.46717796",
"text": "def gravity\n default = MSPhysics::DEFAULT_SIMULATION_SETTINGS[:gravity]\n attr = Sketchup.active_model.get_attribute('MSPhysics', 'Gravity', default)\n return attr.to_f\n end",
"title": ""
},
{
"docid": "82981da0a2966861445362824837093a",
"score": "0.46592808",
"text": "def centreOfGravity()\n x = y = z = total = 0\n \n self.each_atom{ |atom|\n element = atom.element[0,1]\n mass = ElementMass[element]\n total += mass\n x += atom.x * mass\n y += atom.y * mass\n z += atom.z * mass\n }\n \n x = x / total\n y = y / total\n z = z / total\n \n Coordinate[x,y,z]\n end",
"title": ""
},
{
"docid": "42ab439a0dab439a70d9c3a06046e1e8",
"score": "0.46568793",
"text": "def compute_all dt\n @i+=1\n\n\t\[email protected] do |pa|\n\t\t\[email protected] do |pb|\n\t\t\t\tunless (pa == pb) #skip if the same obj\n\t\t\t\t\tcompute_forces pa,pb,dt\n\t\t\t\tend\n\t\t\tend\n\t\t\tnew_position pa, dt\n\t\tend\n\tend",
"title": ""
},
{
"docid": "8fe18ec57afea518f0f32428456549c8",
"score": "0.46507815",
"text": "def trigger *args\n get_colliding_objects.each do |object|\n @trigger_method.call object, *args\n end\n end",
"title": ""
},
{
"docid": "29746e02e06d7c21ac462f280ad1e94a",
"score": "0.46507552",
"text": "def apply_force(force, offset); end",
"title": ""
},
{
"docid": "29746e02e06d7c21ac462f280ad1e94a",
"score": "0.46507552",
"text": "def apply_force(force, offset); end",
"title": ""
},
{
"docid": "05dc9f83afb5faf150fc96f97ee2a3fa",
"score": "0.46457922",
"text": "def each_bounding_circle_collision(*klasses)\r\n Array(klasses).each do |klass|\r\n object2_list = (klass.respond_to?(:all) ? klass.all : Array(klass))\r\n #total_radius = object1.radius + object2.radius # possible optimization?\r\n \r\n self.all.each do |object1|\r\n object2_list.each do |object2|\r\n next if object1 == object2 # Don't collide objects with themselves\r\n next unless object1.collidable && object2.collidable\r\n yield object1, object2 if Gosu.distance(object1.x, object1.y, object2.x, object2.y) < object1.radius + object2.radius\r\n end\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "161d607e4f191d185bbdd3c366e25ad5",
"score": "0.46411645",
"text": "def equivalent_gravity_sphere_of_influence\n return self.periapsis * (self.secondary_body.mass / self.primary_body.mass)**(1.0/3.0)\n end",
"title": ""
},
{
"docid": "661403121dc35b698db7a1b008776d7e",
"score": "0.46260193",
"text": "def at(pos)\r\n r = pos - @obj.pos\r\n return V2D[0, 0] if r.abs < @min_dist\r\n gravity = - r * @a / (r.abs ** (@n+1) )\r\n #gravity.tap {|x| puts \"Gravity: #{x.x},#{x.y}\" }\r\n end",
"title": ""
},
{
"docid": "b7c04f05a8d30e69b02d5695dd34c21f",
"score": "0.46211937",
"text": "def update\n @active_objects.each(&:update)\n @car.update\n collision_spot = @map.check_collision(@car)\n crash(collision_spot) unless collision_spot.nil?\n win if @map.reached_end?(@car)\n end",
"title": ""
},
{
"docid": "5bf8aeb4afd1898f96251104c0cb87ec",
"score": "0.4617929",
"text": "def accelerate(accelerating, force = 2000.0)\n reset_forces # When a force or torque is set on a body, it is cumulative - start from zero\n @accelerating = accelerating\n if accelerating\n @shape.body.apply_force((self.class.radians_to_vec2(angle) * force), zero_offset)\n @@thrust_sample.resume unless @@thrust_sample.playing?\n else\n @@thrust_sample.pause if @@thrust_sample.playing?\n end\n end",
"title": ""
},
{
"docid": "2f85c14d5788cc820ae6b83ec13c91c5",
"score": "0.45990512",
"text": "def resize_to_fill(width, height, gravity: T.unsafe(nil), **options); end",
"title": ""
},
{
"docid": "1220557e3bec9d36d1928ccc4c6c8440",
"score": "0.45983642",
"text": "def force_weight_(mass)\n ACCELERATION_GRAVITY_ * mass\n end",
"title": ""
},
{
"docid": "e955fffb5c0a6eea1a40309a3183eb0a",
"score": "0.45929304",
"text": "def gravity_affected?\n return data.gravity\n end",
"title": ""
},
{
"docid": "79603c2c62f3775b17721943ae97557f",
"score": "0.45761618",
"text": "def run(obstacles)\n unless stopped || hit_target\n apply_force(dna.genes[@gene_counter])\n @gene_counter = (@gene_counter + 1) % dna.genes.size\n update\n # If I hit an edge or an obstacle\n obstacles(obstacles)\n end\n # Draw me\n display unless stopped\n end",
"title": ""
},
{
"docid": "68a3f4d28bb2d721099e17e3f00869fb",
"score": "0.45703864",
"text": "def boost\n @shape.body.apply_force((@shape.body.a.radians_to_vec2 * (10000.0)), CP::Vec2.new(0.0, 0.0))\n end",
"title": ""
},
{
"docid": "eee3498535a4cbc40667bec06ff799b4",
"score": "0.45659876",
"text": "def apply\n\t\t@entity[:physics].shape.resize!(\n\t\t\t@grab_handle, :world_space, point:@point, lock_aspect:true,\n\t\t\tminimum_dimension:MINIMUM_DIMENSION\n\t\t)\n\tend",
"title": ""
},
{
"docid": "09deda620a7c4edf961be73b0db4f457",
"score": "0.45613125",
"text": "def get_objects_in_fov(objects)\n in_fov = []\n objects.each do |object|\n next if object == self\n next if (object.position - @position).r > EYESIGHT\n angle_of_velocity = Math.atan2(-@velocity[1], @velocity[0])\n angle_to_other = Math.atan2(-(object.position[1] - @position[1]),\n object.position[0] - @position[0])\n next if (angle_to_other - angle_of_velocity).abs > AOV\n in_fov << object\n end\n in_fov\n end",
"title": ""
},
{
"docid": "44ba1b6d06c5a9c494db1180fb99e5b7",
"score": "0.454555",
"text": "def apply\n\t\t@entity[:physics].shape.resize!(\n\t\t\t@grab_handle, :world_space, point:@point, lock_aspect:false,\n\t\t\tminimum_dimension:MINIMUM_DIMENSION\n\t\t)\n\tend",
"title": ""
},
{
"docid": "2543e980c068f3baaa73c2c8ce27be1c",
"score": "0.4539728",
"text": "def update args\n @center.x += @velocity.x\n @center.y += @velocity.y\n @velocity.y += GRAVITY\n\n alpha = 0.2\n if @center.y-@radius <= 0\n @velocity.y = (@velocity.y.abs*0.7).abs\n @velocity.x = (@velocity.x.abs*0.9).abs * ((@velocity.x < 0) ? -1 : 1)\n\n if @velocity.y.abs() < alpha\n @velocity.y=0\n end\n if @velocity.x.abs() < alpha\n @velocity.x=0\n end\n end\n\n if @center.x > args.grid.right+@radius*2\n @center.x = 0-@radius\n elsif @center.x< 0-@radius*2\n @center.x = args.grid.right + @radius\n end\n end",
"title": ""
},
{
"docid": "b6e13c49971fd534ec297b2f633e3cb5",
"score": "0.45388538",
"text": "def collisions\n\t# check to see if any PTorpedos have hit an asteroid\n\tasteroids = Array.new\n\[email protected] { |go| asteroids.push(go) if go.kind_of? Asteroid }\n\t\n\ttorpedos = Array.new\n\[email protected] { |go| torpedos.push(go) if go.kind_of? PTorpedo }\n\t\n\tasteroids.each do |asteroid|\n\t\ttorpedos.each do |torpedo|\n\t\t\t# Check the distance between each\n\t\t\tdistance = Math.sqrt((asteroid.xCenter - torpedo.xCenter)**2 + (asteroid.yCenter - torpedo.yCenter)**2)\n\t\t\t\n\t\t\t# Delete the torpedo and asteroid if they collide\n\t\t\t# We don't need to test the torpedo radius because its so small (poor torpedo)\n\t\t\tif distance < asteroid.radius\n\t\t\t\[email protected](torpedo)\n\t\t\t\[email protected](asteroid)\n\t\t\t\t\n\t\t\t\t# split larger asteroids into smaller ones upon collision with a torpedo\n\t\t\t\tif asteroid.class == LargeAsteroid\n\t\t\t\t\[email protected](MediumAsteroid.new(asteroid.xCenter, asteroid.yCenter, asteroid.xDelta, -asteroid.yDelta, self))\n\t\t\t\t\[email protected](MediumAsteroid.new(asteroid.xCenter, asteroid.yCenter, -asteroid.xDelta, asteroid.yDelta, self))\n\t\t\t\telsif asteroid.class == MediumAsteroid\n\t\t\t\t\[email protected](SmallAsteroid.new(asteroid.xCenter, asteroid.yCenter, asteroid.xDelta, -asteroid.yDelta, self))\n\t\t\t\t\[email protected](SmallAsteroid.new(asteroid.xCenter, asteroid.yCenter, -asteroid.xDelta, asteroid.yDelta, self))\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t@score += 100\n\t\t\tend\n\t\tend\n\t\t\n\t\t# player loses a life if they collided with an asteroid\n\t\tdistance = Math.sqrt((asteroid.xCenter - @ship.xCenter)**2 + (asteroid.yCenter - @ship.yCenter)**2)\n\t\tif distance < asteroid.radius or distance < @ship.radius\n\t\t\[email protected](asteroid)\n\t\t\[email protected](@ship)\n\t\t\t\n\t\t\t# Create a new ship\n\t\t\t@ship = Ship.new(self)\n\t\t\[email protected] = Time.now\n\t\t\[email protected](@ship)\n\t\t\t\n\t\t\t# Remove a life\n\t\t\[email protected](@lives[-1])\n\t\t\[email protected]!(-1) \n\t\tend\n\tend\n end",
"title": ""
},
{
"docid": "8d1c3114f446f0ac57f63c9988a99645",
"score": "0.45342207",
"text": "def act(environment, elapsed_time:)\n environment.objects.each do |object|\n #Push on object.\n object.vector += Vector.new(@vector.speed * elapsed_time, @vector.pitch)\n end\n end",
"title": ""
},
{
"docid": "131942927cd7e4ec914b2ca4b5eeb123",
"score": "0.45295852",
"text": "def update\n ## $window.caption = \"The Eternally Grey. game objects: #{game_objects.size} - fps #{$window.fps} - seconds: #{game_state_age}\"\n @cursor.x = $window.mouse_x\n @cursor.y = $window.mouse_y\n \n # Increases 1 each 10 second\n value = (game_state_age / 10).to_i \n #if game_objects_of_class(Miner).size < 20\n if Miner.size < 20\n spawn_miner if (game_state_age > 20) && rand(7 * (60-value)) == 0\n end\n \n #if game_objects_of_class(Machine).size < 6\n if Machine.size < 20\n spawn_machine if (game_state_age > 120) && rand(7 * (120-value)) == 0\n end\n\n #if game_objects_of_class(Stalactite).size < 5\n if Stalactite.size < 5\n spawn_stalactite if rand(100) == 0\n #elsif game_objects_of_class(Stalactite).size < 10\n elsif Stalactite.size < 10 \n spawn_stalactite if rand(200) == 0\n #elsif game_objects_of_class(Stalactite).size < 20\n elsif Stalactite.size < 20\n spawn_stalactite if rand(300) == 0\n end\n\n\n game_objects.select { |o| o.outside_window? && o.is_a?(Gemstone) }.each do |gemstone|\n @riches -= gemstone.score\n CavernText.create(\"They stole my beautiful child, #{gemstone.type}. I raised her for #{gemstone.score} years.\")\n @riches_rect.width = @riches\n push_game_state(GameOver.new(:score => @score)) if @riches <= 0\n end\n \n game_objects.destroy_if { |o| (o.outside_window? || o.color.alpha == 0) && o.class != Cursor }\n \n fill_gradient(:from => @dark_gold, :to => @light_gold, :rect => @riches_rect, :zorder => 999)\n @riches_text.text = \"Riches: #{@riches}\"\n @score_text.text = \"Score: #{@score}\"\n \n game_objects_of_class(Miner).select {|miner| miner.status != :dead}.each do |miner|\n game_objects_of_class(Gemstone).select { |gemstone| gemstone.status != :attached }.each do |gemstone|\n if miner.rect.collide_rect?(gemstone.rect)\n miner.attach(gemstone)\n CavernText.create(\"They're stealing my loved ones!\") if @first_gem\n @first_gem = false\n end\n end\n end\n \n #\n # Go through all stalactites\n #\n game_objects_of_class(Stalactite).each do |stalactite|\n # Grow all rocks slowly\n stalactite.grow if stalactite.status == :default && rand(100) == 0\n \n # Rocks hitting the floor\n if (stalactite.y + stalactite.height) > @floor_y && stalactite.y < @floor_y\n Sample[\"deep_explosion.wav\"].play(0.2) unless stalactite.status != :dead\n stalactite.status = :dead\n spawn_smoke(stalactite.rect.centerx, @floor_y, stalactite.power/500)\n stalactite.x += 4 - rand(8)\n end\n \n # Rocks hitting miners and vehicles\n game_objects.select { |o| (o.is_a?(Miner) || o.is_a?(Machine)) }.each do |enemy|\n if stalactite.rect.collide_rect?(enemy.rect)\n \n @score += [stalactite.power, enemy.energy].min if enemy.status != :dead\n enemy.hit_by(stalactite.power)\n 2.times { spawn_smoke(stalactite.rect.centerx, @floor_y - enemy.rect.height, stalactite.power/800) }\n enemy.rect.y = @floor_y\n Sample[\"explosion.wav\"].play(0.5)\n \n #game_objects.delete(stalactite)\n stalactite.destroy!\n end\n end\n end\n \n super\n end",
"title": ""
},
{
"docid": "725983097827daaed61328445e175fc3",
"score": "0.45117044",
"text": "def gravitySliderChanged\n value = @gravitySlider.value.to_f + 0.5\n @gravity_label_view.text = value.to_i.to_s\n @gravitySlider.setValue(value.to_i, animated:false)\n\n @scene.gravityY = @gravitySlider.value.to_i * -1.0\n @delegate.setGravity(@gravitySlider.value.to_i * -1.0)\n\n @scene.gravityX = @windSlider.value.to_i\n @delegate.setWind(@windSlider.value.to_i)\n end",
"title": ""
},
{
"docid": "fc2c22f30e1f9181c1a3d543fb2243e1",
"score": "0.45081687",
"text": "def alignment(boids)\r\n perceived_velocity = Vector.zero(dimension)\r\n boids.each do |b|\r\n if b != self\r\n perceived_velocity.add(b.velocity)\r\n end\r\n end\r\n perceived_velocity.div(boids.length - 1).sub(@velocity)\r\n end",
"title": ""
},
{
"docid": "124675ee0f5a46ffa585003466af9d59",
"score": "0.45057905",
"text": "def applyGravity(column)\n\t\t\t0.upto(HEIGHT-2) do |row|\t\t\t\t\n\t\t\t\tif ( @play_area[row+1][column].nil? )\n\t\t\t\t\t@play_area[row+1][column] = @play_area[row][column]\n\t\t\t\t\t@play_area[row][column] = nil\n\t\t\t\tend\t\t\t\t\t\n\t\t\tend\t\n\t\tend",
"title": ""
},
{
"docid": "c5c5ecbc390973fe07b0942f6179dec3",
"score": "0.4501086",
"text": "def move()\r\n # movement in a gravitational system\r\n # a = 1/2 * g * t^2\r\n # y(t) = y0 + v0t + a\r\n\r\n #update position\r\n dt = Time.now - @last_update\r\n a = (@@gravity * dt**2) /2\r\n @position.z += @vector.z * dt + a\r\n @position.x += dt * @vector.x\r\n @position.y += dt * @vector.y\r\n \r\n # update velocity\r\n @vector.z += @@gravity * dt\r\n @last_update = Time.now\r\n\r\n # did we pass through the zero plane\r\n if @vector.z < 0 && (@position.z - @@radius) < 0\r\n # flip the Z set_value\r\n @vector.z = [email protected] * @@damping\r\n end\r\n end",
"title": ""
}
] |
48577e9a97f6efcdf12487d5dcbd0228
|
Use existing for multiple nondestructive actions
|
[
{
"docid": "0fc4cfc607418d034847402fdf178a5d",
"score": "0.0",
"text": "def existing(field)\n case field\n when :org then 'rspec-api'\n when :user then 'rspecapi'\n when :owner then 'rspecapi'\n when :assignee then 'rspecapi'\n when :repo then 'guinea-pig' # has heads, tails, pull, notes\n when :empty_repo then 'rspec-core' # does not have notifications heads, tails, pull, notes\n when :starred_repo then 'rspec-expectations'\n when :unstarred_repo then 'rspec-core'\n when :subscribed_repo then 'guinea-pig'\n when :unsubscribed_repo then 'jbuilder'\n when :subscribed_thread_id then '20946477'\n when :unsubscribed_thread_id then '20410951'\n when :gist_id then '7175672'\n when :gist_comment_id then '937901'\n when :starred_gist_id then 'e202e2fb143c54e5139a'\n when :unstarred_gist_id then '8f2ef7e69ab79084d833'\n when :someone_elses_gist_id then '4685e0bebbf05370abd6'\n when :blob_sha then 'f32932f7c927d86f57f56d703ac2ed100ceb0e47'\n when :commit_sha then 'c98a37ea3b2759d0c43fb8abfa9abd3146938790'\n when :tree_sha then 'ebca91692290192f50acc307af9fe26b2eab4274'\n when :ref then 'heads/master'\n when :gitignore_template then 'C'\n end\nend",
"title": ""
}
] |
[
{
"docid": "6b2989c0ec29165b94162baedf060ea3",
"score": "0.5935099",
"text": "def ignore_actions(actions); end",
"title": ""
},
{
"docid": "6b2989c0ec29165b94162baedf060ea3",
"score": "0.5935099",
"text": "def ignore_actions(actions); end",
"title": ""
},
{
"docid": "caf64870064f1a0f70f9fe54a44ca998",
"score": "0.59259146",
"text": "def cancel_actions!\n actions.incomplete.update_all(completed: true)\n end",
"title": ""
},
{
"docid": "221a4e33d5b559175ba6284feef037ad",
"score": "0.5845163",
"text": "def exclusive; end",
"title": ""
},
{
"docid": "221a4e33d5b559175ba6284feef037ad",
"score": "0.5845163",
"text": "def exclusive; end",
"title": ""
},
{
"docid": "aa50eb934ba71ff6354c066ddbea312d",
"score": "0.5838002",
"text": "def clean\n @actions = []\n end",
"title": ""
},
{
"docid": "5b5c6d9b8c697d0d09cb2f597df1a6ff",
"score": "0.57906884",
"text": "def ok_actions_to_remove\n @aws.ok_actions - local_actions(\"ok\")\n end",
"title": ""
},
{
"docid": "845ebf6b1ca6bb5bf145947626413c55",
"score": "0.5780814",
"text": "def skip_for_it_action\n current_action = params[:action]\n current_action == 'new' || current_action == 'edit' || current_action == 'create'\n end",
"title": ""
},
{
"docid": "39a244de8bdee4fdf3269675b1f2e579",
"score": "0.5778756",
"text": "def fused_actions\n (@fused_actions ||= {})\n end",
"title": ""
},
{
"docid": "837ab9dc1ce4382da97deb8d18d69687",
"score": "0.5669996",
"text": "def skip_deletion; end",
"title": ""
},
{
"docid": "3122364ef4f3de9b575792b2bc2f44af",
"score": "0.5666498",
"text": "def clear_actions; end",
"title": ""
},
{
"docid": "f9d20c82497004cf0756d0188945b106",
"score": "0.5633311",
"text": "def no_actions?; end",
"title": ""
},
{
"docid": "e909d6b3791fc638b48b4e911625016a",
"score": "0.5619553",
"text": "def existing!; end",
"title": ""
},
{
"docid": "e1e985952dc8447edd02e204c750356b",
"score": "0.55624914",
"text": "def clear_all_actions; end",
"title": ""
},
{
"docid": "874ca519ae7e7d5fef3cdf7e9ddfebd5",
"score": "0.5549971",
"text": "def delete(action, **args); end",
"title": ""
},
{
"docid": "ce9ccef73eee82103a12a0c868919e32",
"score": "0.55486935",
"text": "def insufficient_actions_to_remove\n @aws.insufficient_data_actions - local_actions(\"insufficient-data\")\n end",
"title": ""
},
{
"docid": "b8fe3729706d0af17a71dc0626ee3a36",
"score": "0.55272764",
"text": "def discard!\n update!(discarded: true)\n end",
"title": ""
},
{
"docid": "0af358b6d0ea8393a32ac637925526d7",
"score": "0.55215204",
"text": "def deletable?; end",
"title": ""
},
{
"docid": "5a65bc1213217f1a4d9c42dc1dea5997",
"score": "0.5506779",
"text": "def delete_operations; end",
"title": ""
},
{
"docid": "a90938ac26cc094f72ce8f08f528b817",
"score": "0.547455",
"text": "def actions *args\n options = args.extract_options!\n keys = []\n if options.has_key?(:only)\n keys = options.delete(:only)\n else\n if args.reject!{|a| a == :all}\n keys = Railgun::Resource::DEFAULT_ACTIONS.clone\n elsif args.any?\n keys = args\n end\n\n if options.has_key?(:except)\n except = options.delete(:except)\n keys.reject!{|a| except.include? a }\n end\n\n keys.each do |key|\n railgun_resource.actions.reject!{|a| !keys.include?(a.key) }\n railgun_resource.action key, :default, options\n end\n\n unless keys.include?(:destroy)\n railgun_resource.batch_actions.reject!{|b| b.key == :batch_delete }\n end\n end\n # Need to undef methods\n end",
"title": ""
},
{
"docid": "ef9cb62baeb1b70658add22fcb93c991",
"score": "0.5473108",
"text": "def clear\n @actions = {}\n end",
"title": ""
},
{
"docid": "5b6d613e86d3d68152f7fa047d38dabb",
"score": "0.5464079",
"text": "def release_actions; end",
"title": ""
},
{
"docid": "4bd589567e98b1b5d2c9049ee175a66f",
"score": "0.54513586",
"text": "def bulk_action_method \n unless @checked_ids.blank?\n @checked_ids.each do |checked_id|\n checked_record = @model.find(checked_id) \n case @action_name\n when \"Delete\"\n checked_record.update_attribute(:archive, \"true\") \n if @model.to_s == \"Organisation\" \n checked_record.users.first.update_attributes(:disabled => \"true\", :archive => \"true\") unless checked_record.users.blank?\n end\n when \"Enable\"\n checked_record.update_attribute(:disabled, \"false\")\n when \"Disable\"\n checked_record.update_attribute(:disabled, \"true\")\n end \n end\n end \n end",
"title": ""
},
{
"docid": "0e02f83784c17c376ac60c44d26d2ebb",
"score": "0.5434677",
"text": "def existing; end",
"title": ""
},
{
"docid": "f0bdc6e651c59739d20d9cfeb0a3fd5d",
"score": "0.53646994",
"text": "def exclusive_hook; end",
"title": ""
},
{
"docid": "e790f9b871f55339257d8b7924908456",
"score": "0.5358624",
"text": "def remove!; end",
"title": ""
},
{
"docid": "6a88a653aef616e5fa9d0086089d61a1",
"score": "0.5355564",
"text": "def unsupported(opts={})\n before :_remove_action_, opts\n end",
"title": ""
},
{
"docid": "97c0908cf9198c9fda2396f7d36d9cdd",
"score": "0.5347156",
"text": "def combine(_newer)\n destroy\n true\n end",
"title": ""
},
{
"docid": "9934f5d984462c4df220f0ee9f3dc387",
"score": "0.53253925",
"text": "def discard\n end",
"title": ""
},
{
"docid": "0bdb0c092bfe5d9b665b7e46b885ef00",
"score": "0.5280108",
"text": "def dummy_action(*_); end",
"title": ""
},
{
"docid": "432a772c6502878f50c8039955347de1",
"score": "0.52744937",
"text": "def discard; end",
"title": ""
},
{
"docid": "432a772c6502878f50c8039955347de1",
"score": "0.52744937",
"text": "def discard; end",
"title": ""
},
{
"docid": "432a772c6502878f50c8039955347de1",
"score": "0.52744937",
"text": "def discard; end",
"title": ""
},
{
"docid": "f0454a60c0707c50f12162542958a106",
"score": "0.5271748",
"text": "def applyAction\n return false\n end",
"title": ""
},
{
"docid": "0eae3e3a23439abe8bd909a88aad8a82",
"score": "0.52706754",
"text": "def action_recreate\n action_delete\n action_create\n end",
"title": ""
},
{
"docid": "01e548735ad04b1b0ed9e1f3556fe52e",
"score": "0.52661145",
"text": "def except(*actions)\n @options[:except] = actions\n end",
"title": ""
},
{
"docid": "01e548735ad04b1b0ed9e1f3556fe52e",
"score": "0.52661145",
"text": "def except(*actions)\n @options[:except] = actions\n end",
"title": ""
},
{
"docid": "cccb3ff4583eb119dd980f241597e556",
"score": "0.5262873",
"text": "def exclude_actions(*action_names, &block)\n block ||= proc { |a| action_names.include?(a.name) }\n _actions.each { |a| a.defined = true } if _actions.select(&:defined).empty?\n _actions.select { |a| a.instance_eval(&block) }.each { |a| a.defined = false }\n end",
"title": ""
},
{
"docid": "acc2a0b17e05a2d98699a7c4e524692b",
"score": "0.5254255",
"text": "def inverse_affected_stids\n raise \"Implement me!\"\n end",
"title": ""
},
{
"docid": "ed802f47eb3b7b1ce3345d49bc309e3f",
"score": "0.5238654",
"text": "def forbid(_action)\n # TODO\n end",
"title": ""
},
{
"docid": "6598d32baa3ef6d5c66e79ea5f5615eb",
"score": "0.52374566",
"text": "def migrate_db_actions_in_mem(data)\n original_actions = data.actions.map(&:to_h)\n\n begin\n actions, repairs = attempt_repair(original_actions) do\n Engine::Game.load(data, actions: []).maybe_raise!\n end\n puts repairs\n return actions || original_actions\n rescue Exception => e\n puts 'Something went wrong', e\n #raise e\n\n end\n return original_actions\nend",
"title": ""
},
{
"docid": "a5776cfc1508a3094151afc9c9c8ed9d",
"score": "0.5237065",
"text": "def upate_permissible_actions\n if can_have_permissions_updated\n if no_permissions_granted\n purge_granted_permissions\n else\n granted_actions = []\n permissible_actions.each_pair do |class_name, action_names|\n action_names.each do |action|\n target = Action.find_by_class_and_action_name(class_name.camelize, action)\n target ? granted_actions << target.first : false\n end\n end\n self.actions = granted_actions\n end\n end\n end",
"title": ""
},
{
"docid": "6d95842e130e669e5f629999401b81be",
"score": "0.5236633",
"text": "def check_conflict_actions\n i = @actions.length - 1\n @conflict_actions = []\n while i > 0\n if @actions[i].begin_pos <= @actions[i - 1].end_pos\n @conflict_actions << @actions.delete_at(i)\n end\n i -= 1\n end\n @conflict_actions\n end",
"title": ""
},
{
"docid": "cc83fc2d757af3e9d62764ebd228193c",
"score": "0.52349526",
"text": "def overwrite\n gather_active\n end",
"title": ""
},
{
"docid": "23bf8ce409ce88b27e4c3d217ae23981",
"score": "0.5233862",
"text": "def except(*actions)\n @options[:except] = actions\n @options[:except_block] = proc if block_given?\n end",
"title": ""
},
{
"docid": "928d16af40144bee7dda94caf4be3d8d",
"score": "0.5230781",
"text": "def removed; end",
"title": ""
},
{
"docid": "cf469d015840667eee18366c7bb6ab08",
"score": "0.5230483",
"text": "def remove; end",
"title": ""
},
{
"docid": "cf469d015840667eee18366c7bb6ab08",
"score": "0.5230483",
"text": "def remove; end",
"title": ""
},
{
"docid": "cf469d015840667eee18366c7bb6ab08",
"score": "0.5230483",
"text": "def remove; end",
"title": ""
},
{
"docid": "cf469d015840667eee18366c7bb6ab08",
"score": "0.5230483",
"text": "def remove; end",
"title": ""
},
{
"docid": "cf469d015840667eee18366c7bb6ab08",
"score": "0.5230483",
"text": "def remove; end",
"title": ""
},
{
"docid": "bc55605814599dc64d6e99efb0a73864",
"score": "0.5229277",
"text": "def action_is_not(*_actions)\n !_actions.any? { |a| a.to_s == @ctx.action_name }\n end",
"title": ""
},
{
"docid": "af8e5d5601161d29b23f91caf587b8ae",
"score": "0.5216015",
"text": "def discard!; end",
"title": ""
},
{
"docid": "af8e5d5601161d29b23f91caf587b8ae",
"score": "0.5216015",
"text": "def discard!; end",
"title": ""
},
{
"docid": "d9df2aa65c906f5b33070d934e7ba4b2",
"score": "0.52153105",
"text": "def action(instance) #:nodoc:\n return if instance.skip?\n if behaviour == :invoke\n instance.invoke!\n else\n instance.revoke!\n end\n end",
"title": ""
},
{
"docid": "eb4945fbdeba86326f4cff1603022d98",
"score": "0.5212127",
"text": "def perform\n @driver.multi_touch @actions\n @actions.clear\n end",
"title": ""
},
{
"docid": "df77958ef33deaae6d492cfb47f0fa7f",
"score": "0.520666",
"text": "def action_disable\n notifying_block do\n monit_config new_resource.name do\n action :delete\n parent new_resource.parent\n end\n end\n end",
"title": ""
},
{
"docid": "5f7a0e04f0580ca0da1c4ec2cad66235",
"score": "0.5206131",
"text": "def clear_action_results\n @skipped = false\n @missed = false\n @evaded = false\n @critical = false\n @absorbed = false\n @hp_damage = 0\n @mp_damage = 0\n @added_states = [] # Added states (ID array)\n @removed_states = [] # Removed states (ID array)\n @remained_states = [] # Unchanged states (ID array)\n end",
"title": ""
},
{
"docid": "04701f3d198f557cb885bd49841ab39c",
"score": "0.5205258",
"text": "def take_action \r\n clear_return(send(@action.gsub(/\\s/, '_')))\r\n end",
"title": ""
},
{
"docid": "4f0c23898b60d0805cb8e5542b951fdd",
"score": "0.52047783",
"text": "def destroy\r\n not_acceptable\r\n end",
"title": ""
},
{
"docid": "b02ed6f419c1100d24316426eaac406c",
"score": "0.5197597",
"text": "def existing(*args, &block); end",
"title": ""
},
{
"docid": "2bdffb8ac2518e92adeba3c64b1b9a40",
"score": "0.5195784",
"text": "def process_action(action, *args)\n Collector.reset_runtime\n super\n end",
"title": ""
},
{
"docid": "e7383e5c146a1e11af9f763e97c571a0",
"score": "0.5195105",
"text": "def removed!; end",
"title": ""
},
{
"docid": "b9e539b7ab2485effd500cd68757c8a4",
"score": "0.5189913",
"text": "def cleanup\n\t\t# each action cleans it's own state as it is ejected automatically from the stash\n\tend",
"title": ""
},
{
"docid": "f51c2a3dd08a0a59d07ecef18fba314a",
"score": "0.51875585",
"text": "def skip_preload\n ([:index, :update_positions] << (not_loadable_actions || [])).flatten.map(&:to_sym)\n end",
"title": ""
},
{
"docid": "36b960699a465eead42eac6e263957de",
"score": "0.5169776",
"text": "def sharded?; false; end",
"title": ""
},
{
"docid": "36b960699a465eead42eac6e263957de",
"score": "0.5169776",
"text": "def sharded?; false; end",
"title": ""
},
{
"docid": "dc5f03dc9a763656117008f815df50a1",
"score": "0.5169258",
"text": "def prohibit_destroy; false; end",
"title": ""
},
{
"docid": "f25e5376713431cb2f4d812450fc4eef",
"score": "0.51655215",
"text": "def pass!\n super\n @round.pass_order.clear if @round.current_actions.any?\n end",
"title": ""
},
{
"docid": "858ffc1dee81aa62d0dcb077b0b68ec9",
"score": "0.5161651",
"text": "def bulk_new\n __log_activity\n __debug_route\n wf_bulk(rec: :unset, data: :unset, event: :create)\n rescue => error\n failure_status(error)\n end",
"title": ""
},
{
"docid": "2acf0c628545344c5359828656dbda83",
"score": "0.5160711",
"text": "def delete_forward; end",
"title": ""
},
{
"docid": "30bcc71c9f0104ae5dd763d0ceb76ea7",
"score": "0.5160387",
"text": "def unset; end",
"title": ""
},
{
"docid": "f6669919cb0dc683c8307231e191a9cc",
"score": "0.51599926",
"text": "def clear_actions\n @actions.clone.each {|action| self.remove_action(action)}\n end",
"title": ""
},
{
"docid": "201fadd6806cc3fcf98d56705336e5da",
"score": "0.5156926",
"text": "def clear!\n @performed = false\n end",
"title": ""
},
{
"docid": "201fadd6806cc3fcf98d56705336e5da",
"score": "0.5156926",
"text": "def clear!\n @performed = false\n end",
"title": ""
},
{
"docid": "4a305e300ec38fb553ddb9217dae6ddd",
"score": "0.5154359",
"text": "def valid_action?(name, resource = resource_class)\n %w[new edit destroy].exclude?(name.to_s) && super\n end",
"title": ""
},
{
"docid": "04dff28b61b66548621e4176d285decb",
"score": "0.51476616",
"text": "def attempted_action; end",
"title": ""
},
{
"docid": "a4184043a638571ded782a2c315a70c9",
"score": "0.51463073",
"text": "def action(arg = nil)\n @allowed_actions = %i( create delete ) if drop_in\n super\n end",
"title": ""
},
{
"docid": "8f6666b55682ea5161b39d8ef4b5f3a3",
"score": "0.51450783",
"text": "def remove_after_ingest_enrichment_action_registration\n repository.unregister_action_taken_on_entity_by_anyone(entity: work, action: 'update_file', requested_by: requested_by)\n end",
"title": ""
},
{
"docid": "312c2c21362c0832e054302a35b4ae03",
"score": "0.5141468",
"text": "def delete(*)\n unavailable_method\n end",
"title": ""
},
{
"docid": "312c2c21362c0832e054302a35b4ae03",
"score": "0.5141468",
"text": "def delete(*)\n unavailable_method\n end",
"title": ""
},
{
"docid": "312c2c21362c0832e054302a35b4ae03",
"score": "0.5141468",
"text": "def delete(*)\n unavailable_method\n end",
"title": ""
},
{
"docid": "312c2c21362c0832e054302a35b4ae03",
"score": "0.5141468",
"text": "def delete(*)\n unavailable_method\n end",
"title": ""
},
{
"docid": "07cba50120154d3e45ab30f7dfa6adec",
"score": "0.51371443",
"text": "def action(*args)\n if args == [ :delete ]\n super(:destroy)\n else\n super\n end\n end",
"title": ""
},
{
"docid": "23bb43018eb7cff4062965333077fd84",
"score": "0.51369095",
"text": "def remove_from_the_system_anyway\n\n end",
"title": ""
},
{
"docid": "c748e22d628797cef312b1bc7e9225ae",
"score": "0.51356035",
"text": "def resource_bypassed(resource, action, current_resource); end",
"title": ""
},
{
"docid": "cb24806a1217c1c391a9cdcd6a541554",
"score": "0.51326364",
"text": "def action_disable\n # TODO\n end",
"title": ""
},
{
"docid": "b326784d149de52f29c2776622958aed",
"score": "0.5131158",
"text": "def fallback_action(*args); end",
"title": ""
},
{
"docid": "636cda8bcdb1f013385fb7a85d3e9f21",
"score": "0.51294386",
"text": "def valid_action?(name, resource = resource_class)\n %w[new edit destroy].exclude?(name.to_s) && super\n end",
"title": ""
},
{
"docid": "c026f8f4a5e4b219813bd51eac7323b1",
"score": "0.5126594",
"text": "def update!(**args)\n @already_consumed = args[:already_consumed] if args.key?(:already_consumed)\n end",
"title": ""
},
{
"docid": "2b8edda29b7b3177d821dbad7a896abf",
"score": "0.512254",
"text": "def delete?; end",
"title": ""
},
{
"docid": "2b8edda29b7b3177d821dbad7a896abf",
"score": "0.512254",
"text": "def delete?; end",
"title": ""
},
{
"docid": "2b8edda29b7b3177d821dbad7a896abf",
"score": "0.512254",
"text": "def delete?; end",
"title": ""
},
{
"docid": "55ce4484640c506393c9405f6d4f5e95",
"score": "0.51206875",
"text": "def cancel_changes!(**opt)\n Log.info { \"#{__method__}: undeleting: #{inspect}\" } if deleting\n opt[:deleting] = false unless opt.key?(:deleting) if deleting\n opt[:editing] = false unless opt.key?(:editing) if editing\n opt[:backup] = nil unless opt.key?(:backup) if backup\n opt = backup.symbolize_keys.merge!(opt) if backup\n update!(opt)\n self\n end",
"title": ""
},
{
"docid": "7ecd7751086d2e1c9f415b748e318d9b",
"score": "0.5117288",
"text": "def remove!()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "7ecd7751086d2e1c9f415b748e318d9b",
"score": "0.5117288",
"text": "def remove!()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "a27883054013b77e811c6ae38c494847",
"score": "0.5111048",
"text": "def merge(action); end",
"title": ""
},
{
"docid": "531e4b2fb16c69f2925490902759d264",
"score": "0.5097679",
"text": "def action_delete\n domains_stop\n domains_delete\n volumes_delete\n end",
"title": ""
},
{
"docid": "65c1c8deb68e4ef06d2226c260523bb9",
"score": "0.50959426",
"text": "def delete(target); end",
"title": ""
},
{
"docid": "e6b28d5a7046f51b3fda9de678b00f83",
"score": "0.50930554",
"text": "def delete(*)\n unavailable_method\n end",
"title": ""
},
{
"docid": "e6b28d5a7046f51b3fda9de678b00f83",
"score": "0.50930554",
"text": "def delete(*)\n unavailable_method\n end",
"title": ""
}
] |
f74c29bdfc4a183e1ec1b91334cd5be2
|
Use callbacks to share common setup or constraints between actions.
|
[
{
"docid": "9d882719ca03a446a9ce00a32d045b76",
"score": "0.0",
"text": "def set_page\n @page = Page.find(params[:id])\n end",
"title": ""
}
] |
[
{
"docid": "bd89022716e537628dd314fd23858181",
"score": "0.6163163",
"text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"title": ""
},
{
"docid": "3db61e749c16d53a52f73ba0492108e9",
"score": "0.6045976",
"text": "def action_hook; end",
"title": ""
},
{
"docid": "b8b36fc1cfde36f9053fe0ab68d70e5b",
"score": "0.5946146",
"text": "def run_actions; end",
"title": ""
},
{
"docid": "3e521dbc644eda8f6b2574409e10a4f8",
"score": "0.591683",
"text": "def define_action_hook; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.5890051",
"text": "def actions; end",
"title": ""
},
{
"docid": "bfb8386ef5554bfa3a1c00fa4e20652f",
"score": "0.58349305",
"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.5776858",
"text": "def add_actions; end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.5703237",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.5703237",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "6ce8a8e8407572b4509bb78db9bf8450",
"score": "0.5652805",
"text": "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"title": ""
},
{
"docid": "1964d48e8493eb37800b3353d25c0e57",
"score": "0.5621621",
"text": "def define_action_helpers; end",
"title": ""
},
{
"docid": "5df9f7ffd2cb4f23dd74aada87ad1882",
"score": "0.54210985",
"text": "def post_setup\n end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411113",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5391541",
"text": "def before_setup; 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": "0464870c8688619d6c104d733d355b3b",
"score": "0.53402257",
"text": "def define_action_helpers?; end",
"title": ""
},
{
"docid": "0e7bdc54b0742aba847fd259af1e9f9e",
"score": "0.53394014",
"text": "def set_actions\n actions :all\n end",
"title": ""
},
{
"docid": "5510330550e34a3fd68b7cee18da9524",
"score": "0.53321576",
"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.53124547",
"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.529654",
"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": "83684438c0a4d20b6ddd4560c7683115",
"score": "0.5296262",
"text": "def before_actions(*logic)\n self.before_actions = logic\n end",
"title": ""
},
{
"docid": "210e0392ceaad5fc0892f1335af7564b",
"score": "0.52952296",
"text": "def setup_handler\n end",
"title": ""
},
{
"docid": "a997ba805d12c5e7f7c4c286441fee18",
"score": "0.52600986",
"text": "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"title": ""
},
{
"docid": "1d50ec65c5bee536273da9d756a78d0d",
"score": "0.52442724",
"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.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52385926",
"text": "def action; end",
"title": ""
},
{
"docid": "635288ac8dd59f85def0b1984cdafba0",
"score": "0.5232394",
"text": "def workflow\n end",
"title": ""
},
{
"docid": "e34cc2a25e8f735ccb7ed8361091c83e",
"score": "0.523231",
"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": "78b21be2632f285b0d40b87a65b9df8c",
"score": "0.5227454",
"text": "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"title": ""
},
{
"docid": "6350959a62aa797b89a21eacb3200e75",
"score": "0.52226824",
"text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"title": ""
},
{
"docid": "923ee705f0e7572feb2c1dd3c154b97c",
"score": "0.52201617",
"text": "def process_action(...)\n send_action(...)\n end",
"title": ""
},
{
"docid": "b89a3908eaa7712bb5706478192b624d",
"score": "0.5212327",
"text": "def before_dispatch(env); end",
"title": ""
},
{
"docid": "7115b468ae54de462141d62fc06b4190",
"score": "0.52079266",
"text": "def after_actions(*logic)\n self.after_actions = logic\n end",
"title": ""
},
{
"docid": "d89a3e408ab56bf20bfff96c63a238dc",
"score": "0.52050185",
"text": "def setup\n # override and do something appropriate\n end",
"title": ""
},
{
"docid": "62c402f0ea2e892a10469bb6e077fbf2",
"score": "0.51754695",
"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.51726824",
"text": "def setup(_context)\n end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.51710224",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "1fd817f354d6cb0ff1886ca0a2b6cce4",
"score": "0.5166172",
"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.5159343",
"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.51578903",
"text": "def determine_valid_action\n\n end",
"title": ""
},
{
"docid": "b38f9d83c26fd04e46fe2c961022ff86",
"score": "0.51522785",
"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.5152022",
"text": "def startcompany(action)\n @done = true\n action.setup\n end",
"title": ""
},
{
"docid": "994d9fe4eb9e2fc503d45c919547a327",
"score": "0.51518047",
"text": "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"title": ""
},
{
"docid": "62fabe9dfa2ec2ff729b5a619afefcf0",
"score": "0.51456624",
"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.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": "adb8115fce9b2b4cb9efc508a11e5990",
"score": "0.5133759",
"text": "def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"title": ""
},
{
"docid": "e1dd18cf24d77434ec98d1e282420c84",
"score": "0.5112076",
"text": "def setup(&block)\n define_method(:setup, &block)\n end",
"title": ""
},
{
"docid": "3b4fb29fa45f95d436fd3a8987f12de7",
"score": "0.5111866",
"text": "def setup\n transition_to(:setup)\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": "f54964387b0ee805dbd5ad5c9a699016",
"score": "0.5106169",
"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.509231",
"text": "def config(action, *args); end",
"title": ""
},
{
"docid": "bc3cd61fa2e274f322b0b20e1a73acf8",
"score": "0.50873137",
"text": "def setup\n @setup_proc.call(self) if @setup_proc\n end",
"title": ""
},
{
"docid": "5c3cfcbb42097019c3ecd200acaf9e50",
"score": "0.5081088",
"text": "def before_action \n end",
"title": ""
},
{
"docid": "246840a409eb28800dc32d6f24cb1c5e",
"score": "0.508059",
"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.50677156",
"text": "def action\n end",
"title": ""
},
{
"docid": "36eb407a529f3fc2d8a54b5e7e9f3e50",
"score": "0.50562143",
"text": "def matt_custom_action_begin(label); end",
"title": ""
},
{
"docid": "b6c9787acd00c1b97aeb6e797a363364",
"score": "0.5050554",
"text": "def setup\n # override this if needed\n end",
"title": ""
},
{
"docid": "9fc229b5b48edba9a4842a503057d89a",
"score": "0.50474834",
"text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"title": ""
},
{
"docid": "9fc229b5b48edba9a4842a503057d89a",
"score": "0.50474834",
"text": "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"title": ""
},
{
"docid": "fd421350722a26f18a7aae4f5aa1fc59",
"score": "0.5036181",
"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.5026331",
"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.5022976",
"text": "def after(action)\n invoke_callbacks *options_for(action).after\n end",
"title": ""
},
{
"docid": "24506e3666fd6ff7c432e2c2c778d8d1",
"score": "0.5015441",
"text": "def pre_task\n end",
"title": ""
},
{
"docid": "0c16dc5c1875787dacf8dc3c0f871c53",
"score": "0.50121695",
"text": "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"title": ""
},
{
"docid": "c99a12c5761b742ccb9c51c0e99ca58a",
"score": "0.5000944",
"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.5000019",
"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.4996878",
"text": "def setup_signals; end",
"title": ""
},
{
"docid": "6e44984b54e36973a8d7530d51a17b90",
"score": "0.4989888",
"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.4989888",
"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.49864885",
"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.49797225",
"text": "def initialize(*args)\n super\n @action = :set\nend",
"title": ""
},
{
"docid": "67e7767ce756766f7c807b9eaa85b98a",
"score": "0.49785787",
"text": "def after_set_callback; end",
"title": ""
},
{
"docid": "2a2b0a113a73bf29d5eeeda0443796ec",
"score": "0.4976161",
"text": "def setup\n #implement in subclass;\n end",
"title": ""
},
{
"docid": "63e628f34f3ff34de8679fb7307c171c",
"score": "0.49683493",
"text": "def lookup_action; end",
"title": ""
},
{
"docid": "a5294693c12090c7b374cfa0cabbcf95",
"score": "0.4965126",
"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.4958034",
"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.49559742",
"text": "def release_actions; end",
"title": ""
},
{
"docid": "4aceccac5b1bcf7d22c049693b05f81c",
"score": "0.4954353",
"text": "def around_hooks; end",
"title": ""
},
{
"docid": "2318410efffb4fe5fcb97970a8700618",
"score": "0.49535993",
"text": "def save_action; end",
"title": ""
},
{
"docid": "64e0f1bb6561b13b482a3cc8c532cc37",
"score": "0.4952725",
"text": "def setup(easy)\n super\n easy.customrequest = @verb\n end",
"title": ""
},
{
"docid": "fbd0db2e787e754fdc383687a476d7ec",
"score": "0.49467874",
"text": "def action_target()\n \n end",
"title": ""
},
{
"docid": "b280d59db403306d7c0f575abb19a50f",
"score": "0.49423352",
"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.49325448",
"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.49282882",
"text": "def before_setup\n # do nothing by default\n end",
"title": ""
},
{
"docid": "17ffe00a5b6f44f2f2ce5623ac3a28cd",
"score": "0.49269363",
"text": "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"title": ""
},
{
"docid": "21d75f9f5765eb3eb36fcd6dc6dc2ec3",
"score": "0.49269104",
"text": "def default_action; end",
"title": ""
},
{
"docid": "3ba85f3cb794f951b05d5907f91bd8ad",
"score": "0.49252945",
"text": "def setup(&blk)\n @setup_block = blk\n end",
"title": ""
},
{
"docid": "80834fa3e08bdd7312fbc13c80f89d43",
"score": "0.4923091",
"text": "def callback_phase\n super\n end",
"title": ""
},
{
"docid": "f1da8d654daa2cd41cb51abc7ee7898f",
"score": "0.49194667",
"text": "def advice\n end",
"title": ""
},
{
"docid": "99a608ac5478592e9163d99652038e13",
"score": "0.49174926",
"text": "def _handle_action_missing(*args); end",
"title": ""
},
{
"docid": "9e264985e628b89f1f39d574fdd7b881",
"score": "0.49173003",
"text": "def duas1(action)\n action.call\n action.call\nend",
"title": ""
},
{
"docid": "399ad686f5f38385ff4783b91259dbd7",
"score": "0.49171105",
"text": "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"title": ""
},
{
"docid": "0dccebcb0ecbb1c4dcbdddd4fb11bd8a",
"score": "0.4915879",
"text": "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"title": ""
},
{
"docid": "6e0842ade69d031131bf72e9d2a8c389",
"score": "0.49155936",
"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": ""
}
] |
e42f860f8937c1d4c1bdd806f5c22bc4
|
Extract link info from URL
|
[
{
"docid": "b670343061d6b351f0abdfbeae95365f",
"score": "0.8568127",
"text": "def extract_link_info(url)\n link = url.scan /<[a|A]\\b[^>]*>(.*?)<\\/[a|A]>/\n (link[0] && link[0][0]) || url\n end",
"title": ""
}
] |
[
{
"docid": "1732ee493c62105bb0e8d1be763de79b",
"score": "0.7518928",
"text": "def extract_link_info link_obj\n # match all shortlinks and standard links to tiddlers, spaces and revisions\n # using named captures. Don't match links to lists of things.\n link_matcher = /^(?:(?:(?:(?:\\/u\\/(?<user_name>[^\\/\\?]+))\\/(?<space_name>[^\\/\\?]+)(?:\\/(?<tiddler_title>[^\\/\\?\\.]+))?)|(?:\\/s\\/(?<space_name>[^\\/\\?]+)(?:\\/(?<tiddler_title>[^\\/\\?\\.]+))?)|(?:\\/spaces\\/(?<space_id>[^\\/\\?]+)\\/t\\/(?<tiddler_title>[^\\/\\?\\.]+)))|(?:\\/spaces\\/(?<space_id>[^\\/\\?\\.]+)(?:\\/tiddlers\\/(?<tiddler_id>[^\\/\\?\\.]+)(?:\\/revisions\\/(?<target_id>[^\\/\\?\\.]+))?)?))/\n\n link = link_obj[:link]\n return link_obj unless local? link\n link = path(link)\n match = link_matcher.match(link)\n\n if match\n link_obj.clone.merge(\n tiddler_title: match[:tiddler_title],\n space_name: match[:space_name],\n user_name: match[:user_name],\n tiddler_id: match[:tiddler_id] && match[:tiddler_id].to_i,\n space_id: match[:space_id] && match[:space_id].to_i,\n target_id: match[:target_id] && match[:target_id].to_i\n )\n else\n link_obj.clone\n end\n end",
"title": ""
},
{
"docid": "b1f421cbb83c29c54716f8c8a4216618",
"score": "0.68739915",
"text": "def parse_link(link)\n return nil if link.nil?\n return nil if link.split('?').size > 1 # skip links with parameters\n while link.match('^\\(|^\\[') # remove leading '(', '[' \n link = link[1, (link.size-1)]\n end\n while link.match('\\)$|\\.$|\\\\$')\n link = link[0, (link.size-1)]\n end\n if link.match('^www')\n link = 'http://' + link\n end\n \n if link.match(\"^href|^HREF\")\n pieces = link.split('\"')\n pieces = link.split(\"'\") if pieces.size == 1\n link = pieces.collect!{ |p| p if p.match('http|www')}.compact.first\n end\n return link if link.match('^http')\n return nil\n end",
"title": ""
},
{
"docid": "16e229fbd53bc3352f42123ddf74f3d5",
"score": "0.6831488",
"text": "def get_info\n @url = params[:url]\n link_host = URI(@url)\n link_host.path = ''\n link_host.query = nil\n link_host = link_host.to_s\n\n begin\n # http://tinyurl.com/q7xkt2z\n uri = URI.parse(@url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.open_timeout = 5\n http.read_timeout = 5\n response = http.get(uri.path.empty? ? '/' : uri.path)\n doc = Nokogiri.parse(response.body)\n rescue => error\n raise error\n end\n\n @title = doc.css('title').text\n end",
"title": ""
},
{
"docid": "700cf43a7a233f29f4ebfc561389135f",
"score": "0.6830182",
"text": "def extract_link_fields(body)\n entry = true\n @inputs = {}\n doc = Nokogiri::HTML(body)\n doc.xpath(\"//a\").each do |f|\n return URI.parse( f.get_attribute('href') ).path if(f.get_attribute('name') == 'URL$1')\n end\n return nil\n end",
"title": ""
},
{
"docid": "962d50186151331803c7a3edaeeb1ba1",
"score": "0.681365",
"text": "def extract_url(element)\n element.attributes['href'].to_s\n end",
"title": ""
},
{
"docid": "2407a02652d6100bb9523ff1b017ffea",
"score": "0.68018025",
"text": "def get_hyperlink(result)\n result['url']\n end",
"title": ""
},
{
"docid": "bfba5d2cc6896b8fe881805538a82158",
"score": "0.6800068",
"text": "def parse_link(link)\n return nil if link.nil?\n return nil if link.split('?').size > 1 # skip links with parameters\n while link.match('^\\(|^\\[') # remove leading '(', '['\n link = link[1, (link.size-1)]\n end\n while link.match('\\)$|\\.$|\\\\$')\n link = link[0, (link.size-1)]\n end\n if link.match('^www')\n link = 'http://' + link\n end\n\n if link.match(\"^href|^HREF\")\n pieces = link.split('\"')\n pieces = link.split(\"'\") if pieces.size == 1\n link = pieces.collect!{ |p| p if p.match('http|www')}.compact.first\n end\n return link if link.match('^http')\n return nil\n end",
"title": ""
},
{
"docid": "b2cae3d353dc9a91702ce1f738448659",
"score": "0.6796814",
"text": "def extracted_url(url)\n url.split('://', 2)[1].chomp('/')\n end",
"title": ""
},
{
"docid": "db67a75c66f0ab5df6953c7f6f939d74",
"score": "0.67465746",
"text": "def extract_url(url)\n url = URI(url)\n extracted_url = url.scheme + '://' + url.host + url.path\n end",
"title": ""
},
{
"docid": "521dd2a8665e471f159d9988240dc673",
"score": "0.6709038",
"text": "def url\n link.href\n end",
"title": ""
},
{
"docid": "31f3d9c1e46f086950b5aa74692b83e6",
"score": "0.667693",
"text": "def extract_link(element)\n {\n href: element.attr['href'],\n text: extract_text(element.children.first)\n }\n end",
"title": ""
},
{
"docid": "f2dc20e3217e2242071d2f1719e378c1",
"score": "0.66453505",
"text": "def get_info_url(page, tds)\n return (page.uri + tds[0].at('a')['href']).to_s\nend",
"title": ""
},
{
"docid": "f2dc20e3217e2242071d2f1719e378c1",
"score": "0.66453505",
"text": "def get_info_url(page, tds)\n return (page.uri + tds[0].at('a')['href']).to_s\nend",
"title": ""
},
{
"docid": "f2dc20e3217e2242071d2f1719e378c1",
"score": "0.66453505",
"text": "def get_info_url(page, tds)\n return (page.uri + tds[0].at('a')['href']).to_s\nend",
"title": ""
},
{
"docid": "f2dc20e3217e2242071d2f1719e378c1",
"score": "0.66453505",
"text": "def get_info_url(page, tds)\n return (page.uri + tds[0].at('a')['href']).to_s\nend",
"title": ""
},
{
"docid": "861412bfd366e82dccbc8b7c78dd8511",
"score": "0.66443944",
"text": "def extract url\n page = fetch url\n\n Extractor.new(page).extract\n end",
"title": ""
},
{
"docid": "943f36463b9008425bbf6a85428babbd",
"score": "0.6638579",
"text": "def extract_url(s)\n s[/(https?|s?ftp):\\/\\/[\\w-]*(\\.[\\w-]*)+([\\w.,@?^=%&:\\/~+#-]*[\\w@?^=%&\\/~+#-])?/]\n end",
"title": ""
},
{
"docid": "28da2006df48bf735f45eba42a217051",
"score": "0.65774846",
"text": "def parse_url(link)\n uri = URI.parse(link['href'])\n row = []\n if uri.is_a?(URI::HTTP) && !uri.host.nil?\n unless uri.query.nil?\n params = CGI.parse(uri.query)\n url1 = URI.join(uri.scheme+\"://\"+uri.host+uri.path)\n row << url1.to_s\n params.keys.map { |param| row << param.to_s }\n \n write_to_spreadsheet(row)\n # Else write to a database. Due to time I am writing it to a file also I thought not to user rails here in this task.\n end\n end\n end",
"title": ""
},
{
"docid": "81809404361c7b4ab96422795ea6e566",
"score": "0.6522909",
"text": "def extract_links\n unless self.content.blank?\n links = []\n results = self.content.scan(/href=\"(.*?)\"/)\n results.each do |result|\n logger.info \"Extract result: \" + result[0]\n links << result[0].to_s\n end\n links.flatten\n \n end \n end",
"title": ""
},
{
"docid": "97ab5a6164bded4364b9c0b84b1def89",
"score": "0.65092736",
"text": "def extract_link(fb_obj, params)\n (params['comment_body'] || (params['body'] && params['body'].index('was bummed out by') != nil)) ?\n params[:url] :\n (fb_obj && fb_obj['link']) || params['link'] || extract_link_info(params[:url])\n end",
"title": ""
},
{
"docid": "8c42d75d5287cbe58e1fd6141b7f4d7c",
"score": "0.6487758",
"text": "def extract_links\n links = {}\n @page.xpath('//a').each do |link|\n if link['href'] and link['href'].include? 'http' and\n link['rel'] != 'nofollow':\n links[link['href']] = link['title'] || link.content.strip || \"\"\n end\n end\n\n links\n end",
"title": ""
},
{
"docid": "99ea001feabc9e1dd1f088fcb6b145be",
"score": "0.64373076",
"text": "def link_from_url(url)\n url =~ /amazon.com\\/(.+)\\z/\n $1\n end",
"title": ""
},
{
"docid": "94436f5f6614199521a6be8e8ef639c7",
"score": "0.64149284",
"text": "def extract_info_from_url\n splitted_url = github_url.delete(\" \").split(\"/\")\n self.github_name = splitted_url[-1]\n self.github_owner = splitted_url[-2]\n end",
"title": ""
},
{
"docid": "a84ea4d53a832dd42c950e891b24a4dd",
"score": "0.6411794",
"text": "def link_lookup(url)\n return get_request(\n \"/user/link_lookup\", \n :url => url\n ){|data| data['link_lookup'].first} \n end",
"title": ""
},
{
"docid": "52739e1fd408b868daf23b139c0557c8",
"score": "0.63902247",
"text": "def parse_link_header(response)\n links = {}\n parts = response.headers['link'].split(',')\n\n # Parse each part into a named link\n parts.each do |part, _|\n section = part.split(';')\n url = section[0][/<(.*)>/, 1]\n name = section[1][/rel=\"(.*)\"/, 1].to_sym\n links[name] = url\n end\n links\n end",
"title": ""
},
{
"docid": "d98bbd04ac2de4da2087767d0c1ff0e3",
"score": "0.6382293",
"text": "def find_links(url)\n begin\n html_code = Nokogiri::HTML(open(url, 'User-Agent'=> 'IUB-I427-qiuwshou'))\n base_url = url[/^.+?[^\\/:](?=[?\\/]|$)/]\n outbound_links = []\n href = html_code.css(\"a\")\n href.each do |h|\n h = h.attribute('href').to_s\n #if it is a local link then add base_url to it\n if h =~ /https?:\\/\\/(.+)/\n outbound_links.push(h)\n else\n outbound_links.push(base_url+h)\n end\n end\n rescue\n puts \"#{url} can't be open\"\n end\n return outbound_links\nend",
"title": ""
},
{
"docid": "b3ad526d8b27415c261334c070c542ad",
"score": "0.6372962",
"text": "def get_url_herault (url)\n web_links = Nokogiri::HTML(open(url).read)\n web_object = web_links.css(\"a\")\n array = []\n web_object.each {|link| array << link[\"href\"]}\n #grep : isole les elements contenant ces caracteres\n tab = array.grep(/.*34/)\n #construction du nouvel url :\n tab.map {|i| i[0]= \"\" + \"http://annuaire-des-mairies.com\"}\n return tab\n end",
"title": ""
},
{
"docid": "1b34e39186f28538994324275b3b0bbd",
"score": "0.6358508",
"text": "def links_in_email(email)\r\n URI.extract(email.to_s, ['http', 'https'])\r\n end",
"title": ""
},
{
"docid": "fa0e633ecc9e6a8f0edc39c7649b827b",
"score": "0.63453484",
"text": "def grab_link_code\n link_code = `decodeURIComponent(#{@location.hash}||#{@location.search})`\n if link_code != ''\n raw_code = link_code[6..-1]\n opal_code, html_code, css_code = raw_code.split(/&(?:html|css)_code=/)\n { opal_code: opal_code,\n html_code: html_code,\n css_code: css_code\n }\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "caeb0f304a437b9e0c6c1f7be0754ff9",
"score": "0.6341453",
"text": "def parse_link_header header\n links = Hash.new\n parts = header.split(\",\")\n\n # Parse each part into a named link\n parts.each do |part, index|\n section = part.split(\";\")\n url = section[0][/<(.*)>/,1]\n name = section[1][/rel=\"(.*)\"/,1].to_sym\n links[name] = URI(url)\n end\n return links\nend",
"title": ""
},
{
"docid": "a71fb5426df3766bfcb42197f95d6205",
"score": "0.6336955",
"text": "def get_info_with_url\n website = params[:link]\n puts website\n if website\n page = MetaInspector.new(website)\n if page\n url = { title: page.title, favicon: page.images.favicon ? page.images.favicon : page.images[0] }\n render json: {code: 200, url: url}\n else\n render json: {code: 500 }\n end\n end\n \n end",
"title": ""
},
{
"docid": "6ed557051ab7a9e8356d30e6535106c7",
"score": "0.6333826",
"text": "def extract_links(phash)\n phash[\"news\"] = URI.extract(phash[\"news\"]) if phash[\"news\"]\n\n # Remove commas trailing at end and non-links\n phash[\"news\"] = phash[\"news\"].map{|i| i.gsub(/\\,$/, '')} if phash[\"news\"]\n phash[\"news\"] = phash[\"news\"].delete_if{|i| !i.include?(\"http\") && !i.include?(\"www\")} if phash[\"news\"]\n return phash\n end",
"title": ""
},
{
"docid": "e29cb3aaa47480b3ea3e1390a421d33e",
"score": "0.63266885",
"text": "def read_link(link)\n # To handle elements of the form:\n # <link href=\"/%252FUsers%252Ffross%252Ffile%20with%20spaces\"\n # Note that the link is already URL encoded.\n uri = URI(link.attributes['href'].text)\n rel = link.attributes['rel'].text\n return rel, uri\n end",
"title": ""
},
{
"docid": "320e6f23120e2486b40449f21918d471",
"score": "0.63253915",
"text": "def extract_cinema_url(result)\n url = result.search(\".visitWebsiteLink a\").first\n url.attributes[\"href\"].value\n end",
"title": ""
},
{
"docid": "11e9e2805c06e81ed0b19c7c71248061",
"score": "0.6325305",
"text": "def url_parse(link)\n url = URI.parse(link)\n url.host = get_ip(url.host)\n URI.parse('http://' + url.host + url.path)\nend",
"title": ""
},
{
"docid": "5afc4895ea0ccb4d484bd2403e35978b",
"score": "0.6302722",
"text": "def process\n url = message[LINK_RE, 1]\n log \"> #{url}\"\n case url\n when %r(twitter\\.com.+/status(es)?/.+)i\n tweet_content = extract_tweet_content(url)\n unless tweet_content.blank?\n paste Text::Format.new(:text => tweet_content, :first_indent => 0).paragraphs\n end\n when %r(github\\.com.+/tree/master)i\n github_description = extract_github_description(url)\n unless github_description.blank?\n paste Text::Format.new(:text => github_description, :first_indent => 0).paragraphs\n end\n else\n page_title = extract_page_title(url)\n unless page_title.blank?\n speak \"Last link: #{page_title}\"\n end\n end\n end",
"title": ""
},
{
"docid": "a3efee16f9aeea1f914d14302fe7393a",
"score": "0.62920475",
"text": "def parse_url(url, options)\n url.gsub!(/\\s/, '')\n url.gsub!(/\\?.*/, '') if options.strip_query?\n url.gsub!(/\\#.*/, '') if options.strip_anchor?\n Addressable::URI.parse(url)\n end",
"title": ""
},
{
"docid": "7590aaf5c4d508f51c3847c661177d3a",
"score": "0.62849885",
"text": "def url_for_link link\n case link\n when LINK_REGEX # => [[foo bar]]\n '/wiki/' + Article.parametrize($~[1]) # => /wiki/foo_bar\n when EXTERNAL_LINK_REGEX # => http://example.com/\n $~[1] # => http://example.com/\n when RELATIVE_PATH_REGEX # => /issues/100\n $~[1] # => /issues/100\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "69ecaa12618dd6d0d7fb12457dc66bb3",
"score": "0.6276738",
"text": "def football_link_extractor(url)\n\tprofootball_links = []\n\tpage = Nokogiri::HTML(open(url))\n\ta_tag_length = (page.css('a').count - 1) # remember .count goes out over the index by +1\n\t(0..a_tag_length).each do |num|\n\t\tlink = page.css('a')[num][\"href\"]\n\t\tif link_filterer(link)\n\t\t\tprofootball_links << link\n\t\tend\n\t\tprofootball_links = profootball_links.uniq\n\tend\n\treturn profootball_links\nend",
"title": ""
},
{
"docid": "93659a03c1a818583d4c65e3e7765c1c",
"score": "0.6238212",
"text": "def extract_urls(line)\n line.scan(%r{(?:https?|file)://[-a-zA-Z0-9@:%_+.~#?&/=]+[-a-zA-Z0-9@%_+.~#?&/=!]+}x)\nend",
"title": ""
},
{
"docid": "4374122fbf343eccc0618066d98b1fae",
"score": "0.62036693",
"text": "def parsed_link\n base = @link.split(\"watch?v=\").last\n \"https://www.youtube.com/v/#{base}?\"\n end",
"title": ""
},
{
"docid": "85105f45cba0cf327833247036b65b27",
"score": "0.6184969",
"text": "def analyze_link(url, absolute = nil) # :nodoc:\n dir_long , sheet = url.split(/\\#/)\n link_type = absolute ? (0x01 | absolute) : 0x0103\n\n if sheet\n link_type |= 0x08\n sheet_len = [sheet.bytesize + 0x01].pack(\"V\")\n sheet = sheet.split('').join(\"\\0\") + \"\\0\\0\\0\"\n else\n sheet_len = ''\n sheet = ''\n end\n\n [dir_long, link_type, sheet_len, sheet]\n end",
"title": ""
},
{
"docid": "c7f8838cf54adbfaee9d883f9fddc23e",
"score": "0.61622274",
"text": "def extract_url_elements\n extract_elements 'url'\n end",
"title": ""
},
{
"docid": "0484e568e2ff5dbbe01fd5a46e4e8434",
"score": "0.615285",
"text": "def get_url(result)\n if result.item_links.item_link[0]\n url = result.item_links.item_link[0].url\n else\n url = \"n/a\"\n end\n return url\n end",
"title": ""
},
{
"docid": "b8d1e33835ba2defde21508cdf8f9e0b",
"score": "0.61439073",
"text": "def grab_link_code\n link_code = `decodeURIComponent(#{@location.hash})`\n if link_code != ''\n link_code[6..-1]\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "209c0e42f39a477db754f1d571724305",
"score": "0.61363155",
"text": "def getUrls \n txt = self.getALL\n url = URI::extract(txt, /http(s)?/)\n return url\n end",
"title": ""
},
{
"docid": "6fe32634bf6e92edd825b7c6d4e1f4c5",
"score": "0.61194134",
"text": "def parse_url\n doc = Nokogiri::HTML(open(@target.target_url))\n doc.css('a, h1, h2, h3').each do |el|\n @content = Content.new\n @content.target = @target\n @content.data_type = el.name\n if el.name == 'a'\n @content.data = el['href']\n else\n @content.data = el.content\n end\n @content.save!\n end\n end",
"title": ""
},
{
"docid": "5917e48e01022428187f38fbd9355c7f",
"score": "0.611934",
"text": "def parse_url(url)\n Addressable::URI.parse(url)\n end",
"title": ""
},
{
"docid": "8babb5a2031c442dbc11b2b87462b0ff",
"score": "0.6112962",
"text": "def extract_host(u)\n u[/(?:https?:\\/\\/)?(.+?)(\\/|$)/, 1]\n end",
"title": ""
},
{
"docid": "f8635e9672d6c6d31230434cff9b8e6d",
"score": "0.6108619",
"text": "def parse_hyperlink_value(value)\n if value =~ /=HYPERLINK\\(\"([^\"]+)\",\"([^\"]+)\"\\)/\n value, link = $2, $1\n else\n value\n end\n end",
"title": ""
},
{
"docid": "b410528333989054b27a08183ba6db7c",
"score": "0.6100582",
"text": "def extract\n message.scan(URL_RGX).each do |url|\n UrlStore.add_url :user_id => user.id, :url => url.first#gsub(/\\[|\\]/, \"\")\n end\n end",
"title": ""
},
{
"docid": "20b87e927c022050f706d8d86b9e8e1a",
"score": "0.60894567",
"text": "def convert_to_link_hash(link)\r\n link_hash = {}\r\n\r\n if link =~ /([a-zA-Z0-9\\-]*)\\/([a-zA-Z0-9\\-\\._]*)/\r\n user = $1\r\n name = $2\r\n link_hash[:user] = user\r\n link_hash[:name] = name\r\n link_hash[:uri] = \"https://github.com/#{user}/#{name}\"\r\n link_hash[:description] = fetch_github_repo_description(user, name)\r\n else\r\n name = link\r\n link_hash[:name] = name\r\n link_hash[:uri] = \"https://github.com/vim-scripts/#{name}\"\r\n link_hash[:description] = fetch_github_repo_description('vim-scripts', name)\r\n end\r\n\r\n link_hash\r\nend",
"title": ""
},
{
"docid": "793090e8d88dc3cf5825332339981cd6",
"score": "0.6086229",
"text": "def decode_urls_for(text)\n return text if text.blank?\n\n text.gsub(Locomotive::Steam::SECTIONS_LINK_TARGET_REGEXP) do\n decode_url_for($~[:link])[0]\n end\n end",
"title": ""
},
{
"docid": "369b2b106525f4be7f6ecb5ce97c850c",
"score": "0.6074848",
"text": "def extract_url(object)\n case object\n when Addressable::URI; object.to_s\n when ::String; Addressable::URI.parse(object).to_s\n when Armory::Auction; object.url.to_s\n end\n end",
"title": ""
},
{
"docid": "82e3c2f32411a2c1f26fa76accbb5af4",
"score": "0.60727024",
"text": "def process_href(href)\n \"https://en.wikipedia.org\" + href\n end",
"title": ""
},
{
"docid": "607554e0f719f43f8344a93c1d1d6f74",
"score": "0.6067526",
"text": "def url_after_redirection(url)\n FacebookLink.info(url).url\n end",
"title": ""
},
{
"docid": "ff39e01ee45724dbd110b510f3c6af88",
"score": "0.606692",
"text": "def extract_link_from_encoded_a(str)\n el= str.split('>', 2) # find the end of the opening part of the span tag.\n arr = el[0].split('href=', 2)\n return \"\" if arr.length < 2\n quote = arr[1][0,1]\n arr2 = arr[1].split(quote)\n return arr2[1]\n end",
"title": ""
},
{
"docid": "5b5793ab3402801232b6fe0d9af4ce72",
"score": "0.60645795",
"text": "def external_link(url)\n if url =~ URI::regexp\n return link_to url, url\n else\n return url\n end\n end",
"title": ""
},
{
"docid": "e518c0cce207fc1e3cc8b1c6440b5289",
"score": "0.60594517",
"text": "def basis_url\n uri = URI.parse(link)\n return \"#{uri.scheme}://#{uri.host}\"\n end",
"title": ""
},
{
"docid": "ba479d0f6ea0d977fa9bf33b6299ba99",
"score": "0.60561997",
"text": "def href\n return external_link if external_link\n\n url = (link&.try(:slug) || link&.try(:url))\n return url unless fragment.present?\n\n url = URI(url || '')\n url.fragment = fragment\n url.to_s\n end",
"title": ""
},
{
"docid": "150d31955b92894fb67e29c8211bc487",
"score": "0.6049014",
"text": "def get_entry_link( entry )\n title = entry.elements[\"title\"].text.to_s;\n links = entry.elements.each(\"link\"){ |elem| elem };\n link = links.select{ |elem| elem.attribute(\"title\").to_s == title }[0]; #TODO:quotes in the blog title will dork this!!!\n assert { link } \n return link.attribute(\"href\").to_s; \n end",
"title": ""
},
{
"docid": "7de22ac91a31ef63f56777feeed585a6",
"score": "0.60383964",
"text": "def link_by_text_get_href(link_text)\n return link_by_text(link_text).href\nend",
"title": ""
},
{
"docid": "1e974e11f9a1f6de4b2d36411591beb1",
"score": "0.6035422",
"text": "def info_urls_for(granule)\n link = opendap_link(granule)\n if @url_suffix.present? && link.present?\n [link + '.info']\n else\n []\n end\n end",
"title": ""
},
{
"docid": "7fb4bbfc3840e3613d193638cb9cf54f",
"score": "0.60303456",
"text": "def parse_link(base, link)\n checking = [base, link['name'], link['url'], link['id']]\n if checking.any? {|x| @searching.match x }\n if link['type'] == 'url'\n @allurls.push(Bookmark.new base, link['name'], link['url'], link['id'])\n end\n end\n end",
"title": ""
},
{
"docid": "dc83dce0e1756aef98e5c4b7a605c526",
"score": "0.60270166",
"text": "def link_host(link)\n return link.host unless link.to_s =~ PROXY_REGEX && link.to_s.include?('url=')\n proxy = CGI.parse(link.query.force_encoding(Encoding::UTF_8))\n return link.host unless proxy.key?('url')\n\n extracted_url = URI.extract(proxy['url'].first).first\n return link.host unless extracted_url\n URI.parse(extracted_url).host\n end",
"title": ""
},
{
"docid": "51201200c6026061b5a80486385a31a2",
"score": "0.6026365",
"text": "def parse_link_header(header)\r\n links = {}\r\n\r\n parts = header.split(',').each do |part|\r\n page = part.split(';')\r\n relative_url = page[0][/<https:\\/\\/api.github.com(.*)>/, 1]\r\n name = page[1][/rel=\"(.*)\"/, 1].to_sym\r\n links[name] = relative_url\r\n end\r\n\r\n links\r\n end",
"title": ""
},
{
"docid": "dc9e357e3360aae7bbf240effe7b6ffd",
"score": "0.60133106",
"text": "def convert_to_link_hash(link)\n link_hash = {}\n\n if link =~ /([a-zA-Z0-9\\-]*)\\/([a-zA-Z0-9\\-\\._]*)/\n user = $1\n name = $2\n link_hash[:user] = user\n link_hash[:name] = name\n link_hash[:uri] = \"https://github.com/#{user}/#{name}\"\n link_hash[:description] = fetch_github_repo_description(user, name)\n else\n name = link\n link_hash[:name] = name\n link_hash[:uri] = \"https://github.com/vim-scripts/#{name}\"\n link_hash[:description] = fetch_github_repo_description('vim-scripts', name)\n end\n\n link_hash\nend",
"title": ""
},
{
"docid": "d7c1804f23e223543cde3a6689ff738f",
"score": "0.60102504",
"text": "def link\n unless @resource_metadata.nil? or @resource_metadata['link'].nil?\n link_data = @resource_metadata['link']\n link = link_data.match('^[^\\(]+\\(\\\"([^\\\"]+)\\\".*') {|m| m[1] }\n return link\n end\n return \"\"\n end",
"title": ""
},
{
"docid": "d7c1804f23e223543cde3a6689ff738f",
"score": "0.60102504",
"text": "def link\n unless @resource_metadata.nil? or @resource_metadata['link'].nil?\n link_data = @resource_metadata['link']\n link = link_data.match('^[^\\(]+\\(\\\"([^\\\"]+)\\\".*') {|m| m[1] }\n return link\n end\n return \"\"\n end",
"title": ""
},
{
"docid": "3cf4cbb9a8ba16ceb669abe180a12774",
"score": "0.6008535",
"text": "def format_link_or_text(url)\n return url\n end",
"title": ""
},
{
"docid": "9721370b810adc6146325e4165bb2350",
"score": "0.60044503",
"text": "def process_external_link_tag(tag)\n parts = tag.split('|')\n parts.reverse! if @markup.reverse_links?\n return if parts.size.zero?\n if parts.size == 1\n url = parts[0].strip\n else\n name, url = *parts.compact.map(&:strip) \n end\n accepted_protocols = @markup.wiki.sanitization.protocols['a']['href'].dup\n if accepted_protocols.include?(:relative)\n accepted_protocols.select!{|protocol| protocol != :relative}\n regexp = %r{^((#{accepted_protocols.join(\"|\")}):)?(//)}\n else\n regexp = %r{^((#{accepted_protocols.join(\"|\")}):)}\n end\n if url =~ regexp\n if name.nil?\n %{<a href=\"#{url}\">#{url}</a>}\n else\n %{<a href=\"#{url}\">#{name}</a>}\n end\n else\n nil\n end\n \n end",
"title": ""
},
{
"docid": "8b432f520e745534e68992eeb126a5f5",
"score": "0.600337",
"text": "def process_urlquery\n\turls = Array.new\n\txdoc = Nokogiri::HTML(open('http://urlquery.net'))\n\txdoc.xpath('//table//a').each do |item|\n\t\tif item.to_s =~ /title\\=\\\"(.*)\\\" href=/\n\t\t\turl = $1\n\t\t\turls.push(url)\n\t\telse\n\t\t\tprint \"No match.\".red\n\t\t\tputs item.to_s.light_red\n\t\tend\n\tend\n\treturn urls\nend",
"title": ""
},
{
"docid": "ab4b8d7221ae4b35ff4941a80b9979a7",
"score": "0.6000134",
"text": "def extract_links(page)\n page.links(@source[:archive_patterns])\n end",
"title": ""
},
{
"docid": "06aa9ab17f0faf92cacb0f4ca3cc723e",
"score": "0.59985524",
"text": "def extract_links(doc)\n {'a' => 'href', 'area' => 'href', 'frame' => 'src'}.map do |tag, attr|\n (doc/tag).map do |tag|\n value = tag[attr]\n CGI.unescapeHTML(value) if value && value !~ /^#/\n end\n end.flatten.compact\n end",
"title": ""
},
{
"docid": "ec5f1d645cb1a7979e72561081edeefe",
"score": "0.59962684",
"text": "def extract_url_from(full_web_address)\n uri = URI.parse(full_web_address.strip)\n uri.scheme + \"://\" + uri.host\n end",
"title": ""
},
{
"docid": "abb5f99a1986315ece82967eba889f54",
"score": "0.5992554",
"text": "def links(resp)\n return nil unless resp['Link']\n ret = {}\n resp['Link'].scan(/<([^>]*)>; rel=\"([^\"]*)\"/).each do |link, rel|\n ret[rel] = link\n end\n ret\n end",
"title": ""
},
{
"docid": "ee6f00742dcf4c3de643e2379378d91d",
"score": "0.5975496",
"text": "def parse_links(doc)\r\n return if doc == nil\r\n doc = open_scraper(doc)\r\n unless doc.nil?\r\n links = doc.search(\"a[@href]\")\r\n unless links.nil?\r\n links.each do |link|\r\n begin\r\n uri = URI.parse(link.attributes[\"href\"])\r\n rescue\r\n # skip this link\r\n end if link.attributes[\"href\"].length > 0\r\n end\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "5f5d783d67ea25b78dcefe9210ee8b2a",
"score": "0.5973051",
"text": "def cleanup_link(link)\n url = link;\n\n # habrahabr.ru\n if(link.match(/:\\/\\/habrahabr\\.ru/))\n url = link.sub(\"habrahabr.ru\", \"m.habrahabr.ru\").sub(/\\.ru\\/.+\\/(\\d+)/, '.ru/post/\\1').sub(/#habracut$/, \"\");\n end\n\n # livejournal.ru\n if(link.match(/:\\/\\/.+\\.livejournal\\.(com|ru)/) && !link.match(/:\\/\\/m\\.livejournal\\.(com|ru)/))\n # blog post\n url = link.sub(/:\\/\\/(.+).livejournal.com\\/(\\d+).html/, ':#m.livejournal.com/read/user/\\1/\\2');\n # theme\n url = url.sub(/www.livejournal.ru\\/themes\\/id\\/(\\d+)$/, 'm.livejournal.com/themes/all/\\1');\n end\n\n # www.trud.ru\n if(link.match(/:\\/\\/www.trud.ru/))\n url = link.sub(/\\.html$/, \"/print\")\n end\n\n # lenta.ru\n if(link.match(/:\\/\\/lenta.ru/))\n url = link.sub(/\\/?$/, \"/_Printed.htm\");\n end\n\n # roem.ru\n if(link.match(/:\\/\\/roem.ru/) && !link.match(\"reom.ru/pda\"))\n url = link.sub(/\\/(\\?.*)?$/, \"\").sub(/\\/\\d{4}\\/\\d{2}\\/\\d{2}\\/\\D+(\\d+)$/, '/pda/?element_id=\\1');\n end\n\n # www.guardian.co.uk\n if(link.match(/guardian.co.uk\\//) && !link.match(\"print\"))\n url = link.sub(/$/, \"/print\");\n end\n if(link.match(\"news.rambler.ru\") && !link.match(\"m.rambler.ru\"))\n url = link.sub(/news.rambler.ru\\/(\\d+)\\/.+/, 'm.rambler.ru/news/head/\\1/');\n end\n\n return url;\nend",
"title": ""
},
{
"docid": "90b7bbcf494987b55832447f51ca500f",
"score": "0.597279",
"text": "def parse_links(links)\n results = Hash.new\n links.split(/, */).each do |part|\n if !(matches = /\\A<(.*)>; [^=]+=\"([^\"]*)\"\\Z/.match(part)).nil?\n results[ matches[2] ] = matches[1]\n end\n end\n return results\nend",
"title": ""
},
{
"docid": "6e804cc98197ca1797b10a34188bc894",
"score": "0.5961797",
"text": "def extract_host(url)\n url_arr = URI::split(url)\n return url_arr[2]\n end",
"title": ""
},
{
"docid": "ed65907cc6d3e9f80a05e2e02bdd6edf",
"score": "0.5959151",
"text": "def parse_related_links\n return (@html.css(\"div.entry-content\").css(\"p\").css(\"a\").map{|link| link['href']}.compact.reject{|link| !link.include?(\"http\")}-parse_pdf_link).uniq\n end",
"title": ""
},
{
"docid": "f28404f6b329c53e6178c4ee8714eecf",
"score": "0.59578276",
"text": "def path_from_href(href, url)\n href.match(/#{url}(.*)/)[1]\n end",
"title": ""
},
{
"docid": "23ab193ffc8847b7605fb173e945971c",
"score": "0.5951299",
"text": "def parse_Google_loc(text)\n if text =~ /(L: http:\\/\\/)([^#^ ]*)/\n cur = $2\n x = cur.index(\"http:\")\n if x != nil && x > 0\n link = cur[0...x]\n return \"http://\" + link\n end\n return \"http://\" + cur\n end\n return \"\"\nend",
"title": ""
},
{
"docid": "23ab193ffc8847b7605fb173e945971c",
"score": "0.5951299",
"text": "def parse_Google_loc(text)\n if text =~ /(L: http:\\/\\/)([^#^ ]*)/\n cur = $2\n x = cur.index(\"http:\")\n if x != nil && x > 0\n link = cur[0...x]\n return \"http://\" + link\n end\n return \"http://\" + cur\n end\n return \"\"\nend",
"title": ""
},
{
"docid": "1cd27ff40c0999559659c4f8dadcf33c",
"score": "0.594956",
"text": "def link(s)\n\n self.rxpath(s.split('/').map {|x| \"link[title='%s']\" % x}.join('/')).first\n\n end",
"title": ""
},
{
"docid": "9bab186693b25013d92efd41e33cf850",
"score": "0.5940025",
"text": "def handle_url(url_link)\n return url_link unless @rewrite_url\n query_params = Rack::Utils.parse_query(URI.parse(url_link).query)\n if (eid = query_params[\"eid\"]).blank?\n logger.warn \"unable to parse eid from htmlLink #{url_link}\"\n url_link\n else\n \"https://calendar.google.com/a/berkeley.edu?eid=#{eid}\"\n end\n end",
"title": ""
},
{
"docid": "9bab186693b25013d92efd41e33cf850",
"score": "0.5940025",
"text": "def handle_url(url_link)\n return url_link unless @rewrite_url\n query_params = Rack::Utils.parse_query(URI.parse(url_link).query)\n if (eid = query_params[\"eid\"]).blank?\n logger.warn \"unable to parse eid from htmlLink #{url_link}\"\n url_link\n else\n \"https://calendar.google.com/a/berkeley.edu?eid=#{eid}\"\n end\n end",
"title": ""
},
{
"docid": "323f8c9bca8a35da229c2d751052ea42",
"score": "0.5939236",
"text": "def parse_url(url)\n components = url.split('://')\n components.unshift('') if components.length == 1\n components[1] = components[1].split(':')\n components.flatten!\n components.push(protocol_mapping(components[0]))\n components.shift\n components\n end",
"title": ""
},
{
"docid": "158290a67c063974fcfe129487e732bb",
"score": "0.5932331",
"text": "def url(id)\n a = Mechanize.new\n a.redirect_ok=false\n return a.head(\"http://www.baidu.com/link?url=#{id}\").header['location']\n end",
"title": ""
},
{
"docid": "387a185355ccdccef00a27da97ca3e74",
"score": "0.59310365",
"text": "def extract_new_link (response)\n\n doc = REXML::Document.new response.read_body\n\n #REXML::XPath.first(doc.root, \"//link[@rel='edit']\")\n #\n # doesn't work :(\n\n REXML::XPath.first(doc.root, \"//link[2]\").attribute('href')\n #\n # will break if the order changes :(\n end",
"title": ""
},
{
"docid": "e0716703c03ba99d40f05fcbd2276302",
"score": "0.5930494",
"text": "def format_image_url(raw)\n doc = Nokogiri::HTML(raw)\n doc.xpath('//a[1]/@href').text\n end",
"title": ""
},
{
"docid": "86839bd032959e8291134026d871e461",
"score": "0.59283924",
"text": "def extract_site_info(url)\n puts url\n doc = Nokogiri::HTML(open(url))\n doc.css(\".fz14.SimSun\")\n all_tags = doc.css(\".fz14.SimSun a\").map(&:text)\n locate = doc.css(\".mb15.fz14.SimSun a\").map(&:text)\n cats = all_tags - locate\n [cats.join(\",\"), locate.join(\",\")]\nend",
"title": ""
},
{
"docid": "a45bba9901323481a77d5e0e185c1686",
"score": "0.59209204",
"text": "def _extract_urls( html )\n\n\t\t\toptions = {\n\t\t\t\t'a' => 'href',\n\t\t\t\t'embed' => 'src',\n\t\t\t\t'iframe' => 'src'\n\t\t\t}\n\n\t\t\tattributes = Registry::get( 'dom' ).extract_attributes( html, options )\n\t\t\turls = [ ]\n\n\t\t\toptions.each do | tag_name, attribute_name |\n\t\t\t\tattributes[ tag_name ].each do | _, tag |\n\t\t\t\t\turls.push( tag[ attribute_name ])\n\t\t\t\tend\n\t\t\tend\n\n\t\t\turls\n\t\tend",
"title": ""
},
{
"docid": "1efcbd259104c7bd04ec2fe8a5c1a9a2",
"score": "0.59174407",
"text": "def extract_links(field)\n return field.split(\"<\").select{|f| f.include?(\">\")}.map{|i| i.split(\">\")[0]}\n end",
"title": ""
},
{
"docid": "1bbb80f96eabd4617ead8e542c975f0d",
"score": "0.5916618",
"text": "def shorten_link(link)\n link.split('/?').first\n end",
"title": ""
},
{
"docid": "6f1b1c710a6a69e7f198c0a670c6faed",
"score": "0.591622",
"text": "def parse_search_result\n links = []\n url = \"#{BASE_URL}/name/#{@name}_#{@zip_code}\"\n @page = @mechanize.get(url)\n puts \"#{url}\"\n return nil if check_match_zip_code? == false\n parse_detail_link = @page.search(\"//a[@class='btn btn-primary link-to-details']\")\n puts \"#{url} with parse_detail_link is present\"\n if parse_detail_link.present?\n parse_detail_link.each do |item|\n begin\n next unless item.present?\n raw_link = item.attributes[\"href\"]&.value\n @log.info \"#{Time.zone.now} #{raw_link}\"\n links << \"#{BASE_URL}#{raw_link}\" if raw_link.present?\n rescue Exception => e\n @log.info \"#{Time.zone.now} #{@name} #{@zip_code} #{item}\"\n @log.fatal e.inspect\n @log.fatal e.backtrace\n end\n end\n end\n links.first\n end",
"title": ""
},
{
"docid": "0890cfa28c350e4df7ee72a824f96d74",
"score": "0.5909461",
"text": "def link_header(response)\n response.headers.fetch('link', '').split(',').reduce({}) do |h, link|\n page, type = link.scan(/\\<(.*)\\>; rel=\"(.*)\"/).flatten\n h[type.to_sym] = page\n\n h\n end\n end",
"title": ""
},
{
"docid": "933e0e849e145d4c62ce0010671deb8a",
"score": "0.59069675",
"text": "def link\n @headers[:link]\n end",
"title": ""
},
{
"docid": "933e0e849e145d4c62ce0010671deb8a",
"score": "0.59069675",
"text": "def link\n @headers[:link]\n end",
"title": ""
},
{
"docid": "6bf54aa5677273cd17f50e5884ad8b0c",
"score": "0.5904434",
"text": "def host_and_path(url)\n md = url.scan(/\\/\\/([^\\/]*)(.*)/)\n return md[0][0], md[0][1]\nend",
"title": ""
}
] |
184bbf9bf66f132d86a11b0a4d804798
|
Finds link relations from 'Link' response header Returns an array of Relations
|
[
{
"docid": "cf41cb7ba73093514b707312964479e2",
"score": "0.71089524",
"text": "def process_rels\n links = ( @headers[\"Link\"] || \"\" ).split(', ').map do |link|\n href, name = link.match(/<(.*?)>; rel=\"(\\w+)\"/).captures\n\n [name.to_sym, Relation.from_link(@agent, name, :href => href)]\n end\n\n Hash[*links.flatten]\n end",
"title": ""
}
] |
[
{
"docid": "66187af217fa737d5ec43dcaffafd332",
"score": "0.71400267",
"text": "def links\n relationships = map_relationships\n children = ( relationships.nil? )? [] : relationships\n children.unshift( response_block.call( model, 'self') )\n end",
"title": ""
},
{
"docid": "40fb0dd9a2206e5ffb2e408fd7fc0d2e",
"score": "0.7037936",
"text": "def process_rels(response)\n links = (response.headers[\"Link\"] || \"\" ).split(', ').map do |link|\n href, name = link.match(/<(.*?)>; rel=['\"](\\w+)[\"']/).captures\n [name.to_sym, href]\n end\n\n Hash[*links.flatten]\n end",
"title": ""
},
{
"docid": "584f5d34d545f109f9677c416e9f6d0d",
"score": "0.7004361",
"text": "def links\n data['links']\n end",
"title": ""
},
{
"docid": "584f5d34d545f109f9677c416e9f6d0d",
"score": "0.7004361",
"text": "def links\n data['links']\n end",
"title": ""
},
{
"docid": "abb5f99a1986315ece82967eba889f54",
"score": "0.6966388",
"text": "def links(resp)\n return nil unless resp['Link']\n ret = {}\n resp['Link'].scan(/<([^>]*)>; rel=\"([^\"]*)\"/).each do |link, rel|\n ret[rel] = link\n end\n ret\n end",
"title": ""
},
{
"docid": "5d17b47688a8ef12d8ac70c1bd695ebb",
"score": "0.6934697",
"text": "def links\n links = []\n ReservationLink.find_all_by_RESERVATION_ID(self.RESERVATION_ID).each do |link|\n links << link.link\n end\n links\n end",
"title": ""
},
{
"docid": "95950ade670b0690a1af513dbd16992f",
"score": "0.68763465",
"text": "def get_relations\n return @payload.get_path(\"relation\"){[]}\n end",
"title": ""
},
{
"docid": "4ca8c579148a075fa92c7fd6131e4beb",
"score": "0.6874268",
"text": "def links\n @links.values\n end",
"title": ""
},
{
"docid": "df7003ae63344c3e8cc7ef81c9dea11b",
"score": "0.6871611",
"text": "def get_links\n @links.get_all\n end",
"title": ""
},
{
"docid": "504ccbda535fe7b1b019468f64e1892d",
"score": "0.6830537",
"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": "fee640c6ac40074f32d592f5e43cad12",
"score": "0.68079776",
"text": "def links\n @links ||= LinkHeader.parse(@headers[:link])\n end",
"title": ""
},
{
"docid": "666004de9ca086e09dd95ca190657ba6",
"score": "0.6781495",
"text": "def links\n each_link.to_a\n end",
"title": ""
},
{
"docid": "65617b4215f51d38aba96f656e4d629b",
"score": "0.67453825",
"text": "def links\n Ldp::Response.links(self)\n end",
"title": ""
},
{
"docid": "e3d220082fab4900cf79dcb540a456d4",
"score": "0.67104566",
"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": "38fcb3ee44b7133eb79e8cd5a45c1b4e",
"score": "0.6702927",
"text": "def links\n @links.to_a\n end",
"title": ""
},
{
"docid": "234b45be406abb6dad4703a929d61ae4",
"score": "0.6658685",
"text": "def build_links model, relationship\n { :links => [ response_block.call(model, relationship) ] }\n end",
"title": ""
},
{
"docid": "fab930ece7bf8c6cfd8f9ab40b68373c",
"score": "0.6653559",
"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": "2cc267416635f6818350754ccab7a2c1",
"score": "0.6644533",
"text": "def links(relationship, options = {})\n if !defined?(@links)\n @links = {}\n end\n\n arguments = [self.fullID]\n\n cmdOptions = {}\n cmdOptions[\"-j\"] = true\n\n if @account\n cmdOptions[\"-T\"] = @account.token\n end\n\n cmdOptions[\"-r\"] = relationship\n\n if options.has_key? :order\n cmdOptions[\"--order\"] = options[:order].to_s\n end\n\n if [email protected]_key?(relationship) || options[:force]\n result = Occam::Worker.perform(\"links\", \"list\", arguments, cmdOptions)\n ret = JSON.parse(result[:data], :symbolize_names => true)\n\n @links[relationship] = ret.map do |link|\n Occam::Link.new(:source => self,\n :target => Occam::Object.new(:uuid => link[:id], :info => link, :revision => link[:revision], :link => link[:local_link_id], :account => @account),\n :relationship => relationship,\n :local_link_id => link[:local_link_id],\n :account => @account,\n :id => link[:id])\n end\n end\n\n @links[relationship]\n end",
"title": ""
},
{
"docid": "8cf236c94c971776d96ba63fc99576fa",
"score": "0.66349906",
"text": "def links_from(records)\n records.map(&:links).flatten\n end",
"title": ""
},
{
"docid": "00611167f6f26c253f78814c70fca9a2",
"score": "0.66327274",
"text": "def links\n KISSmetrics::Client::Response::Links.new(@attributes.fetch('links', []))\n end",
"title": ""
},
{
"docid": "95ccce327fbd1033a099a3cdd795511e",
"score": "0.6626889",
"text": "def all_links\n Link.all\n end",
"title": ""
},
{
"docid": "95ccce327fbd1033a099a3cdd795511e",
"score": "0.6626889",
"text": "def all_links\n Link.all\n end",
"title": ""
},
{
"docid": "9f6ae752e286bd34f7cf1ca3c88ef9c4",
"score": "0.65769863",
"text": "def links\n return @links\n end",
"title": ""
},
{
"docid": "9f6ae752e286bd34f7cf1ca3c88ef9c4",
"score": "0.65769863",
"text": "def links\n return @links\n end",
"title": ""
},
{
"docid": "9f6ae752e286bd34f7cf1ca3c88ef9c4",
"score": "0.65769863",
"text": "def links\n return @links\n end",
"title": ""
},
{
"docid": "9f6ae752e286bd34f7cf1ca3c88ef9c4",
"score": "0.65769863",
"text": "def links\n return @links\n end",
"title": ""
},
{
"docid": "4f22d2e9a6964a79dff0e6c8a55509a6",
"score": "0.65572137",
"text": "def all_links\n Link.all #the query returns all links\n end",
"title": ""
},
{
"docid": "5b5127454d47f8c978136d7aa3c07f78",
"score": "0.6530943",
"text": "def links\n @links\n end",
"title": ""
},
{
"docid": "d1007e6d9ac327cbb0fed371b85b8372",
"score": "0.652303",
"text": "def links\n unless @links\n @links = TagCollection.new(@doc) do |array, symbol, *args|\n linkset = array.select {|link| link.rel == symbol.to_s }\n unless linkset.empty?\n linkset.size == 1 ? linkset.first : linkset\n else\n nil\n end \n end\n @doc.xpath(\"xmlns:link\").each do |link|\n @links << Link.new(link)\n end \n end\n \n return @links\n end",
"title": ""
},
{
"docid": "8ef2dc5f1f8fd483dacf2d1ecd61a924",
"score": "0.6511703",
"text": "def get_relations(args)\n\t\t\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/relations/#{args[:relation]}\"\n\t\t\tdo_the_get_call( url: api_url )\n\t\tend",
"title": ""
},
{
"docid": "b3b2d6b73ed4252f7b53e18035cea76c",
"score": "0.64838177",
"text": "def all_links\n links_by_rel\n .reduce(Set.new) { |result, kv|\n _,links = *kv\n links.each { |l| result << l }\n result\n }\n end",
"title": ""
},
{
"docid": "c9b12b427d41ba852d0a115afe5a7349",
"score": "0.64830095",
"text": "def link_list\n if (links = @doc.at(\"div.related-items ul\")).nil?\n @logger.write \"Www_economist_com: Could not fetch links.\\n\"\n return [@uri.to_s]\n else\n links = links/\"li a\" # get the right block of links\n end\n #FIXME SP's want last item in links (Offer to Readers) dropped?\n #links = links[0..-2] # drop the last element, Offer to Readers (sloppy)\n hrefs = links.collect { |l| l.attributes['href'] } # return list of href attributes\n hrefs.insert (0, @uri.to_s) unless (hrefs.first == @uri.to_s)\n hrefs # return\n end",
"title": ""
},
{
"docid": "5394d897ab444ac9cd72196c4c3b32ac",
"score": "0.64765435",
"text": "def relations\n each_relation.to_a\n end",
"title": ""
},
{
"docid": "2644734fc31879656da3f40e81c86f3b",
"score": "0.6460129",
"text": "def hyperlinks\n hyperlink_relationships.each_with_object({}) do |rel, hash|\n hash[rel.attributes['Id'].value] = rel.attributes['Target'].value\n end\n end",
"title": ""
},
{
"docid": "a471e3269eed29ac6975d8e2842ec2f9",
"score": "0.6458857",
"text": "def get_links\n debug \">> #{__method__}\"\n path = LINKS_PATH\n resp = get_object_to_network(@nwc_id, path)\n unless resp.status_code == Response::OK\n return nil\n end\n begin\n links = {}\n resp.body.each do |link_id, link|\n links[link_id] = Link.new(link)\n end\n return links\n rescue => ex\n error 'Exception: Get Invalid Message'\n error \" #{ex.message} #{ex.backtrace}\"\n return nil\n end\n end",
"title": ""
},
{
"docid": "1997075b21aa8dadeaa61519ab1c0bc2",
"score": "0.6399162",
"text": "def links\n\t\treturn ( 0...self.link_count ).collect do |i|\n\t\t\tself.link( i )\n\t\tend\n\tend",
"title": ""
},
{
"docid": "1c4aaa179b47781ce144e3eeb54156c6",
"score": "0.6391136",
"text": "def links\r\n @links.keys\r\n end",
"title": ""
},
{
"docid": "37435ec2842eaff91cbbecb8b0fb3a09",
"score": "0.63902175",
"text": "def link_response\n unless defined? @link_response\n @link_response = responses.find {|r| r.service_type_value_name == \"bd_link_to_search\" }\n end\n return @link_response\n end",
"title": ""
},
{
"docid": "e2ebcf30eecae41e2d58252c17afe9a6",
"score": "0.6360843",
"text": "def find_links\n link_ids =[]\n results = CONNECTION.execute(\"SELECT * FROM assignments_links WHERE assignment_id = #{@id};\")\n results.each do |hash|\n link_ids << hash[\"link_id\"]\n end\n Link.find_many(link_ids)\n end",
"title": ""
},
{
"docid": "ab02693de1a006e96f0a6e4eba0007f5",
"score": "0.62977785",
"text": "def links\n read\n @links\n end",
"title": ""
},
{
"docid": "415de8132600ad86679c24788d5e568f",
"score": "0.62952065",
"text": "def relations\n relations = Invitee.all.map(&:relation).uniq\n relations_h = []\n relations.each do |relation|\n relations_h.push({ item: relation, text: relation })\n end\n render json: { items: relations_h }\n end",
"title": ""
},
{
"docid": "26a4867c30665d8f6861a7e627c46b48",
"score": "0.6280096",
"text": "def links; @links; end",
"title": ""
},
{
"docid": "8105ac05ced6ac819eb03b3f8397752e",
"score": "0.6274105",
"text": "def relations\n retval = []\n require 'nokogiri'\n xml = Nokogiri::XML.parse @raw\n parent = nil\n xml.root.xpath(\"//relation\").each do |rel|\n retval << node2relation(rel)\n end\n retval\n end",
"title": ""
},
{
"docid": "aa892084e3d165e1b737b8c8e2ad7596",
"score": "0.6272778",
"text": "def links\n @links ||= []\n end",
"title": ""
},
{
"docid": "8f1ab6e77d4d4e2dff38f7432ff44055",
"score": "0.626463",
"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": "dd40fb4895a1d558c590296ba0898534",
"score": "0.6263305",
"text": "def _links\n @links\n end",
"title": ""
},
{
"docid": "7586fd6bf7b1a1785b8a3b29543deced",
"score": "0.6253874",
"text": "def list\n response = @document.user.get(@base_uri)\n response[\"links\"].map do |link| \n Link.new(@document, User.new(@document.user.client, link[\"user\"]), :uri => link[\"uri\"])\n end\n end",
"title": ""
},
{
"docid": "ad9f678b6c1e554674d2eb2140ced455",
"score": "0.62470984",
"text": "def links\n\t\t\[email protected]\n\t\tend",
"title": ""
},
{
"docid": "347bbbfce2c8ec6ad871b6fa0da2d4f5",
"score": "0.62096304",
"text": "def links\n @links ||= []\n end",
"title": ""
},
{
"docid": "b14d763ff87336f3c31f9e99f39cfdf9",
"score": "0.6194648",
"text": "def links # this is _not_ called by rendering as we go via ::links_config.\n tuples = (@links||[]).collect { |link| [link.rel, link] }\n # tuples.to_h\n ::Hash[tuples] # TODO: tuples.to_h when dropping < 2.1.\n end",
"title": ""
},
{
"docid": "e5768079ee8d473129d8f35b7423aae9",
"score": "0.6173659",
"text": "def parse_links(resp)\n (@link_parser.nil?) ? Array.new : @link_parser.parse(resp.body)\n end",
"title": ""
},
{
"docid": "3ded2755b8b15f92bd1840d09653bc55",
"score": "0.61659086",
"text": "def get_relations_referring_to_object(type, id)\n api_call_with_type(type, id, \"#{type}/#{id}/relations\")\n end",
"title": ""
},
{
"docid": "f722451248d56728d37f3eb2af45bd1d",
"score": "0.61380446",
"text": "def get_links()\n\t\t\tget_document(@tag_type[0])\n\t\tend",
"title": ""
},
{
"docid": "0ae2727a644a5f0e6318e311d89a5be7",
"score": "0.612048",
"text": "def get_links\n if @data.keys.include?('links')\n # Too laconic? The inner map takes a list of hashes, each specifying a\n # 'rel' and an 'href' and converts it to a list of hashes where the\n # keys are the values of 'rel' (converted to symbols) and the values \n # the values of 'href'. E.g. {'rel' => 'value', 'href' => 'url'} \n # becomes {:value => 'url'}\n #\n # The outer map takes this list of hashes and merges it into a single\n # hash. it also assumes that there is only one of each 'rel' type in\n # the original hash\n #\n # Outer map cribbed from:\n # http://blog.hyfather.com/merging-an-array-of-hashes-in-ruby\n # https://gist.github.com/1295258\n return Hash[\n *@data['links'].map{\n |o| {o['rel'].to_sym => o['href']}\n }.map(&:to_a).flatten\n ]\n end\n return nil\n end",
"title": ""
},
{
"docid": "53c47cab68ba7222aedcb624153dff5f",
"score": "0.61050886",
"text": "def links()\n return @state[\"links\"]\n end",
"title": ""
},
{
"docid": "2be4a0cad5da34017dc6f21c00900910",
"score": "0.60980207",
"text": "def rlinks\n #binding.pry\n rlinks = Slink.where(receiver_id: self.id)\n #rlinks.map { |r| Link.find_by(id: r.link_id) }\n rlinks.map { |r| Link.find_by(id: r.link_id).as_json.merge(\"recommender\"=>User.find_by(id: r.user_id).username) }\n end",
"title": ""
},
{
"docid": "74576984b143e0fc5caeabdee7ae2695",
"score": "0.60927385",
"text": "def links\n @links ||= schema.navigation_properties[name].map do |nav_name, details|\n [\n nav_name,\n { type: details.nav_type, href: \"#{id}/#{nav_name}\" }\n ]\n end.to_h\n end",
"title": ""
},
{
"docid": "2d43c060d28cc067cd21cb52ad06c853",
"score": "0.6091501",
"text": "def relationships\n return [] if empty?\n\n map(&:relationship)\n end",
"title": ""
},
{
"docid": "11b26f3e112dad481e18b06f9817461b",
"score": "0.6088055",
"text": "def links\n attribute_hash '//ald:links/ald:link', %w[name description href]\n end",
"title": ""
},
{
"docid": "2b3c9f7a67de5a3d4aa5ee7089ad03fa",
"score": "0.60825694",
"text": "def relations\n mapped_hash('relation')\n end",
"title": ""
},
{
"docid": "ebe40876366da44ce3d4d6700e948c5e",
"score": "0.60629785",
"text": "def all_links\n []\n end",
"title": ""
},
{
"docid": "f4ce13b49f66d6e1b0bb5480bd46e3df",
"score": "0.6059415",
"text": "def get_associated_resources(client, links, associations)\n # First go through the links and group the rels together\n rels = {}\n links.each do |link|\n if rels[link['rel'].to_sym] # if we have already seen this rel attribute\n rels[link['rel'].to_sym] << link['href']\n else\n rels[link['rel'].to_sym] = [link['href']]\n end\n end\n\n # Note: hrefs will be an array, even if there is only one link with that rel\n rels.each do |rel,hrefs|\n # Add the link to the associations set if present. This is to accommodate ResourceDetail objects\n associations << rel if associations != nil\n\n # Create methods so that the link can be followed\n define_instance_method(rel) do |*args|\n if hrefs.size == 1 # Only one link for the specific rel attribute\n if has_id(*args) || is_singular?(rel)\n # User wants a single resource. Either doing a show, update, delete...\n # get the resource_type\n # Special case: calling .data you don't want a resources object back\n # but rather all its details since you cannot do a show\n return RightApi::ResourceDetail.new(\n client, *client.send(:do_get, hrefs.first, *args)\n ) if rel == :data\n\n if is_singular?(rel)\n # Then the href will be: /resource_type/:id\n resource_type = get_singular(hrefs.first.split('/')[-2])\n else\n # Else the href will be: /resource_type\n resource_type = get_singular(hrefs.first.split('/')[-1])\n end\n path = add_id_and_params_to_path(hrefs.first, *args)\n RightApi::Resource.process(client, resource_type, path)\n else\n # Returns the class of this resource\n resource_type = hrefs.first.split('/')[-1]\n path = add_id_and_params_to_path(hrefs.first, *args)\n RightApi::Resources.new(client, path, resource_type)\n end\n else\n # There were multiple links with the same relation name\n # This occurs in tags.by_resource\n resources = []\n if has_id(*args) || is_singular?(rel)\n hrefs.each do |href|\n # User wants a single resource. Either doing a show, update, delete...\n if is_singular?(rel)\n resource_type = get_singular(href.split('/')[-2])\n else\n resource_type = get_singular(href.split('/')[-1])\n end\n path = add_id_and_params_to_path(href, *args)\n resources << RightApi::Resource.process(client, resource_type, path)\n end\n else\n hrefs.each do |href|\n # Returns the class of this resource\n resource_type = href.split('/')[-1]\n path = add_id_and_params_to_path(href, *args)\n resources << RightApi::Resources.new(client, path, resource_type)\n end\n end\n # return the array of resource objects\n resources\n end\n end\n end\n end",
"title": ""
},
{
"docid": "9d5f4085d3773ec11225badac163840b",
"score": "0.6050009",
"text": "def list_relationships(resource)\n the_feed = hawk_escape resource.feed\n the_id = hawk_escape resource.id\n\n ret = http_get('/feeds/' + the_feed + '/resources/' + the_id + '/relationships')\n val = []\n ret.each { |r| val.push(Relationship.new(r)) }\n val\n rescue\n []\n end",
"title": ""
},
{
"docid": "52739e1fd408b868daf23b139c0557c8",
"score": "0.60456544",
"text": "def parse_link_header(response)\n links = {}\n parts = response.headers['link'].split(',')\n\n # Parse each part into a named link\n parts.each do |part, _|\n section = part.split(';')\n url = section[0][/<(.*)>/, 1]\n name = section[1][/rel=\"(.*)\"/, 1].to_sym\n links[name] = url\n end\n links\n end",
"title": ""
},
{
"docid": "50402a4c33d78e50a3dbb5f11a57d826",
"score": "0.6026697",
"text": "def find_link_by_relation(source, rel)\n links = source['associations']['links'] # links to other resources\n return links.select { |k| k['rel'] == rel }[0]\n end",
"title": ""
},
{
"docid": "48b55408860b380eb626d1033ad118fe",
"score": "0.6020736",
"text": "def parse_links(headers)\n links = {}\n link_header = headers[\"link\"] || headers[\"Link\"]\n link_header.split(\",\").each do |link|\n matches = link.strip.match(/<([^>]*)>\\s*;.*rel\\s*=\\s*\"?([^;\"]*)\"?/)\n if matches\n links[matches[2]] ||= []\n links[matches[2]] << matches[1]\n end\n end\n links\n end",
"title": ""
},
{
"docid": "4d6f938ca82744be3ea7b3c7dc06e4f2",
"score": "0.6015826",
"text": "def get_relationships(rel, filter, offset, limit) \n related_entities = []\n if rel == 'resources'\n related_entities << self.work_meta\n end\n related_entities.each do | rel |\n rel.via = self\n end \n related_entities\n end",
"title": ""
},
{
"docid": "6256873f889187c2b53fb9441184bcfd",
"score": "0.6013238",
"text": "def relations\n return @relations\n end",
"title": ""
},
{
"docid": "6256873f889187c2b53fb9441184bcfd",
"score": "0.6013238",
"text": "def relations\n return @relations\n end",
"title": ""
},
{
"docid": "0034738c0e5eebfef7d9e20acbc74de1",
"score": "0.5995696",
"text": "def get_relations_from_api(api=OSMLib::API::Client.new)\n api.get_relations_referring_to_object(type, self.id.to_i)\n end",
"title": ""
},
{
"docid": "ead77b2a66fecd406e01484950abbd88",
"score": "0.59782064",
"text": "def links\n @links ||= {}\n end",
"title": ""
},
{
"docid": "f4b28e075ce1708d1e7a6852f2ed4687",
"score": "0.5968997",
"text": "def links( params={} )\n links = get_connections(\"links\", params)\n return map_connections links, :to => Facebook::Graph::Link\n end",
"title": ""
},
{
"docid": "f4b28e075ce1708d1e7a6852f2ed4687",
"score": "0.5968997",
"text": "def links( params={} )\n links = get_connections(\"links\", params)\n return map_connections links, :to => Facebook::Graph::Link\n end",
"title": ""
},
{
"docid": "75815341a251c2ee8050723383fe484d",
"score": "0.5961214",
"text": "def get_relationships(rel, filter, offset, limit) \n related_entities = []\n if rel == 'resources'\n related_entities = self.work_metas.find(:all, :limit=>limit, :offset=>offset)\n end\n related_entities.each do | rel |\n rel.via = self\n end \n related_entities\n end",
"title": ""
},
{
"docid": "62d2be18e9b886f29c4c91bd98c3571a",
"score": "0.59605235",
"text": "def relationships\n params[:data][:relationships]\n end",
"title": ""
},
{
"docid": "e6ee3182b690def29c418cd50fbe4147",
"score": "0.5954331",
"text": "def related_urls_by_type doc, type, link_text, label\n link_urls = []\n link_items = nodes_from_path doc, '$..relatedItem[?(@[\"@otherType\"] == \"' + type + '\")]'\n link_items.each do |x|\n node_to_array(x['location']).each do |y|\n link_urls.push related_link_to_obj(y['url'], link_text, label)\n end\n end\n\n link_urls\n end",
"title": ""
},
{
"docid": "28735da6506cceb1aaaa1e4689d81961",
"score": "0.5948402",
"text": "def get_all_links()\n return get_string_array(\"getAllLinks\", [])\n end",
"title": ""
},
{
"docid": "68c05b72c2777ddd8b0e75b5b3eef5a1",
"score": "0.5942705",
"text": "def links\n collection.map(&:link).join(', ')\n end",
"title": ""
},
{
"docid": "8d9ceb5ffed81a985828387362e5211f",
"score": "0.59419245",
"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": "8e8f9c7d88eb73066f2b6c8adf39ad5c",
"score": "0.5940106",
"text": "def links(options = {})\n all_links = relinkly_request(:get, 'links', options)\n all_links.map { |link| Link.new(link) }\n end",
"title": ""
},
{
"docid": "46a7689270980da71bd293ecaf7ff5c8",
"score": "0.59398586",
"text": "def get_hyperlinks\r\n if self.team\r\n links = self.team.get_hyperlinks\r\n else\r\n links = get_hyperlinks_array\r\n end\r\n\r\n return links\r\n end",
"title": ""
},
{
"docid": "c10cf15cc3c1cb39338db5beadd36fcb",
"score": "0.5939727",
"text": "def linked_records(name)\n records = my_relationships(name).map {|instance| instance[1]}\n\n self.class.find_relationship(name)[:is_array] === false ? records.first : records\n end",
"title": ""
},
{
"docid": "71a9c5a9da0f4c76a4fa912b2d71704b",
"score": "0.5926798",
"text": "def pagination_link(relation)\n # split on ',' select the [url] in '<[url]>; rel=\"[relation]\"', compact to all url's found (at most one) and take the first\n (@pagination_links ||= {})[relation] ||= @response.header['Link'] && @response.header['Link'].split(/,\\s*<?/).map{ |link| link[/^\\s*<?(.*?)>?;\\s*rel=\"#{relation.to_s}\"\\s*$/, 1] }.compact.first\n end",
"title": ""
},
{
"docid": "2759cabdcdcfb3c7374df7973fd18fed",
"score": "0.5926096",
"text": "def links\n @links ||= @doc.css('Link').map{|l| Link.new(l)}\n end",
"title": ""
},
{
"docid": "be8beb3d4107fd96154bb4f20acff67c",
"score": "0.5920646",
"text": "def relationships\n client.execute(method: :get, path: '/playlists/relationships')\n end",
"title": ""
},
{
"docid": "4e5963e80c89cf713297f3c0716305fa",
"score": "0.59193337",
"text": "def add_link!\n result['links'] ||= []\n result['links'] << {\n 'url' => response.item_url(result),\n 'note' => response.class.name.rpartition('::')[2],\n }\n end",
"title": ""
},
{
"docid": "14ea80a0479560e6e17cb52310d91142",
"score": "0.5917377",
"text": "def links\n # Research alert!\n # How do you use Nokogiri to extract all the link URLs on a page?\n #\n # These should only be URLs that look like\n # <a href=\"http://somesite.com/page.html\">Click here!</a>\n # This would pull out \"http://somesite.com/page.html\"\n @response.css(\"a\").map { |link| link[\"href\"] }\n end",
"title": ""
},
{
"docid": "666e40ec4e5c92bb24e59f65891ab8aa",
"score": "0.5912683",
"text": "def relationships(params = {})\n response = get('friendships/lookup.json', params)\n Croudia::Object::RelationshipCollection.new(response)\n end",
"title": ""
},
{
"docid": "68df356491281eb812a0e2f6d59d12f3",
"score": "0.5909365",
"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": ""
},
{
"docid": "f0dab99de8213f653091d9118e07efdb",
"score": "0.5907854",
"text": "def get_relationships(rel, filter, offset, limit) \n related_entities = []\n if rel == 'items'\n\n items = Item.find(:all, :conditions=>[\"WORK_ID = ?\", self.WORK_ID], :include=>[:work_meta, :classification, :location, :work], :offset=>offset, :limit=>limit)\n i = {}\n items.each do |item|\n i[item.id] = item\n end\n Loan.find_all_by_ITEM_ID_and_CURRENT_LOAN(i.keys, \"T\").each do |loan|\n i[loan.ITEM_ID].current_loans ||=[]\n i[loan.ITEM_ID].current_loans << loan\n i[loan.ITEM_ID].add_relationship('actor')\n end \n \n items.each do | item | \n next if filter && !item.categories.index(filter)\n related_entities << item \n end\n if self.holdings\n related_entities = related_entities + self.holdings[offset, limit]\n end\n elsif rel == 'collections'\n related_entities = self.collections\n end\n related_entities.each do | rel |\n rel.via = self\n end \n related_entities\n end",
"title": ""
},
{
"docid": "cc4f752cb82cea8257eaf7943d0ddea5",
"score": "0.5907776",
"text": "def get_relation_list(args)\n JSON.parse(\n \tget_the_json(\"#{args[:collection_A]}-#{args[:key_A]}-#{args[:collection_B]}-#{args[:jmc]}-relation\")\n )[args[:list]]\nend",
"title": ""
},
{
"docid": "627a2a1b610895c567b165cca32d7214",
"score": "0.59031457",
"text": "def relationship_list\n return RELATIONSHIP_LIST\n end",
"title": ""
},
{
"docid": "e65227f6ad767bf056e5e5837a443842",
"score": "0.5902215",
"text": "def rels\n @traversal_result = :rels\n self\n end",
"title": ""
},
{
"docid": "46bee24d77915a95e9f2542d0feac636",
"score": "0.5894914",
"text": "def links\n @links ||= @resource_schema.link_schemas.map do |link_schema|\n GeneratorLink.new(link_schema)\n end\n end",
"title": ""
},
{
"docid": "15c70a43c81a3c0ef604d4fe8cb5aa88",
"score": "0.58939964",
"text": "def relations\n @relations ||= {}\n end",
"title": ""
},
{
"docid": "3e372b61bf0bffe32a19fb929d3b6936",
"score": "0.5884188",
"text": "def all_links\n l = self.links\n l[:from][:+] + l[:from][:-] + l[:to][:+] + l[:to][:-]\n end",
"title": ""
},
{
"docid": "fb5d76f4321ffdeda9c42af101002708",
"score": "0.5881024",
"text": "def relations(list_name)\n get \"#{base_url}/lists/#{list_name}/relations\"\n end",
"title": ""
},
{
"docid": "3916969e38d19096f7cc24fb0551a3bb",
"score": "0.587054",
"text": "def linksTo(object, options={})\n if !defined?(@linksTo)\n @linksTo = {}\n end\n\n arguments = [self.fullID]\n\n cmdOptions = {}\n cmdOptions[\"-j\"] = true\n\n if @account\n cmdOptions[\"-T\"] = @account.token\n end\n\n if options.has_key? :order\n cmdOptions[\"--order\"] = options[:order].to_s\n end\n\n if [email protected]_key?(object.uuid)\n cmdOptions[\"-d\"] = object.fullID\n result = Occam::Worker.perform(\"links\", \"list\", arguments, cmdOptions)\n\n ret = JSON.parse(result[:data], :symbolize_names => true)\n\n @linksTo[object.uuid] = {}\n ret.map do |link|\n if not @linksTo[object.uuid].has_key? link[:relationship]\n @linksTo[object.uuid][link[:relationship]] = []\n end\n @linksTo[object.uuid][link[:relationship]] <<\n Occam::Link.new(:source => self,\n :target => Occam::Object.new(:uuid => link[:id], :info => link, :revision => link[:revision], :link => link[:local_link_id], :account => @account),\n :relationship => link[:relationship],\n :local_link_id => link[:local_link_id],\n :account => @account,\n :id => link[:id])\n end\n end\n\n @linksTo[object.uuid]\n end",
"title": ""
},
{
"docid": "2168d4cc9e9a63f0cf9b39e70699257e",
"score": "0.5869004",
"text": "def relations\n @relations ||= _map_relations\n end",
"title": ""
},
{
"docid": "d98dc585cbf5d6254f96c299fdf46dd1",
"score": "0.58668697",
"text": "def find_link_by_relation(rel)\n links = self.associations['links'] # links to other resources\n return links.select { |k| k['rel'] == rel }[0]\n end",
"title": ""
}
] |
30adea292b7350819d8556be3c187f9c
|
Initialize this instance by pushing its initial context into the binding stack. If no target is given, start at the top level. source://pry//lib/pry/pry_instance.rb118
|
[
{
"docid": "387500ee64ab4166b191ab2a5ecaa429",
"score": "0.62641376",
"text": "def push_initial_binding(target = T.unsafe(nil)); end",
"title": ""
}
] |
[
{
"docid": "58e338a8114f9b717b07ed2360f413c0",
"score": "0.6788859",
"text": "def initialize(context={})\n self.context = context\n self.target = context[:target]\n self.output = context[:output]\n self.eval_string = context[:eval_string]\n self.command_set = context[:command_set]\n self._pry_ = context[:pry_instance]\n end",
"title": ""
},
{
"docid": "03ce5729f80219dba55eb6c01bfe4251",
"score": "0.5953299",
"text": "def initialize(target, context = nil)\n @target = target\n @context = context || target.context\n end",
"title": ""
},
{
"docid": "afa2eb0c4d2b888f55ae355d65c1a836",
"score": "0.5920237",
"text": "def initialize(target)\n @target = target\n @queue_for_commands = Queue.new\n @binding = TOPLEVEL_BINDING.dup\n @underscore_assigner = eval(\"_ = nil; proc { |val| _ = val }\", @binding)\n @thread = Thread.new { run }\n end",
"title": ""
},
{
"docid": "278ec034f144d3f986cd649f3e1f7a92",
"score": "0.588249",
"text": "def run_pry\n binding.pry\n end",
"title": ""
},
{
"docid": "b181f9ac5ebe20caeb365a4770b2513d",
"score": "0.5831589",
"text": "def initialize(options={})\n refresh(options)\n\n @binding_stack = []\n @indent = Pry::Indent.new\n @command_state = {}\n end",
"title": ""
},
{
"docid": "7ff199a4806d074d83688558f5b4af0c",
"score": "0.5776706",
"text": "def on_pry\n binding.pry\n end",
"title": ""
},
{
"docid": "cfe5a834f87a505705593a4358cfabc8",
"score": "0.57640165",
"text": "def _pry_=(_arg0); end",
"title": ""
},
{
"docid": "cfe5a834f87a505705593a4358cfabc8",
"score": "0.57640165",
"text": "def _pry_=(_arg0); end",
"title": ""
},
{
"docid": "61eeb66d79f855342c7ee3abc0072457",
"score": "0.56751394",
"text": "def resume_pry(context)\n new_binding = context.frame_binding(0)\n\n run(false) do\n if @pry\n @pry.repl(new_binding)\n else\n @pry = Pry.start_without_pry_byebug(new_binding)\n end\n end\n end",
"title": ""
},
{
"docid": "7315230ae53dcf08fb2c6fc18dac6d27",
"score": "0.56523556",
"text": "def binding_stack=(_arg0); end",
"title": ""
},
{
"docid": "7315230ae53dcf08fb2c6fc18dac6d27",
"score": "0.56523556",
"text": "def binding_stack=(_arg0); end",
"title": ""
},
{
"docid": "1a857f87e3b373fa29c47879ca626b91",
"score": "0.56482315",
"text": "def resume_pry(context)\n new_binding = context.frame_binding(0)\n Debugger.stop unless @always_enabled\n\n @pry.binding_stack.clear\n run(false) do\n @pry.repl new_binding\n end\n end",
"title": ""
},
{
"docid": "f967b466f72a4f5fcfa2a9439f66142a",
"score": "0.562432",
"text": "def pry!\n setup_modules_to(TOPLEVEL_BINDING.eval('self'))\n end",
"title": ""
},
{
"docid": "6da27fdafa225afd23e30b36581969e5",
"score": "0.5577892",
"text": "def context\n return @target if @target.is_a?(Module) and not @options[:class_methods]\n\n class << @target\n self\n end\n end",
"title": ""
},
{
"docid": "6da27fdafa225afd23e30b36581969e5",
"score": "0.5577892",
"text": "def context\n return @target if @target.is_a?(Module) and not @options[:class_methods]\n\n class << @target\n self\n end\n end",
"title": ""
},
{
"docid": "3421db3d9cc6f080f7a6992d06a4e917",
"score": "0.5562671",
"text": "def run_pry\n binding.pry\n\n # the seemingly useless line below is needed to avoid pry's exiting\n # (see https://github.com/deivid-rodriguez/pry-byebug/issues/45)\n _a = nil\n end",
"title": ""
},
{
"docid": "3421db3d9cc6f080f7a6992d06a4e917",
"score": "0.5562671",
"text": "def run_pry\n binding.pry\n\n # the seemingly useless line below is needed to avoid pry's exiting\n # (see https://github.com/deivid-rodriguez/pry-byebug/issues/45)\n _a = nil\n end",
"title": ""
},
{
"docid": "fc6ed157472225a295bd97e87f81b567",
"score": "0.5465117",
"text": "def initialize(context = nil)\n\t\t\tbname = Bindings.get_bname(self.class.short_name)\n\n\t\t\t@ptr =\n\t\t\tif context\n\t\t\t\tBindings.send((bname.to_s + '_in_context').to_sym, check_type(context, Context, 'context'))\n\t\t\telse\n\t\t\t\tBindings.send(bname)\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "dfbc113b611c1f8c92ec9151ded77040",
"score": "0.5442217",
"text": "def instr_load_self\n @stack.push current_scope.context\n end",
"title": ""
},
{
"docid": "ca2e6da3655385cca3619b6485426f39",
"score": "0.54164416",
"text": "def initialize( * )\n\t\tself.class.dump_application_stack\n\t\tsuper\n\tend",
"title": ""
},
{
"docid": "562f24119748ae20722f2cb77ff5e644",
"score": "0.53991216",
"text": "def bind_to kwargs={}\n loc = Rubinius::VM.backtrace(kwargs.fetch(:call_depth, 1), true).first\n @constant_scope = kwargs[:cscope] || loc.constant_scope\n @variable_scope = kwargs[:vscope] || loc.variables\n @receiver = kwargs[:receiver] || loc.instance_variable_get(:@receiver)\n \n self\n end",
"title": ""
},
{
"docid": "50a9bead22119f5a75b164f72abeb1ff",
"score": "0.53597254",
"text": "def initialize(initial_scope={})\n @stack = []\n @filters = {}\n @functional_variables = {}\n @blocks = {}\n @loaders = []\n @whiny_template_loading = false\n\n push initial_scope\n end",
"title": ""
},
{
"docid": "a570e605a0fdc31f17a2b3f4a14ffd2a",
"score": "0.5345879",
"text": "def initialize initial=nil\n @stack = [initial || {}]\n end",
"title": ""
},
{
"docid": "493d092c3e4bbb1308e89cce8439a205",
"score": "0.53288996",
"text": "def create\n binding.pry\n end",
"title": ""
},
{
"docid": "27430d89db28f1dd50b9f2a82c3e76db",
"score": "0.53224987",
"text": "def push_context\n @context_stack << [\n @element_map.deep_dup,\n @context_uri.deep_dup,\n @namespace_map.deep_dup,\n @class_map.deep_dup\n ]\n end",
"title": ""
},
{
"docid": "65649b76498dbe01012840aa73fef954",
"score": "0.5319693",
"text": "def initialize()\n @stack = []\n end",
"title": ""
},
{
"docid": "65649b76498dbe01012840aa73fef954",
"score": "0.5319693",
"text": "def initialize()\n @stack = []\n end",
"title": ""
},
{
"docid": "4ef0c226d5bd38c810c94982461b8b16",
"score": "0.5304825",
"text": "def initialize(initial_hash = nil)\n super\n @optional_method_names = %i[breakpoints lines sourceModified]\n end",
"title": ""
},
{
"docid": "a2c5f56727aa5204db1aeb2ae6863d2e",
"score": "0.52774334",
"text": "def initialize(ctx = nil, &block)\n self.root = Saxxy::Context.new\n @ctx = ctx || eval(\"self\", block.binding)\n eval_subtree!(&block)\n end",
"title": ""
},
{
"docid": "4c1a348639c21de1ce8e895248aca1ea",
"score": "0.5272091",
"text": "def binding_stack; end",
"title": ""
},
{
"docid": "4c1a348639c21de1ce8e895248aca1ea",
"score": "0.5272091",
"text": "def binding_stack; end",
"title": ""
},
{
"docid": "2d2fbd8b3b518178a0602172f1c0cfe1",
"score": "0.5269084",
"text": "def initialize(target)\n \n self.target=target\n self.parent=target.parent\n super()\n end",
"title": ""
},
{
"docid": "543108fce3216b6f1d21f0883acccdb0",
"score": "0.5268311",
"text": "def initialize &blok\n @code = []\n @target = @code\n @indent = []\n instance_eval(&blok) if blok\n end",
"title": ""
},
{
"docid": "c10b0554d6297c6ab72532408564de73",
"score": "0.52673656",
"text": "def breakpoint\n binding.pry\n end",
"title": ""
},
{
"docid": "f9a9fc795ee97796ad93881820361eae",
"score": "0.52669686",
"text": "def setup\n @hooks = Pry::Hooks.new\n\n @hooks.add_hook :before_eval, :pry_remote_capture do\n capture_output\n end\n\n @hooks.add_hook :after_eval, :pry_remote_uncapture do\n uncapture_output\n end\n\n # Before Pry starts, save the pager config.\n # We want to disable this because the pager won't do anything useful in\n # this case (it will run on the server).\n Pry.config.pager, @old_pager = false, Pry.config.pager\n\n # As above, but for system config\n Pry.config.system, @old_system = PryRemote::System, Pry.config.system\n\n Pry.config.editor, @old_editor = editor_proc, Pry.config.editor\n end",
"title": ""
},
{
"docid": "db65a8d59f3f9ee8bf470a08525914c0",
"score": "0.52528286",
"text": "def repl_prologue(target)\n exec_hook :before_session, output, target, self\n set_last_result(nil, target)\n\n @input_array << nil # add empty input so _in_ and _out_ match\n\n binding_stack.push target\n end",
"title": ""
},
{
"docid": "a2d8a48e47795cff18aeec2675ad2a26",
"score": "0.5248642",
"text": "def debug\n stored_binding.pry\n end",
"title": ""
},
{
"docid": "7c38588bfc67601bc3b6fe997c79ce7d",
"score": "0.5235324",
"text": "def initialize(context = nil)\n @context = context\n @hash_context_depth = 0\n end",
"title": ""
},
{
"docid": "1a59e36033f052a0f5a0eec9e84243d5",
"score": "0.5228492",
"text": "def initialize\n add_to_stack(123)\n puts take_from_stack\n end",
"title": ""
},
{
"docid": "78ce7d18a5a3a6cb7df478ab63a36bef",
"score": "0.5224805",
"text": "def pre_context=(_arg0); end",
"title": ""
},
{
"docid": "7ddd780e2911db60fba56a5eb1fbd090",
"score": "0.52171963",
"text": "def initialize # ??? WIP - rename to initialize_context\r\n @contexts = []\r\n @sym_map = nil\r\n @buffer = nil\r\n @debug_buffer = 'Not setup yet.'\r\n @info = Hash.new # ??? WIP - why did I do this again?\r\n end",
"title": ""
},
{
"docid": "fd6ac10daa78d58bfd36d5d1fff4d9a5",
"score": "0.52077425",
"text": "def initialize(target)\n @target = target\n end",
"title": ""
},
{
"docid": "59b9f5f6b315d28129088be661a29f71",
"score": "0.51995414",
"text": "def initialize\n reset_stack\n reset_entry_point_map\n end",
"title": ""
},
{
"docid": "51140a51b4e3e768597b9ae8b8f7f7c7",
"score": "0.5198427",
"text": "def initialize(_options = {}, &block)\n @options = {}\n @stack = []\n instance_eval(&block) if block\n end",
"title": ""
},
{
"docid": "4c3353dbe0b322cdaf874afa463f1523",
"score": "0.5197271",
"text": "def repl(target=TOPLEVEL_BINDING)\n target = Pry.binding_for(target)\n\n repl_prologue(target)\n\n break_data = nil\n exception = catch(:raise_up) do\n break_data = catch(:breakout) do\n loop do\n throw(:breakout) if binding_stack.empty?\n rep(binding_stack.last)\n end\n end\n exception = false\n end\n\n raise exception if exception\n\n break_data\n ensure\n repl_epilogue(target)\n end",
"title": ""
},
{
"docid": "c6ea09e60788d1f9a96c53e028610963",
"score": "0.5193454",
"text": "def debug\n binding.pry\n end",
"title": ""
},
{
"docid": "c6ea09e60788d1f9a96c53e028610963",
"score": "0.5193454",
"text": "def debug\n binding.pry\n end",
"title": ""
},
{
"docid": "c6ea09e60788d1f9a96c53e028610963",
"score": "0.5193454",
"text": "def debug\n binding.pry\n end",
"title": ""
},
{
"docid": "c6ea09e60788d1f9a96c53e028610963",
"score": "0.5193454",
"text": "def debug\n binding.pry\n end",
"title": ""
},
{
"docid": "f1b2a272151797f73c3ebaeea9a03f0f",
"score": "0.5181404",
"text": "def initialize(target)\n @target = target\n end",
"title": ""
},
{
"docid": "557c71f9e2025cda70460d5a021f98c2",
"score": "0.516632",
"text": "def debug\n binding.pry\nend",
"title": ""
},
{
"docid": "0e7c58d505d8ac306927cc243620d95d",
"score": "0.51602304",
"text": "def initialize\n @executed_blueprints = @global_executed_blueprints = []\n @auto_iv_list = Set.new\n\n super '', Context.new\n end",
"title": ""
},
{
"docid": "da13294e607a9559b46842f8222e907e",
"score": "0.51466095",
"text": "def initialize target\n @target = target\n end",
"title": ""
},
{
"docid": "1aeca961a205fe773522764aeff6110f",
"score": "0.5138853",
"text": "def initialize(target)\n @target = target\n end",
"title": ""
},
{
"docid": "8b54b39442f70046f436c0d7f1e576e5",
"score": "0.5135727",
"text": "def initialize(*args)\r\n super\r\n self.original_context = context\r\n self.context = adjusted_context(name)\r\n end",
"title": ""
},
{
"docid": "72028260ec636a2ed6d1613129e6305d",
"score": "0.51355165",
"text": "def build_top(base,*args)\n # Fills its namespace with the content of the base scope\n # (this latter may already contains access points if it has been\n # opended for extension previously).\n @namespace.concat_namespace(base.namespace)\n High.space_push(@namespace)\n # Execute the instantiation block\n base.parent.each_instance_proc do |instance_proc|\n @return_value = High.top_user.instance_exec(*args,&instance_proc)\n end\n High.space_pop\n end",
"title": ""
},
{
"docid": "2806bb1619da26b3a2bf1f2c1cecaa3c",
"score": "0.5133373",
"text": "def initialize(bind)\n @@index += 1\n @binding = bind\n @buf, @hist = [], []\n @line, @file = bind.eval(\"[__LINE__, __FILE__]\")\n\n # This is normally used for the test's description. It's not a strict \n # requirement of an adapter, but will be set and shown if present.\n @header = ORB::Adapter.header(bind) if ORB::Adapter.respond_to?(:header)\n puts \"\\n\\n[[ #{@header} ]]\" if @header\n \n # Gentlemen, start your REPLs.\n orb_it_up\n end",
"title": ""
},
{
"docid": "154b6df37c562dc5cfdd82110896d984",
"score": "0.5130536",
"text": "def Testing\n binding.pry\n end",
"title": ""
},
{
"docid": "45093999dd7e86f9f0bd8d0388118888",
"score": "0.5126995",
"text": "def initialize(options = {})\n @lazy = !!options[:lazy]\n @continuations = !!options[:continuations]\n @hygienic = !options[:unhygienic]\n \n @top_level = Scope.new(self)\n @user_scope = Scope.new(@top_level)\n @stack = stackless? ? Stackless.new : Stack.new\n \n load_builtins(options)\n @start_time = Time.now.to_f\n end",
"title": ""
},
{
"docid": "658fa46584b018ebcf0ff7e10ffe9101",
"score": "0.51256865",
"text": "def initialize(context, exp)\n @context = context\n @exp = exp\n end",
"title": ""
},
{
"docid": "fab831914c71793dd215fce0f613be35",
"score": "0.51232225",
"text": "def initialize(initial_scope = {})\n push initial_scope\n end",
"title": ""
},
{
"docid": "25ea6a317ce2b2172851cd476a082233",
"score": "0.5112194",
"text": "def interactive_mode(pry_instance); end",
"title": ""
},
{
"docid": "25ea6a317ce2b2172851cd476a082233",
"score": "0.5112194",
"text": "def interactive_mode(pry_instance); end",
"title": ""
},
{
"docid": "a69e095ec1f8e957cba601d5473b684a",
"score": "0.5100663",
"text": "def initialize\n return if ENV['GUARD_ENV'] == 'test'\n\n Pry.config.should_load_rc = false\n Pry.config.should_load_local_rc = false\n Pry.config.history.file = File.expand_path(self.class.options[:history_file] || HISTORY_FILE)\n\n @stty_exists = nil\n _add_hooks\n\n _replace_reset_command\n _create_run_all_command\n _create_command_aliases\n _create_guard_commands\n _create_group_commands\n\n _configure_prompt\n end",
"title": ""
},
{
"docid": "480e09882e78d387c1e35ed619da1bf1",
"score": "0.5091941",
"text": "def ctx\n binding\n end",
"title": ""
},
{
"docid": "480e09882e78d387c1e35ed619da1bf1",
"score": "0.5091941",
"text": "def ctx\n binding\n end",
"title": ""
},
{
"docid": "17e44c59e634c3226d95bfb2ccc4756c",
"score": "0.50874317",
"text": "def initialize\n\t\tp \"Initializing new puppy instance ...\"\n\tend",
"title": ""
},
{
"docid": "64595cf07cbf0a36d7c7b0170b3f2a54",
"score": "0.50838006",
"text": "def initialize(target)\n @target = target\n end",
"title": ""
},
{
"docid": "64595cf07cbf0a36d7c7b0170b3f2a54",
"score": "0.50838006",
"text": "def initialize(target)\n @target = target\n end",
"title": ""
},
{
"docid": "64595cf07cbf0a36d7c7b0170b3f2a54",
"score": "0.50838006",
"text": "def initialize(target)\n @target = target\n end",
"title": ""
},
{
"docid": "c7dc92a01949b5f943653f9615d76152",
"score": "0.50823575",
"text": "def toplevel_binding; binding; end",
"title": ""
},
{
"docid": "6d9dea6dffe0a983e77a5fc657ef466f",
"score": "0.5080112",
"text": "def init(base, target)\n @base = base\n @target = target\n end",
"title": ""
},
{
"docid": "8c7712ee46d807040d844f36760f9294",
"score": "0.5072782",
"text": "def initialize()\n @_output = \"\"\n @_stack = []\n @_current = nil\n\n self.class.strings_injector.inject_to self\n\n # tag classes initialization\n tags.each do |klass|\n instance_variable_set(:\"@_#{klass}\", self.class.dynamic_classes[camelize_string(klass).to_sym].new(self))\n end\n end",
"title": ""
},
{
"docid": "6c0f9c6c16123144a1200abd6c6827f9",
"score": "0.5063526",
"text": "def initialize_with_binding_of_caller(*args)\n unless Thread.current[:__web_console_exception_lock]\n Thread.current[:__web_console_exception_lock] = true\n begin\n @bindings = binding.callers.drop(2)\n\n # When explicitly raising an exception, we have to drop one more frame\n # on Rubinius. The way we do it is pretty bad as it strongly depends on\n # the Kerner#raise implementation details. We need to do better in the\n # future.\n if _ = @bindings.first and _.eval('local_variables') == [:exc, :msg, :ctx, :skip, :loc, :pos]\n @bindings.shift\n end\n ensure\n Thread.current[:__web_console_exception_lock] = false\n end\n end\n\n initialize_without_binding_of_caller(*args)\n end",
"title": ""
},
{
"docid": "96ad3bc5d20deb148daabc17a73c670f",
"score": "0.5061359",
"text": "def initialize(*args)\n # setup a node stack with the given output obj\n @_undies_io = if args.last.kind_of?(Undies::IO)\n args.pop\n else\n raise ArgumentError, \"please provide an IO object\"\n end\n\n # apply any given data to template scope as instance variables\n (args.last.kind_of?(::Hash) ? args.pop : {}).each do |k, v|\n self.instance_variable_set(\"@#{k}\", v)\n end\n\n # push a root node onto the IO\n @_undies_io.push!(RootNode.new(@_undies_io)) if @_undies_io.empty?\n\n # if given some source, build it\n if args.last.kind_of?(Source)\n # setup a source stack with the given source\n @_undies_source_stack = SourceStack.new(args.pop)\n\n # yield to recursivley render the source stack\n __yield\n\n # flush any elements that need to be built\n __flush\n end\n\n end",
"title": ""
},
{
"docid": "df349be7ac011d439c9335beec48fa79",
"score": "0.50563836",
"text": "def on_hook_before_pops_evaluate(args)\n # If the debug session is paused no need to process\n return if @debug_session.flow_control.session_paused?\n\n @debug_session.puppet_session_state.actual.increment_pops_depth\n\n target = args[1]\n # Ignore this if there is no positioning information available\n return unless target.is_a?(Puppet::Pops::Model::Positioned)\n target_loc = @debug_session.get_location_from_pops_object(target)\n\n # Even if it's positioned, it can still contain invalid information. Ignore it if\n # it's missing required information. This can happen when evaluting strings (e.g. watches from VSCode)\n # i.e. not a file on disk\n return if target_loc.file.nil? || target_loc.file.empty?\n target_classname = @debug_session.get_puppet_class_name(target)\n ast_classname = get_ast_class_name(target)\n\n # Break if we hit a specific puppet function\n if target_classname == 'CallNamedFunctionExpression' && @debug_session.breakpoints.function_breakpoint_names.include?(target.functor_expr.value)\n # Re-raise the hook as a breakpoint\n @debug_session.execute_hook(:hook_function_breakpoint, [target.functor_expr.value, ast_classname] + args)\n return\n end\n\n # Check for Source based breakpoints\n unless target_loc.length.zero? || EXCLUDED_CLASSES.include?(target_classname)\n line_breakpoints = @debug_session.breakpoints.line_breakpoints(target_loc.file)\n\n # Calculate the start and end lines of the target\n target_start_line = target_loc.line\n target_end_line = @debug_session.line_for_offset(target, target_loc.offset + target_loc.length)\n\n # TODO: What about Hit and Conditional BreakPoints?\n bp = line_breakpoints.find_index { |bp_line| bp_line >= target_start_line && bp_line <= target_end_line }\n unless bp.nil?\n # Re-raise the hook as a breakpoint\n @debug_session.execute_hook(:hook_breakpoint, [ast_classname, ''] + args)\n return\n end\n end\n\n # Break if we are stepping\n case @debug_session.flow_control.run_mode.mode\n when :stepin\n # Stepping-in is basically break on everything\n # Re-raise the hook as a step breakpoint\n @debug_session.execute_hook(:hook_step_breakpoint, [ast_classname, ''] + args)\n when :next\n # Next will break on anything at this Pop depth or shallower than this Pop depth. Re-raise the hook as a step breakpoint\n depth = @debug_session.flow_control.run_mode.options[:pops_depth_level] || -1\n if @debug_session.puppet_session_state.actual.pops_depth_level <= depth # rubocop:disable Style/IfUnlessModifier\n @debug_session.execute_hook(:hook_step_breakpoint, [ast_classname, ''] + args)\n end\n when :stepout\n # Stepping-Out will break on anything shallower than this Pop depth. Re-raise the hook as a step breakpoint\n depth = @debug_session.flow_control.run_mode.options[:pops_depth_level] || -1\n if @debug_session.puppet_session_state.actual.pops_depth_level < depth # rubocop:disable Style/IfUnlessModifier\n @debug_session.execute_hook(:hook_step_breakpoint, [ast_classname, ''] + args)\n end\n end\n nil\n end",
"title": ""
},
{
"docid": "f6060f3f26b7951e57dbaa3a347c2e40",
"score": "0.5052111",
"text": "def initialize tracker = nil, file_name = nil\n super()\n @env = SexpProcessor::Environment.new\n @inside_if = false\n @ignore_ifs = nil\n @exp_context = []\n @current_module = nil\n @tracker = tracker # set in subclass as necessary\n @helper_method_cache = {}\n @helper_method_info = Hash.new({})\n @or_depth_limit = (tracker && tracker.options[:branch_limit]) || 5 # arbitrary default\n @meth_env = nil\n @file_name = file_name\n set_env_defaults\n end",
"title": ""
},
{
"docid": "d82e335f885022d50556f5c5c792a5aa",
"score": "0.50496453",
"text": "def initialize\n @stack = []\n end",
"title": ""
},
{
"docid": "2aea04d4971256233b697837f7472c17",
"score": "0.5048722",
"text": "def initialize context\n @context = context\n end",
"title": ""
},
{
"docid": "89fc09a39451fa1147fe7660af84f233",
"score": "0.5045854",
"text": "def toplevel_binding=(_arg0); end",
"title": ""
},
{
"docid": "89fc09a39451fa1147fe7660af84f233",
"score": "0.5045854",
"text": "def toplevel_binding=(_arg0); end",
"title": ""
},
{
"docid": "2d9dae549fadf48aadb71d08b3677f6c",
"score": "0.50387114",
"text": "def context=(_arg0); end",
"title": ""
},
{
"docid": "2d9dae549fadf48aadb71d08b3677f6c",
"score": "0.50387114",
"text": "def context=(_arg0); end",
"title": ""
},
{
"docid": "2d9dae549fadf48aadb71d08b3677f6c",
"score": "0.50387114",
"text": "def context=(_arg0); end",
"title": ""
},
{
"docid": "2d9dae549fadf48aadb71d08b3677f6c",
"score": "0.50387114",
"text": "def context=(_arg0); end",
"title": ""
},
{
"docid": "2d9dae549fadf48aadb71d08b3677f6c",
"score": "0.50387114",
"text": "def context=(_arg0); end",
"title": ""
},
{
"docid": "2d9dae549fadf48aadb71d08b3677f6c",
"score": "0.50387114",
"text": "def context=(_arg0); end",
"title": ""
},
{
"docid": "10cd26dd9656c13c0bf260592723c9f9",
"score": "0.5034016",
"text": "def bind_to( target )\n @@target = target\n end",
"title": ""
},
{
"docid": "1ef9f321617ba5e681cb2d175dfb14de",
"score": "0.5032736",
"text": "def initialize(caller_binding)\n @caller = caller_binding.eval 'self'\n end",
"title": ""
},
{
"docid": "b797b67117964f8e53215c164a12854a",
"score": "0.5031791",
"text": "def initialize(pbind)\n @pbind = pbind\n @__layout_args = []\n @__metadata = []\n yield self if block_given?\n end",
"title": ""
},
{
"docid": "487862ad95cad83168608d771bd5bc1e",
"score": "0.5029786",
"text": "def initialize(target = nil)\r\n @target, @actions = target, []\r\n yield self if block_given?\r\n end",
"title": ""
},
{
"docid": "8175ea272187ea174e767da5f2fffa3e",
"score": "0.50213367",
"text": "def initialize context\n @context = context\n end",
"title": ""
},
{
"docid": "9fe11b1b6b9b95ea5153561a68d0f3bf",
"score": "0.5016879",
"text": "def initialize(target)\n super(target.platform)\n @target = target\n end",
"title": ""
},
{
"docid": "e0efd9c25f8b376e88030bd41c80ffd9",
"score": "0.5013266",
"text": "def test\n a = \"hello\"\n binding.pry\nend",
"title": ""
},
{
"docid": "502dea8127bddfd63e5b756680a3cd8f",
"score": "0.5010722",
"text": "def initialize\n @context = self.class.current_context\n @main = @context.main_context\n @scope = []\n @rewriters = {}\n @query_builders = {}\n end",
"title": ""
},
{
"docid": "0ac86721048d5b768dd8da2b891ea83b",
"score": "0.5006486",
"text": "def __init__( context )\n compiler = MethodCompiler.compiler_for_class(:Object,:__init__ ,\n Parfait::NamedList.type_for({}) , Parfait::NamedList.type_for({}))\n builder = compiler.builder(compiler.source)\n builder.build do\n factory! << Parfait.object_space.get_factory_for(:Message)\n message << factory[:next_object]\n next_message! << message[:next_message]\n factory[:next_object] << next_message\n end\n\n Mom::MessageSetup.new(Parfait.object_space.get_main).build_with( builder )\n\n builder.build do\n message << message[:next_message]\n space? << Parfait.object_space\n message[:receiver] << space\n end\n\n exit_label = Risc.label(compiler.source , \"#{compiler.receiver_type.object_class.name}.#{compiler.source.name}\" )\n ret_tmp = compiler.use_reg(:Label).set_builder(builder)\n builder.build do\n ret_tmp << exit_label\n message[:return_address] << ret_tmp\n add_code Risc.function_call( \"__init__ issue call\" , Parfait.object_space.get_main)\n add_code exit_label\n end\n compiler.reset_regs\n exit_sequence(builder)\n return compiler\n end",
"title": ""
},
{
"docid": "d53f0e2d02ebaf443eddba590181d822",
"score": "0.5003818",
"text": "def automatic_context=(_arg0); end",
"title": ""
},
{
"docid": "1129dc6fb60fa2a3c7672a226b690c9b",
"score": "0.4995439",
"text": "def initialize(target_object)\n @commands = {}\n @target_object = target_object\n end",
"title": ""
},
{
"docid": "b8942ffaf0a664016ce8e3f31cb56a03",
"score": "0.49900532",
"text": "def check_file_context\n unless PryDebugger.check_file_context(target)\n raise Pry::CommandError, 'Cannot find local context. Did you use `binding.pry`?'\n end\n end",
"title": ""
}
] |
e11e782be5533698a2ee8a61db9f7177
|
How many blocks are we hashing per second? This will be zero unless we're trying to generate a block.
|
[
{
"docid": "aeaf64e18da9581b2c09756e3b72ddd1",
"score": "0.6609969",
"text": "def hashes_per_second\n\t\t\[email protected]()\n\t\tend",
"title": ""
}
] |
[
{
"docid": "59d1487d1044314c42e5d1826df2c88c",
"score": "0.7849956",
"text": "def blocks_needed\n (key_length.to_f / hash_function.digest_length).ceil\n end",
"title": ""
},
{
"docid": "3df60a52d9aec6b671f997ec298edc2d",
"score": "0.76360583",
"text": "def block_length\n @sha2.block_length\n end",
"title": ""
},
{
"docid": "115059b3340038aa954bd2c7e1e3a113",
"score": "0.74497837",
"text": "def block_length\n # See function: c_digest_block_length(...) in ext/sha3/_digest.c\n end",
"title": ""
},
{
"docid": "3cf77cbec768d8d61a9f5b95dcdca750",
"score": "0.7355089",
"text": "def block_count\n (record_count.to_f / Constants::BLOCKING_FACTOR).ceil\n end",
"title": ""
},
{
"docid": "87197b6aa5c4e6717c9fa793d6ae4f5e",
"score": "0.71345276",
"text": "def block_size(*) end",
"title": ""
},
{
"docid": "4e5ba670316d40b5ef49be330a8ff38d",
"score": "0.70740277",
"text": "def block_length\n length_ptr = FFI::MemoryPointer.new(:size_t)\n Botan.call_ffi(:botan_hash_block_size, @ptr, length_ptr)\n length_ptr.read(:size_t)\n end",
"title": ""
},
{
"docid": "668a125894129bd537860c6ca9d9d788",
"score": "0.7039563",
"text": "def block_count\n @block_count\n end",
"title": ""
},
{
"docid": "668a125894129bd537860c6ca9d9d788",
"score": "0.7039563",
"text": "def block_count\n @block_count\n end",
"title": ""
},
{
"docid": "4109f78ce726c5300ba27252aaeabe84",
"score": "0.70186627",
"text": "def block_size; end",
"title": ""
},
{
"docid": "4109f78ce726c5300ba27252aaeabe84",
"score": "0.70186627",
"text": "def block_size; end",
"title": ""
},
{
"docid": "fc47d7830f46f72af880115fe97b9498",
"score": "0.6981083",
"text": "def num_blocks\n n = @commits.size / @commits_per_block\n n += 1 if @yield_remainder && n * @commits_per_block < @commits.size\n n\n end",
"title": ""
},
{
"docid": "3c37644ec7d1b74e6b8ead6a56700994",
"score": "0.6959606",
"text": "def block_size\n @block_size\n end",
"title": ""
},
{
"docid": "3c37644ec7d1b74e6b8ead6a56700994",
"score": "0.6959606",
"text": "def block_size\n @block_size\n end",
"title": ""
},
{
"docid": "c8a8f827cad97ca79d29469777e9d1d5",
"score": "0.6912023",
"text": "def load_factor\n @hash_count / self.size.to_f\n end",
"title": ""
},
{
"docid": "deff3f23898b48652dab638135db6e3f",
"score": "0.6892084",
"text": "def block_length; end",
"title": ""
},
{
"docid": "8a6c4675ca20a592056760df626be509",
"score": "0.68668723",
"text": "def block_length\n 16\n end",
"title": ""
},
{
"docid": "56761c00c138c3eb32031bf56905cf15",
"score": "0.68079895",
"text": "def block_size\n \n end",
"title": ""
},
{
"docid": "d7c87f2f5fa79d76af7a73fc4c5d3c5e",
"score": "0.6706771",
"text": "def block_length(input_len)\n beta = (input_len / 2.0).ceil\n ((beta * Math.log(@radix) / Math.log(2)).ceil / 8.0).ceil\n end",
"title": ""
},
{
"docid": "2558bbc9c48ab63a0b9cbfdfc7163766",
"score": "0.6697954",
"text": "def block_size\n trial_byte = \"N\"\n block_length = 1\n found = false\n prev_res = \"\"\n\n while not found\n res = @oracle.encrypt(trial_byte * block_length)[0..15]\n if res == prev_res\n found = true\n block_length -= 1\n else\n prev_res = res\n block_length += 1\n end\n end\n\n return block_length\n end",
"title": ""
},
{
"docid": "a0b6f42152a4a27f246201d3b47ef286",
"score": "0.6647779",
"text": "def block_length\n 1\n end",
"title": ""
},
{
"docid": "d12b93639af50079c7a63a25a8ba8ef5",
"score": "0.6595156",
"text": "def byte_length\n @blocks.inject(0) { |c , block| c += block.byte_length }\n end",
"title": ""
},
{
"docid": "00953b90413ae6ca4d58179cbc110376",
"score": "0.6580893",
"text": "def block_length\n self.class::BLOCK_LENGTH\n end",
"title": ""
},
{
"docid": "cf1102777f7b1a0d3525f1f407e8bdd1",
"score": "0.6575534",
"text": "def bytes_total\n blocks * block_size\n end",
"title": ""
},
{
"docid": "57dc369b3933795d8781ace59bef1c6d",
"score": "0.65697086",
"text": "def blocks_per_line(cache_line_size)\n (cache_line_size + transfer_size - 1) / transfer_size\n end",
"title": ""
},
{
"docid": "9dc0e4a2133961c0ee768973ceccb95d",
"score": "0.6527031",
"text": "def block_count\n\t\t\[email protected]()\n\t\tend",
"title": ""
},
{
"docid": "9e7eac8bd468b08ab74ea840d3f4ef8c",
"score": "0.65196615",
"text": "def hash_byte_size\n return 20\n end",
"title": ""
},
{
"docid": "b4822292d54a766ade4eec3892bf0ef3",
"score": "0.6514302",
"text": "def getblockcount\n bitcoin.getblockcount\n end",
"title": ""
},
{
"docid": "78724e301d7aed2d1c2e4e45b0f3fb00",
"score": "0.6497027",
"text": "def height\n RemoteNode.rpc 'getblockcount'\n end",
"title": ""
},
{
"docid": "cc142a3bb24f8f8973608beeca347cc3",
"score": "0.6479014",
"text": "def size\n @blocks.size\n end",
"title": ""
},
{
"docid": "ff24f587c929350b7e712e9bb0320027",
"score": "0.64690554",
"text": "def blocks_status\n blks = blocks[0..9]\n blocks_ideal = (Time.now - blks.last[:time]) / block_time\n {\n count: blks.size,\n count_target: blocks_ideal.round(1),\n }\n end",
"title": ""
},
{
"docid": "ac6d2d9aa58a4e072a785957bcebc7ad",
"score": "0.64673585",
"text": "def num_blocks\n self[:num_blocks]\n end",
"title": ""
},
{
"docid": "7294e2ba06d403380da3b9ec420286ce",
"score": "0.6433368",
"text": "def total_bytes\n total_blocks * block_size\n end",
"title": ""
},
{
"docid": "238ce5c2ed22fdd1622b1f1e2cfa9279",
"score": "0.6420382",
"text": "def block_size\n 4\n end",
"title": ""
},
{
"docid": "54a780cf458e843e824467cbb5481870",
"score": "0.641506",
"text": "def bytes_needed(count); end",
"title": ""
},
{
"docid": "fa7e8ff9f6147d828128159dbd95007d",
"score": "0.6411085",
"text": "def bitsize\n Math.log2(modulus).ceil\n end",
"title": ""
},
{
"docid": "a16ff83f6fda72be6df1d7da6bbd0187",
"score": "0.6392151",
"text": "def load_factor #load_factor = (number of hashes being stored in the hash / the number of buckets)\n @inserts.to_f / @values.length.to_f\n end",
"title": ""
},
{
"docid": "bd88740dd28b2f351023973075abb3bf",
"score": "0.63882804",
"text": "def size\n @blocks.size\n end",
"title": ""
},
{
"docid": "f67876d4530e284eb8aed48fc7021345",
"score": "0.63756514",
"text": "def used_bytes\n (total_blocks - free_blocks) * block_size\n end",
"title": ""
},
{
"docid": "6e2f71e3ea6f06334e44232dd9d128fe",
"score": "0.6356698",
"text": "def block_length\n 1\n end",
"title": ""
},
{
"docid": "1224c7c32112c7e9b530d3cd73f9c310",
"score": "0.63529897",
"text": "def blocksize\n return @block_words*4\n end",
"title": ""
},
{
"docid": "0fc7856ebf55d4ba77aae8c4fd6f99cc",
"score": "0.63477534",
"text": "def block_size\n ::OpenSSL::Cipher.new(cipher_name).block_size\n end",
"title": ""
},
{
"docid": "9343089d8b91c1237ac15b3d59adc8ab",
"score": "0.63159496",
"text": "def tails_count\n block_count * Constants::BLOCKING_FACTOR - record_count\n end",
"title": ""
},
{
"docid": "83609c914616adf64863f9e35ffe7bf4",
"score": "0.6313037",
"text": "def block_size\n ::OpenSSL::Cipher::Cipher.new(@cipher).block_size\n end",
"title": ""
},
{
"docid": "7bd81e13930ded1986fcffebbb606c6c",
"score": "0.6310769",
"text": "def block_size\n ::OpenSSL::Cipher::Cipher.new(@cipher_name).block_size\n end",
"title": ""
},
{
"docid": "2d537ec5e0dd0876bd1581a5e8754674",
"score": "0.62968034",
"text": "def hashrate\n if shares.empty?\n rate = 2000 # default, 2 khash\n elsif shares.size < NB_SHARE_MEAN\n sum_diff = shares.map(&:worker_difficulty).sum\n time = Time.now - created_at\n rate = (sum_diff / time * 2 ** 32).round\n else\n sum_diff = shares[-NB_SHARE_MEAN..-1].map(&:worker_difficulty).inject(:+)\n time = Time.now - shares[-NB_SHARE_MEAN].created_at\n rate = (sum_diff / time * 2 ** 32).round\n end\n log.debug \"[\" + name + \"] hashrate is \" + rate.to_s\n rate\n end",
"title": ""
},
{
"docid": "fa0dc9a3525bf6701503dd147f5af803",
"score": "0.62964666",
"text": "def md5_hash_chunk_size\n return @md5_hash_chunk_size\n end",
"title": ""
},
{
"docid": "f2682000d25b8c52e96f8b605522bd88",
"score": "0.62900674",
"text": "def length()\n\t\t\treturn real_hash.length()\n\t\tend",
"title": ""
},
{
"docid": "12786da1534afe9261585922fb4d9ced",
"score": "0.6288829",
"text": "def completedLength\n num = @completeBlocks.countSet\n # Last block may be smaller\n extra = 0\n if @completeBlocks.set?(@completeBlocks.length-1)\n num -= 1\n extra = @lastBlockLength\n end\n num*@blockSize + extra\n end",
"title": ""
},
{
"docid": "586a8d1040c3ee13f19a6e39be35a588",
"score": "0.6281",
"text": "def block_length\n @md.block_length\n end",
"title": ""
},
{
"docid": "3d4da5d9407d09f74a4f4889f403d428",
"score": "0.6256054",
"text": "def length\n @length ||= (count.to_f / @per_chunk).ceil\n end",
"title": ""
},
{
"docid": "291841e293c65aec5f8013c72f9f4b6a",
"score": "0.6249927",
"text": "def getblockcount\n dogecoin.getblockcount\n end",
"title": ""
},
{
"docid": "17e9ab753472af045d44be531a800426",
"score": "0.6236796",
"text": "def block_size\n 20\n end",
"title": ""
},
{
"docid": "7e57abe750a2cd36c5f7b58cce2ca5ee",
"score": "0.6232843",
"text": "def hash_check(block)\r\n unpacked_string = block.line_num + '|' + block.last_hash + '|' + block.transactions + '|' + block.time_val\r\n unpacked_string = unpacked_string.unpack('U*')\r\n sum = 0\r\n unpacked_string.each do |x|\r\n temp = (x**2000) * ((x + 2)**21) - ((x + 5)**3)\r\n sum += temp\r\n end\r\n sum = sum % 655_36\r\n return sum.to_s(16) != block.end_hash\r\n end",
"title": ""
},
{
"docid": "aa1f2db7d0d50229078813dec96ff9a8",
"score": "0.6229132",
"text": "def block_size(update=true)\n if update\n if @current_stream_status && (@block_size < MAX_BLOCK_SIZE)\n @block_size = [@block_size * BLOCK_FACTOR, MAX_BLOCK_SIZE].min\n end\n if !@current_stream_status && @block_size > MIN_BLOCK_SIZE\n @block_size = [[(@block_size / (BLOCK_FACTOR ** BLOCK_FACTOR)).floor, MIN_BLOCK_SIZE].max, MAX_BLOCK_SIZE].min\n end\n @block_size = [@block_size, @metadata[:max_records_per_query]].min\n end\n @block_size\n end",
"title": ""
},
{
"docid": "4ca8501f226bbd6ee3b1445894588426",
"score": "0.6213931",
"text": "def block_size\n 15\n end",
"title": ""
},
{
"docid": "4c95c5ab731c1d4d763e19ecbfb61573",
"score": "0.61896825",
"text": "def blocks_per_hour\n 60 / self.time_increment\n end",
"title": ""
},
{
"docid": "36696a8da842491cffe6a44cf0e52c10",
"score": "0.6188996",
"text": "def load_factor\n @count / size\n end",
"title": ""
},
{
"docid": "2c746cc96c447653d5eaf40686807062",
"score": "0.61617595",
"text": "def blockhash_Bentley(a)\n\t\thasharray = Array.new(0)\n\t\ttemp = 0\n\t\ttemp = ((@last_hashvalue - @last_fbvalue) * P)+(a[@@bsize-1].hash)\n\t\t@last_hashvalue = temp % @@table_size\n\t\t@last_fbvalue = (((a[0].hash) * @@expTable[@@bsize-1])) % @@table_size\n\t\treturn (temp % @@table_size) \t\t\t\t\t\t# return hash of block\n\tend",
"title": ""
},
{
"docid": "7ddf7d24e8faa296baf61a5e682cd89d",
"score": "0.6157289",
"text": "def digest_length\n (@width / 8.0).ceil\n end",
"title": ""
},
{
"docid": "314eae249431211e894a77188b070a96",
"score": "0.61259454",
"text": "def bytes_total\n blocks * fragment_size\n end",
"title": ""
},
{
"docid": "f946f9c441eeb27258d428726fec9ce8",
"score": "0.6119382",
"text": "def block_size\n 8\n end",
"title": ""
},
{
"docid": "6a6ebaa5df1f9065bbc624d1f60b3772",
"score": "0.61156446",
"text": "def load_factor\n count = 0\n @data.each do |list_item|\n if list_item != nil\n count = count + list_item.size\n end\n end\n return count.to_f / size\n # TEST FAIL: returns the number of items in the hash divided by the size of the underlying array\n end",
"title": ""
},
{
"docid": "8aff229cf2a5a153b8b174f50d7bf622",
"score": "0.61118144",
"text": "def block_length\n raise NotImplementedError, \"#{self.class.name} does not implement block_length()\"\n end",
"title": ""
},
{
"docid": "708b9b744106702d6a396568c0216b28",
"score": "0.6110871",
"text": "def count_block_type(block_type)\n block_type_data.bytes.count block_type ? block_type.to_i : 255\n end",
"title": ""
},
{
"docid": "83ec077d8ec96c9ea6e8265bb0634af0",
"score": "0.6110114",
"text": "def purity\n\t\treturn 1 if self.blocks.blank?\n\t\treturn self.blocks.select{|block| not block.orphan?}.count / self.blocks.count.to_f\n\tend",
"title": ""
},
{
"docid": "af18aff362b28a2fa3915622e6ac028b",
"score": "0.61098725",
"text": "def block_length\n raise NotImplementedError, \"#{self} does not implement block_length()\"\n end",
"title": ""
},
{
"docid": "e96a842d24b737fcfa7df4fef80210e8",
"score": "0.60992944",
"text": "def load_factor\n (num_hash_items.to_f)/array_size\n end",
"title": ""
},
{
"docid": "ba034198f282db7d162b785aea5fea25",
"score": "0.6089156",
"text": "def count(&block)\n 0\n end",
"title": ""
},
{
"docid": "b4c79587bd1b7d8430552673e57f5a33",
"score": "0.6085772",
"text": "def length\r\n\t\[email protected]\r\n\tend",
"title": ""
},
{
"docid": "bcb9de5e17877c51a431ff7e42d974e1",
"score": "0.60756075",
"text": "def block_length\n\t\t@data[0][0].length\n\tend",
"title": ""
},
{
"docid": "49f81a626692341d9b11dc0ad0eb12c4",
"score": "0.60556966",
"text": "def block_length\n read_length(@handle.interface[:md_block_length])\n end",
"title": ""
},
{
"docid": "35459b39d4265fb70cafe1cb1c2b493b",
"score": "0.60506886",
"text": "def total_blocked\n self.blockades(false).count + self.blockades_by(false).count\n end",
"title": ""
},
{
"docid": "0feb0a54bfbcca78cafd2a64e19da81e",
"score": "0.6035689",
"text": "def digest_length\n @sha2.digest_length\n end",
"title": ""
},
{
"docid": "0feb0a54bfbcca78cafd2a64e19da81e",
"score": "0.6035689",
"text": "def digest_length\n @sha2.digest_length\n end",
"title": ""
},
{
"docid": "4fba87b365baa9c9a4b5d70fe9b402e9",
"score": "0.6021032",
"text": "def bitcount\n chunk_keys.map { |key| @redis.bitcount(key) }.reduce(:+) || 0\n end",
"title": ""
},
{
"docid": "1e0c49cf08fca5ea788020245c3b90e4",
"score": "0.60138166",
"text": "def bytesize\n Math.log256(modulus).ceil\n end",
"title": ""
},
{
"docid": "4f65986a974f11b412d1b540f37537ff",
"score": "0.5995689",
"text": "def block_size(block)\n block.loc.end.line - block.loc.begin.line\n end",
"title": ""
},
{
"docid": "e755895ef01e34b6a61a578576ff3c44",
"score": "0.5992056",
"text": "def load_factor\n @count / size.to_f\n end",
"title": ""
},
{
"docid": "f0b8b487c7aee5579faf3c798dfb132b",
"score": "0.59906334",
"text": "def load_factor\n load_factor = 0\n @items.each do |bucket|\n if !bucket.is_empty\n load_factor += bucket.count\n end\n end\n load_factor = load_factor.fdiv(@items.length)\n load_factor\n end",
"title": ""
},
{
"docid": "2c55ae0822d1a222b7fdafa3fa8bfb89",
"score": "0.5990596",
"text": "def hash_block(data)\n chunk_num = data.length>>6\n frame_num = ( chunk_num.to_f / @max_chunk_per_frame ).ceil \n byte_per_frame = @bytes_per_chunk*@max_chunk_per_frame\n padding_chunks = [0].pack('C')*@bytes_per_chunk*@padding_chunk_num\n \n if frame_num == 1 #single frame\n command = [ @frame_header[:last], frame_info(chunk_num, 1), data].join\n @connector.send command\n else\n @connector.send [ @frame_header[:first], frame_info(@max_chunk_per_frame, 1),\n data[0, byte_per_frame], padding_chunks ].join\n byte_offset = byte_per_frame\n (2...frame_num).each do\n @connector.send [ @frame_header[:middle], frame_info(@max_chunk_per_frame, 1),\n data[byte_offset, byte_per_frame], padding_chunks].join\n byte_offset += byte_per_frame\n end\n last_chunk_num = chunk_num % @max_chunk_per_frame\n last_chunk_num += @max_chunk_per_frame if last_chunk_num == 0\n @connector.send [ @frame_header[:last], frame_info(last_chunk_num, 1),\n data[byte_offset, @bytes_per_chunk*last_chunk_num] ].join\n end \n #hash_value = nil\n #Timeout::timeout(5) { hash_value = @connector.receive[1,@byte_in_hash] }\n #hash_value\n @connector.receive[1,@byte_in_hash]\n end",
"title": ""
},
{
"docid": "24cd1817ff77a509f930ad1d27702fd0",
"score": "0.598755",
"text": "def getblockbycount(height)\n bitcoin.getblockbycount height\n end",
"title": ""
},
{
"docid": "5d433f9e9db96ded57e0ccdc48d660a7",
"score": "0.59673625",
"text": "def load_factor\n size = size() + 0.0\n lf = @entries / size\n return lf\n end",
"title": ""
},
{
"docid": "ea907eb7e13422f0abd7f03c59ca18c2",
"score": "0.5956887",
"text": "def compute_sieve_size(count)\n count * 52\n end",
"title": ""
},
{
"docid": "8eccd58690c2c57a3520c49623bb0372",
"score": "0.59467757",
"text": "def parameter_block_size\n @specifications ? @specifications.block_length_in_bytes : 0\n end",
"title": ""
},
{
"docid": "d3b720c0b7af64d4bf666435ff7bb4f3",
"score": "0.59452677",
"text": "def hash_block\n hash_string = [index,timestamp,data,prev_hash].join\n sha = Digest::SHA256.new\n sha.update(hash_string)\n sha.hexdigest\n end",
"title": ""
},
{
"docid": "b9ea4c7f455d2606b47866a2d72b44eb",
"score": "0.5941215",
"text": "def digest_length\n @ctx.digest_length\n end",
"title": ""
},
{
"docid": "a29118e8ff6d01a44fca9373e2f7f2a9",
"score": "0.59391147",
"text": "def load_factor\n @count / self.size.to_f\n end",
"title": ""
},
{
"docid": "693a8462201d8bd06219b962df232b6f",
"score": "0.5938384",
"text": "def load_factor\n @count/(self.size).to_f\n end",
"title": ""
},
{
"docid": "b533180d4da42e58ce419767f62e898f",
"score": "0.5935757",
"text": "def digest_length; end",
"title": ""
},
{
"docid": "e60c5bc3d9294eb764734ce90ea555d1",
"score": "0.5918775",
"text": "def expected_count\n\n if h.ccount.nil?\n count_list_size\n elsif h.ccount >= 0\n [ h.ccount, count_list_size ].min\n else # all but 1, 2, ...\n i = count_list_size + h.ccount\n i < 1 ? 1 : i\n end\n end",
"title": ""
},
{
"docid": "8f6c95f6d3c0b9f8500609f7c078bd71",
"score": "0.5911174",
"text": "def length\n @hash.length\n end",
"title": ""
},
{
"docid": "2e45d17c2c4964ddd0a8892ce9aa5bc3",
"score": "0.5909128",
"text": "def get_hash_size()\n\t\treturn @hashmap.size\n\tend",
"title": ""
},
{
"docid": "d4d85885b13b68f2110028d1f74b5e43",
"score": "0.5880582",
"text": "def hash\n # sample at most 5 elements of receiver\n ts = Thread.__recursion_guard_set\n added = ts.__add_if_absent(self)\n unless added\n return 0 \n end\n hval = 4459 \n begin\n mysize = self.size\n interval = (mysize - 1).__divide(4)\n if interval < 1\n interval = 1\n end\n n = 0\n while n < mysize\n elem = self.__at(n)\n eh = elem.hash\n if eh._not_equal?(0)\n eh = Type.coerce_to( eh, Fixnum, :to_int)\n hval = (hval >> 1) ^ eh\n end\n n += interval\n end\n ensure\n ts.remove(self)\n end\n hval \n end",
"title": ""
},
{
"docid": "817327a37f1195b4dbee5634e9e1431f",
"score": "0.58802146",
"text": "def secret_size; end",
"title": ""
},
{
"docid": "b6c5c59a6c30099d5938b6c279acc95d",
"score": "0.5879459",
"text": "def our_count(&block)\n block.call(300)\nend",
"title": ""
},
{
"docid": "96b867ce49a27f7bea8b67b32272f0db",
"score": "0.5878651",
"text": "def recalc_block_len\n len = fields.map { |f| @fields[f].to_s }.join.size\n self.block_len = self.block_len2 = len\n end",
"title": ""
},
{
"docid": "992a71cbcaf035558d7fc40d281119d5",
"score": "0.5878167",
"text": "def size\n return @hash.length\n end",
"title": ""
},
{
"docid": "992a71cbcaf035558d7fc40d281119d5",
"score": "0.5878167",
"text": "def size\n return @hash.length\n end",
"title": ""
},
{
"docid": "9c74b18e19f0e9f810d7911b820049f3",
"score": "0.58739066",
"text": "def load_factor\n @load_count /= @size\n end",
"title": ""
},
{
"docid": "5a76a73f14f2ad75e9853c3e9ccbc6b1",
"score": "0.5854331",
"text": "def width\n @tile_width * @blocks[0].size\n end",
"title": ""
}
] |
c4b36ba1a26b8b571ce77826eefa13b6
|
Set/Get for Task ID.
|
[
{
"docid": "0fd750b27b1200ff434712b512fa400e",
"score": "0.0",
"text": "def id=(updated_id)\r\n @id = updated_id\r\n end",
"title": ""
}
] |
[
{
"docid": "58823bbd9fc643a1a8518c2e4ac003e5",
"score": "0.7636074",
"text": "def set_task\n @task = Task.find(params[:id] || params[:task][:id])\n end",
"title": ""
},
{
"docid": "14a676d6387fda60078d726228ea2d17",
"score": "0.7545955",
"text": "def id\r\n return @task_id \r\n end",
"title": ""
},
{
"docid": "53a0e1bff7b1c50f8d63cf70d51d84af",
"score": "0.7535871",
"text": "def set_task\n @task = Task.find(params[:task_id] || params[:id])\n end",
"title": ""
},
{
"docid": "c041d2302a11c92d00d1790b06069b26",
"score": "0.7459646",
"text": "def set_task\n @task = Managers::Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "6d0d4c24fde2474c0d048dec840ca6f6",
"score": "0.7456865",
"text": "def set_task\n\t\t\t@task = Task.find(params[:id])\n\t\tend",
"title": ""
},
{
"docid": "1d27231bf065b8f2cf6e0afe4cd00ee5",
"score": "0.7448463",
"text": "def set_task\n @variable_task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "0bd64b50671deed13948fb62b207bbec",
"score": "0.74423236",
"text": "def set_task\n if params[:task_id].nil?\n @task = Task.find(params[:id])\n else\n @task = Task.find(params[:task_id])\n end\n end",
"title": ""
},
{
"docid": "a9d5e23403dd6a19b2cd01a6eef8accc",
"score": "0.74387354",
"text": "def set_task\n\t\t\t@task = Task.find(params[:task_id])\n\t\tend",
"title": ""
},
{
"docid": "317435c69d5e10b0ec56d09236217589",
"score": "0.74193597",
"text": "def set_task\n\t\t\t\t@task = Task.find(params[:id])\n\t\t\tend",
"title": ""
},
{
"docid": "f0fb21ed2a376fc01ed32dc549ebbb58",
"score": "0.74002457",
"text": "def set_task\n\t\t@task = Task.find(params[:id])\n\tend",
"title": ""
},
{
"docid": "f0fb21ed2a376fc01ed32dc549ebbb58",
"score": "0.74002457",
"text": "def set_task\n\t\t@task = Task.find(params[:id])\n\tend",
"title": ""
},
{
"docid": "03bf1585167c2886045808144f1fc36e",
"score": "0.73641336",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "03bf1585167c2886045808144f1fc36e",
"score": "0.73641336",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "a9625a8e1ca2a380771c2c0f450af598",
"score": "0.7357855",
"text": "def set_task\n @task = Task.find(params[:task_id])\n end",
"title": ""
},
{
"docid": "b89999325969af0836c1c8a631d26d93",
"score": "0.7357176",
"text": "def set_task\n @task ||= Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.7354521",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
},
{
"docid": "8254ec44eee03dfe1c9cb48920354244",
"score": "0.73543864",
"text": "def set_task\n @task = Task.find(params[:id])\n end",
"title": ""
}
] |
d0bdd93d92a8e0bc78123df1a8858990
|
Play this sound once
|
[
{
"docid": "079268ba5b580df42be283f18dab9bcc",
"score": "0.619624",
"text": "def play\n raise \"Sound #{path_or_url} is not loaded yet\" unless @decoded\n source = nil\n %x{\n var context = #{Sound.audio_context};\n source = context.createBufferSource();\n source.buffer = #{@decoded};\n source.connect(context.destination);\n source.start(0); \n }\n @source = source\n end",
"title": ""
}
] |
[
{
"docid": "20b6fbbccbefb364c5b7854e527ea044",
"score": "0.79071873",
"text": "def on\n @snd = sound.dup\n @snd.play\n end",
"title": ""
},
{
"docid": "e298e56912f7bc0f615c3771c3acf5f7",
"score": "0.7051631",
"text": "def play_one\r\n\t\tend",
"title": ""
},
{
"docid": "1d7b4767e44573f0acd1d98f1f669f80",
"score": "0.7048616",
"text": "def play_sound\n @collect_coin.play\n end",
"title": ""
},
{
"docid": "f724a216ea9e752824358df9e320a4aa",
"score": "0.7006689",
"text": "def play_sound\n if File.exists?(File.expand_path(\"~/.pompom/sound.wav\")) && File.exists?(\"/usr/bin/play\")\n `play -q ~/.pompom/sound.wav`\n end\n end",
"title": ""
},
{
"docid": "3349d176d8642fa656a5f992a61cc05d",
"score": "0.687273",
"text": "def play\n unless playing?\n play_or_pause\n end\n end",
"title": ""
},
{
"docid": "91d752cf857c545f8ba0e09b581f0dcf",
"score": "0.68638986",
"text": "def play_sound(*args)\n @sound_manager.play_sound *args\n end",
"title": ""
},
{
"docid": "03e83cded36511c4a3f7f15f92d0ddc3",
"score": "0.68223816",
"text": "def start\n @current_song = self.songs().sample\n puts @current_song.play()\n end",
"title": ""
},
{
"docid": "8c831d27a7c11b3d285bd9a5f448fdb5",
"score": "0.67582995",
"text": "def start\n \t@current_song = self.songs().sample\n \tputs @current_song.play()\n end",
"title": ""
},
{
"docid": "9a355d8646e9c8b0bb6e4c03ac71c47c",
"score": "0.6723443",
"text": "def play\n\t\t@sound = Sound.find_by_id(params[:id]) || Sound.find_by_label(params[:id])\n\t\tresponse = @sound.delay_play if @sound \n\t\trender :nothing => true\n\tend",
"title": ""
},
{
"docid": "ce53dfe652eb48196e4506bbf36d2c35",
"score": "0.6699836",
"text": "def play_se_for_item\n Sound.play_use_item\n end",
"title": ""
},
{
"docid": "ce53dfe652eb48196e4506bbf36d2c35",
"score": "0.6699836",
"text": "def play_se_for_item\n Sound.play_use_item\n end",
"title": ""
},
{
"docid": "60dc59d6757a4495d2ebc67faed5d2c8",
"score": "0.6661373",
"text": "def play_sound(sound, frequency = 1.0, volume = nil)\n @sounds << sound.play(frequency, volume || Config['sound_volume'])\n end",
"title": ""
},
{
"docid": "9e702474de0e1afec87192d86ebe9286",
"score": "0.66542774",
"text": "def play_se_for_item\r\n Sound.play_use_item\r\n end",
"title": ""
},
{
"docid": "216dca24b1690057df4ab10cb9bb927e",
"score": "0.66405755",
"text": "def audio_player!\n @audio_player = true\n self\n end",
"title": ""
},
{
"docid": "78f8520bb243c38f6fffab3f9710466f",
"score": "0.66259253",
"text": "def play_sound(soundName)\r\n \t\texec(\"playback\", soundName)\r\n \tend",
"title": ""
},
{
"docid": "3d3fa40ded65a53f6314483964a6d4a4",
"score": "0.66031754",
"text": "def in_play!\n\t\t@in_play = true\n\t\tself\n\tend",
"title": ""
},
{
"docid": "5d13a21fefbd1930d593fb511b99585d",
"score": "0.65997124",
"text": "def sound(name)\n speak(name, :type => :sound)\n end",
"title": ""
},
{
"docid": "66f0df5ca8e30722638225e758908e5a",
"score": "0.6575688",
"text": "def sound(sound_path, loops = 0)\n @audio.play_sound(sound_path, loops)\n end",
"title": ""
},
{
"docid": "995d375462880b15e0671c10397a5d45",
"score": "0.6574521",
"text": "def sound_appear\n @exit_appear.play(1, 1, false)\n end",
"title": ""
},
{
"docid": "aadee9344e9889a64a871b37fe85fe91",
"score": "0.65683454",
"text": "def play_sound options\n \n end",
"title": ""
},
{
"docid": "48798188b2fc541afa0069f11376f869",
"score": "0.6551918",
"text": "def play\n SDL::Mixer.Volume(@channel, (SDL::Mixer::MAX_VOLUME * @volume).to_i)\n result = SDL::Mixer.PlayChannelTimed(@channel, @sdl_sound, 0, -1)\n raise(SDLError, \"Failed to play sound: #{SDL.GetError}\") if result == -1\n self\n end",
"title": ""
},
{
"docid": "7dfe94b868752d2ff2463834dfcae646",
"score": "0.6533597",
"text": "def play_song song\n puts \"Playing #{song.file_name}...\"\n sleep 10\n end",
"title": ""
},
{
"docid": "c50c379f583e0101137aa3a9516ef00d",
"score": "0.6502687",
"text": "def call_sound\n $game_system.se_play(RPG::AudioFile.new(ActorCustomization::Error_sound))\n end",
"title": ""
},
{
"docid": "52bf86af4cfa3d1289dafd906a396478",
"score": "0.64861697",
"text": "def play\n @played_time = Time.now\n end",
"title": ""
},
{
"docid": "178d5af3e7e01d33bfcf0885733baf57",
"score": "0.64797735",
"text": "def me_play(me)\n if me != nil and me.name != \"\"\n Audio.me_play(\"Audio/ME/\" + me.name, me.volume, me.pitch)\n else\n Audio.me_stop\n end\n Graphics.frame_reset\n end",
"title": ""
},
{
"docid": "178d5af3e7e01d33bfcf0885733baf57",
"score": "0.64797735",
"text": "def me_play(me)\n if me != nil and me.name != \"\"\n Audio.me_play(\"Audio/ME/\" + me.name, me.volume, me.pitch)\n else\n Audio.me_stop\n end\n Graphics.frame_reset\n end",
"title": ""
},
{
"docid": "178d5af3e7e01d33bfcf0885733baf57",
"score": "0.64797735",
"text": "def me_play(me)\n if me != nil and me.name != \"\"\n Audio.me_play(\"Audio/ME/\" + me.name, me.volume, me.pitch)\n else\n Audio.me_stop\n end\n Graphics.frame_reset\n end",
"title": ""
},
{
"docid": "76ae14f8c9b5510198c462664d565640",
"score": "0.64771664",
"text": "def play_sound(what, opts={})\n if @enabled && @sounds[what]\n merged_opts = {volume:1, speed:1, looping:false}.merge opts\n @playing_sounds[what] = @sounds[what].play merged_opts[:volume], merged_opts[:speed], merged_opts[:looping]\n end\n end",
"title": ""
},
{
"docid": "facd25679ba181e940d5f2053beb97e9",
"score": "0.64757216",
"text": "def me_play(filename, volume=100, pitch=100)\n @me=Sound.new(RGSS.get_file_as_stream(filename),\"bgs\") rescue puts($!)\n @me.play(pitch,volume)\n end",
"title": ""
},
{
"docid": "beb510bd22a5100bb647788ae73bfae1",
"score": "0.64655346",
"text": "def play sound\n pan = (@[email protected]/2)/@game.width\n pan = -pan if @game.config.invert_speakers\n @game.art.audio[sound].play_pan(pan)\n end",
"title": ""
},
{
"docid": "e1498416637124db3956cb1725db9e32",
"score": "0.64563954",
"text": "def play(amplitude)\n play_noise(self, amplitude)\n end",
"title": ""
},
{
"docid": "ff796674470b4160b3b8fcc5e2800283",
"score": "0.6450941",
"text": "def play name, cmd=nil\n fname = alias2filename name\n play_sound(fname, cmd) if fname\n end",
"title": ""
},
{
"docid": "1f72bea87695ee1c2d45709f834e2b91",
"score": "0.64398116",
"text": "def play!(song)\n play(song).save\n end",
"title": ""
},
{
"docid": "211a03cb75eaed120015ab4a5f25e5f2",
"score": "0.6438842",
"text": "def play *args\n super\n if (get_clip.has_audio?)\n handle_play_for_audio_player\n end\n end",
"title": ""
},
{
"docid": "c19296464199a7fb68eeb641a2f7709c",
"score": "0.64034235",
"text": "def play_switch_sound\n Sound.play_cursor\n end",
"title": ""
},
{
"docid": "1d4462675de6aad24bd062f3050627b3",
"score": "0.639139",
"text": "def play_finish_sound\n # new thread (the &) is needed so it does not block\n command = 'play ' + FINISH_SOUND + ' &'\n system command\n end",
"title": ""
},
{
"docid": "d4fb14e5c45ab03327c2629b646fa8e7",
"score": "0.638151",
"text": "def setup_sound\n return unless PONY::ERRNO::check_sequence(current_act)\n name = @acts[1]\n vol = @acts[2] || 100\n pitch = @acts[3] || 100\n RPG::SE.new(name,vol,pitch).play\n end",
"title": ""
},
{
"docid": "a8a4496d9a671269118f970e221e06f1",
"score": "0.6379096",
"text": "def play!\n _notes.all?(&:play)\n play! if sequence.playing?\n end",
"title": ""
},
{
"docid": "774637fbe97a3137a28e331d5c204696",
"score": "0.63727456",
"text": "def set_pose_sound\n if current_pose_sound != nil and current_pose_sound[@current_frame + 1] != nil\n sound = current_pose_sound[@current_frame + 1]\n $game_system.se_play(RPG::AudioFile.new(sound[0], sound[1], sound[2]))\n end\n end",
"title": ""
},
{
"docid": "cc5e8cd444d39d1f89a96fbc8701bac3",
"score": "0.6372553",
"text": "def play_music\n Audio.bgm_play(@filename_bgm) unless @filename_bgm.empty?\n end",
"title": ""
},
{
"docid": "a37e06a684b5576e00a9fb353847943c",
"score": "0.6363507",
"text": "def play(song)\r\n\tputs \"#{timestamp}: Playing #{song}\"\r\n\tsleep(120 + 60*rand)\r\nend",
"title": ""
},
{
"docid": "8b73fa3f0bf0fddeff6e3af0f263d3c4",
"score": "0.6362218",
"text": "def playSound(name, loops = 0)\n return unless $curPhysicsSimulation\n $curPhysicsSimulation.sounds.play(name, loops)\n end",
"title": ""
},
{
"docid": "909d770d6f7082f5f5a65784c16eed52",
"score": "0.6358272",
"text": "def play\n start\n sleep duration\n stop\n end",
"title": ""
},
{
"docid": "2e7ae38278bfd119dee7b50edaddbad0",
"score": "0.63581234",
"text": "def alarm\n alarmfile = NSBundle.mainBundle.pathForResource(\"alarm\", ofType:\"mp3\")\n NSSound.alloc.initWithContentsOfFile(alarmfile, byReference:false).play\nend",
"title": ""
},
{
"docid": "a5fea6e6b1cc07f327f4dfd2af036285",
"score": "0.634634",
"text": "def play_tone(volume, frequency, duration)\n self.execute(_play_sound(volume, frequency, duration))\n end",
"title": ""
},
{
"docid": "c47292ae4e3440760f0a58e831e089d3",
"score": "0.633417",
"text": "def play_sound(type)\n @log.debug(\"Play sound #{type}, os: #{$g_os_type}\")\n sound = get_sound_source(type)\n \n #p @sound_enabled\n @linux_sound_stoppped[type] = false\n if sound and @sound_enabled == true\n Thread.new{\n if $g_os_type == :win32_system\n Sound.play(sound, @duration_win[type] )\n end\n if $g_os_type == :linux\n while !@linux_sound_stoppped[type]\n system(\"aplay -q \" + sound)\n break if @duration_linux[type] != :loop\n end\n end \n }\n end\n end",
"title": ""
},
{
"docid": "c81491442618f1064a237ff99cddd279",
"score": "0.633079",
"text": "def die\n @ding_sound.play(1, 1, false)\n super\n end",
"title": ""
},
{
"docid": "c98f78d3748306b79a23fb236d505eed",
"score": "0.632112",
"text": "def play\n @_itunes.play\n end",
"title": ""
},
{
"docid": "05dee97154746913982cad810bf2e4ea",
"score": "0.6320907",
"text": "def play(song)\nputs \"#{timestamp}: Playing #{song}\"\nsleep(120 + 60*rand)\nend",
"title": ""
},
{
"docid": "e726a8876bd733d847113497db70b9cf",
"score": "0.6319972",
"text": "def play_song\n wait(5)\n se = CP::OCARINA::SETTINGS::PLAYED_SONG\n se = CP::OCARINA::SETTINGS::PLAYED_WRONG if @play_song == -1\n sv = CP::OCARINA::SETTINGS::PLAYED_VOLUME\n sp = CP::OCARINA::SETTINGS::PLAYED_PITCH\n song_play = RPG::SE.new(se, sv, sp) unless se == nil\n song_play.play\n @message_window.draw_song(@play_song, @teach) unless @play_song == -1 or (@teach != @taught)\n wait(30)\n @note_sprites.dispose\n note_sprite\n @note = 0\n @play_notes = []\n return if @play_song == -1\n for i in 0...CP::OCARINA::SETTINGS::SONGS[@play_song].size\n note = CP::OCARINA::SETTINGS::SONGS[@play_song][i]\n unless note == 0\n play_sound(note)\n add_note(note)\n @note += 1\n end\n wait(20)\n end\n wait(60)\n quit if (@teach == @taught)\n @note = 0\n @play_song = -1\n @note_sprites.dispose\n note_sprite\n end",
"title": ""
},
{
"docid": "5de9f1ff2bb989791d3f4631943a5c39",
"score": "0.6315323",
"text": "def play\r\n if is_a_bgm?\r\n Audio.bgm_play(@name, @volume, @pitch)\r\n elsif is_a_bgs?\r\n Audio.bgs_play(@name, @volume, @pitch)\r\n elsif is_a_me?\r\n Audio.me_play(@name, @volume, @pitch)\r\n elsif is_a_se?\r\n Audio.se_play(@name, @volume, @pitch)\r\n end\r\n end",
"title": ""
},
{
"docid": "26c43306dc087c088c79fbf44c1bb38e",
"score": "0.6313633",
"text": "def play_next_song\n play_on_map(playing_music(1))\n end",
"title": ""
},
{
"docid": "3632a40cbc0fd2b225d2ffcd9ef015b0",
"score": "0.6307219",
"text": "def act_readygo\r\n @time += 1\r\n\r\n if @time > 120\r\n @state = :playing\r\n SDL::Mixer.play_music(@bgm,-1)\r\n end\r\n end",
"title": ""
},
{
"docid": "8721c6882d670ca0c53877582990ed1d",
"score": "0.6296775",
"text": "def play(song)\n puts \"#{timestamp}: Playing #{song}\"\n sleep(120 + 60*rand)\nend",
"title": ""
},
{
"docid": "cd707678211da597493ecc7c3df813c5",
"score": "0.62959015",
"text": "def se_play(filename, volume=100, pitch=100)\n @se=Sound.new(RGSS.get_file_as_stream(filename),\"bgs\") rescue puts($!)\n @se.play(pitch,volume)\n end",
"title": ""
},
{
"docid": "36bfa3c3e542b7430b26db06d73e2847",
"score": "0.6293299",
"text": "def play(song)\n write(141, song)\n end",
"title": ""
},
{
"docid": "1e4e8fcbb57bfe49573c6a03fe2f46a8",
"score": "0.6291136",
"text": "def load_sound(name)\r\n @sounds ||= {}\r\n @sounds[name] ||= Gosu::Sample.new self, File.join(MEDIA, 'audio', \"#{name}.wav\")\r\n end",
"title": ""
},
{
"docid": "cd54b33f6cbea99991beeddced6776bc",
"score": "0.6285328",
"text": "def playSound id\n @soundPool.execute do\n @soundEffectsMap[id.to_sym].play\n end\n end",
"title": ""
},
{
"docid": "a9a4c1f5c63da11a28ba1c99c5d92181",
"score": "0.62473285",
"text": "def one_shot(sound)\n return if $one_shot\n $args.outputs.sounds << sound\n $one_shot = true\nend",
"title": ""
},
{
"docid": "69da5f072a9259bbc752c9ddfb860f50",
"score": "0.6241107",
"text": "def play(data = Sound::Data.new)\n write(data)\n flush\n end",
"title": ""
},
{
"docid": "5d5baef5be9e0cdcfca4fe6ab0b462cf",
"score": "0.6228777",
"text": "def play_sound(reference, volume = 1.0, pitch = 1.0)\n game_state.manager(:resource).get_sound(reference).play(pitch, volume)\n end",
"title": ""
},
{
"docid": "cca6c38da21bf57e065eba44514c789b",
"score": "0.6224392",
"text": "def play tune\n unless Avalon::Config[:alert_sound] == :none\n file = find_file( tune, \"../../../sound/#{tune}\",\n \"~/.avalon/sound/#{tune}\", \"/System/Library/Sounds/#{tune}\")\n case system\n when 'Darwin'\n `afplay #{file}`\n when 'Linux'\n raise 'Please install sox package: sudo apt-get install sox' if `which sox`.empty?\n `play -q #{file}`\n end\n end\n end",
"title": ""
},
{
"docid": "8506ea1b6c0ac4bcc925f145d72a764b",
"score": "0.62161386",
"text": "def play_tone(volume, frequency, duration)\n command = Commands::SoundTone.new(volume, frequency, duration)\n self.execute(command)\n end",
"title": ""
},
{
"docid": "147705f0dbe757a37afbb6f86e3450d6",
"score": "0.62130904",
"text": "def play_song(reference, volume=1.0)\n @song.stop if @song\n @song = game_state.manager(:resource).get_song(reference)\n @song.play\n @song.volume = volume if volume != 1.0 #Volume must be set AFTER play is called.\n end",
"title": ""
},
{
"docid": "2b3644efdb4d5fb7ba931b28bec4c202",
"score": "0.6204034",
"text": "def setup_sound\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n name = @acts[1]\n vol = @acts[2] || 100\n pitch = @acts[3] || 100\n RPG::SE.new(name,vol,pitch).play\n end",
"title": ""
},
{
"docid": "2b3644efdb4d5fb7ba931b28bec4c202",
"score": "0.6204034",
"text": "def setup_sound\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n name = @acts[1]\n vol = @acts[2] || 100\n pitch = @acts[3] || 100\n RPG::SE.new(name,vol,pitch).play\n end",
"title": ""
},
{
"docid": "3d30ba18cdaca127d35b944789167e75",
"score": "0.6202365",
"text": "def play()\n @player.play if @media_loaded == true\n end",
"title": ""
},
{
"docid": "d5e70abf29c49d3d7305965d18a82f7e",
"score": "0.61997676",
"text": "def play_se_for_item\n Sound.play_use_skill\n end",
"title": ""
},
{
"docid": "d5e70abf29c49d3d7305965d18a82f7e",
"score": "0.61997676",
"text": "def play_se_for_item\n Sound.play_use_skill\n end",
"title": ""
},
{
"docid": "ce116fa803ffb6578b1513c1885b4e08",
"score": "0.61815447",
"text": "def play()\r\n\t\t\tcase type\r\n\t\t\t\twhen 1\r\n\t\t\t\t\tplay_one()\r\n\t\t\t\twhen 2\r\n\t\t\t\t\tplay_two()\r\n\t\t\t\twhen 3\r\n\t\t\t\t\tplay_three()\r\n\t\t\tend\r\n\t\tend",
"title": ""
},
{
"docid": "bc27b0b0d97c7835cb040bd178160c64",
"score": "0.61781204",
"text": "def set_sound\n\t\t\t@sound = Sound.find(params[:id])\n\t\tend",
"title": ""
},
{
"docid": "f9b66a29e3ba901f3fdbc56286f950b2",
"score": "0.61691546",
"text": "def play\n if @_itunes_api == :win32ole\n @_itunes_object.playfirsttrack\n else\n @_itunes_object.play\n end\n end",
"title": ""
},
{
"docid": "bf8e68929a54d405543c2d7be7c8c33c",
"score": "0.61633414",
"text": "def sound_to_play\n if test_framework.failure?\n failure_sound\n elsif test_framework.pending?\n pending_sound\n else\n sucess_sound\n end\n end",
"title": ""
},
{
"docid": "2ebcdab597dee041a06d2794a2a0cde7",
"score": "0.61632615",
"text": "def beep\n self.execute(Commands::SoundTone.new)\n end",
"title": ""
},
{
"docid": "acd6ea1a225f9f6527dddefe49e5780d",
"score": "0.6157858",
"text": "def play(amplitude)\n play_notes(notes, amplitude)\n end",
"title": ""
},
{
"docid": "b16b07200c75ddd33e112c34b05e81ab",
"score": "0.6153151",
"text": "def play!(song)\n play(song).save\n end",
"title": ""
},
{
"docid": "da113481795475a035aed999f253335e",
"score": "0.6149983",
"text": "def play\n end",
"title": ""
},
{
"docid": "da113481795475a035aed999f253335e",
"score": "0.6149983",
"text": "def play\n end",
"title": ""
},
{
"docid": "da113481795475a035aed999f253335e",
"score": "0.6149983",
"text": "def play\n end",
"title": ""
},
{
"docid": "da113481795475a035aed999f253335e",
"score": "0.6149983",
"text": "def play\n end",
"title": ""
},
{
"docid": "64b3a8b1171d6b6ff410f67e6db4e21b",
"score": "0.61192894",
"text": "def play_click_sound args\n if args.state.sound_enabled == 1\n args.audio[:click] ||= {\n input: \"audio/399934__old-waveplay__perc-short-click-snap-perc.wav\",\n x: 0.0,\n y: 0.0,\n z: 0.0,\n gain: args.state.volume / 100,\n pitch: 1.0,\n paused: false,\n looping: false,\n }\n end\nend",
"title": ""
},
{
"docid": "5020340da7adcc317bcf4c807ea4443a",
"score": "0.6116975",
"text": "def playing?; end",
"title": ""
},
{
"docid": "6a0b219c206a381e26a5c410e7cca5e8",
"score": "0.61094975",
"text": "def set_sound\n @sound = Sound.find(params[:id])\n end",
"title": ""
},
{
"docid": "6a0b219c206a381e26a5c410e7cca5e8",
"score": "0.61094975",
"text": "def set_sound\n @sound = Sound.find(params[:id])\n end",
"title": ""
},
{
"docid": "6a0b219c206a381e26a5c410e7cca5e8",
"score": "0.61094975",
"text": "def set_sound\n @sound = Sound.find(params[:id])\n end",
"title": ""
},
{
"docid": "6a0b219c206a381e26a5c410e7cca5e8",
"score": "0.61094975",
"text": "def set_sound\n @sound = Sound.find(params[:id])\n end",
"title": ""
},
{
"docid": "6a0b219c206a381e26a5c410e7cca5e8",
"score": "0.61094975",
"text": "def set_sound\n @sound = Sound.find(params[:id])\n end",
"title": ""
},
{
"docid": "98d7f4f3ba62951daa2b87c64d41baed",
"score": "0.6108568",
"text": "def play_sound sound_file\n `#{File.expand_path(File.dirname(__FILE__) + \"/../bin/\")}/playsound #{sound_file}`\nend",
"title": ""
},
{
"docid": "cea497ab0b3ea299f9c5e6a712a2538d",
"score": "0.6100404",
"text": "def set_sound\n @sound = Sound.find(params[:id])\n end",
"title": ""
},
{
"docid": "3e9890b9494d0d5da48d4357805cec3e",
"score": "0.60947776",
"text": "def sing_a_song\n puts \"lalalalaa wooooo\"\n end",
"title": ""
},
{
"docid": "f47aff8ab7d08123ced6338ff2b5fd7e",
"score": "0.6094718",
"text": "def play_title_music\n $game_system.bgm_play($data_system.title_bgm)\n Audio.bgs_stop\n Audio.me_stop\n end",
"title": ""
},
{
"docid": "0c2c23812681feb08f90dacc333ab7e3",
"score": "0.60849607",
"text": "def loop_song(reference, volume=1.0)\n @song.stop if @song\n @song = game_state.manager(:resource).get_song(reference)\n @song.loop\n @song.volume = volume if volume != 1.0 #Volume must be set AFTER loop is called.\n end",
"title": ""
},
{
"docid": "7b53404c3a2a100787795588c0af098b",
"score": "0.6082101",
"text": "def autoplay\n @played = [:Rock, :Paper, :Scissors].select\n @has_played = true\n end",
"title": ""
},
{
"docid": "f9f5f998688a9555a1ef32092331dab4",
"score": "0.60775447",
"text": "def play!\n Song.update_all(:now_playing => false)\n self.now_playing = true\n votes.update_all(:active => false)\n save\n end",
"title": ""
},
{
"docid": "1cc857c4d7b20267cbd7cc6d94c46c2a",
"score": "0.6076481",
"text": "def play(looping = false); end",
"title": ""
},
{
"docid": "8c258e68173bc5705204193324e20178",
"score": "0.60763335",
"text": "def play_song\n if @playhead < @songs.size\n \"♩♪♫♪ :: #{@songs[@playhead]} plays:: ♪♫♪♩\"\n elsif\n @playhead = 0\n else\n @playhead += 1\n end\n end",
"title": ""
},
{
"docid": "496a0b35ccd5d0e32b5aac094568dd63",
"score": "0.6075485",
"text": "def handle_play_for_audio_player\n clip = get_clip\n if (clip.has_audio?)\n if (has_audio_player?)\n @audio_player.play clip.get_audio\n else\n @audio_player = AudioPlayer.new get_settings\n @audio_player.play clip.get_audio\n end\n elsif (has_audio_player?)\n get_audio_player.stop\n end\n end",
"title": ""
},
{
"docid": "bf2f7e48b3619294d87dda60374ca685",
"score": "0.60751104",
"text": "def play_sound filename, cmd=nil\n return unless filename\n\n cmd ||= play_cmd\n\n if cmd\n system *cmd, filename\n else\n $stderr.puts 'pouf is unsupported for your platform for now'\n end\n end",
"title": ""
},
{
"docid": "acc9a43dd0b7e33df8a0b104d71edf04",
"score": "0.6074248",
"text": "def ruby_play(effect_sound)\n if GameSettings.run_music?\n @thread = Thread.new do\n run = \"mplayer #{@sound_effects[effect_sound]} -vo x11 -framedrop -cache 16384 -cache-min 20/100\"\n system(run)\n end\n end\n nil\n end",
"title": ""
},
{
"docid": "41a3e6072191e7e140da41ea2cf453a8",
"score": "0.6073438",
"text": "def pre_deploy_sound\n sound = self.config[\"pre_sound\"]\n self.speak(sound, :type => :sound) if sound\n end",
"title": ""
}
] |
f8a263d6268ebd28032ef6aeca5456f1
|
Time complexity: O(n) Space complexity: O(n)
|
[
{
"docid": "629a4e6c8fb2a4f51f40bb480df08330",
"score": "0.0",
"text": "def factorial(n)\n if n < 0\n raise ArgumentError\n end\n return 1 if n <= 1\n return n * factorial(n-1)\nend",
"title": ""
}
] |
[
{
"docid": "9bfaea331eedce3072d8464bb5cccee1",
"score": "0.65358865",
"text": "def fast_two_sum?(arr)\n # O(n) in time and space\n result = []\n complements = {}\n\n arr.each_with_index do |el, i|\n if complements[el]\n result.push([complements[el], i])\n else\n complements[-el] = i\n end\n end\n result\n #result.sort\nend",
"title": ""
},
{
"docid": "94b952c4eec254dafeaf15d164f67032",
"score": "0.6472663",
"text": "def slow_solution(m, a)\n n = a.size\n return 1 if n == 1\n distinct = 0\n n.times do |back|\n (back..n - 1).each do |front|\n if a[back..front] == a[back..front].uniq\n distinct += 1\n else\n break\n end\n end\n end\n distinct\nend",
"title": ""
},
{
"docid": "239f4a4623ff9a2dc517cbbef43d4f3d",
"score": "0.6425364",
"text": "def optimize_for_space(arr)\n arr[0...-1].each_with_index do |el, idx|\n arr[idx + 1..-1].each do |el2|\n return el if el == el2\n end\n end\n \"No Duplicates\"\nend",
"title": ""
},
{
"docid": "c978c895d39f4228b0e144beeaf88f7c",
"score": "0.642193",
"text": "def removNb_inefficient(n)\n sigma = n*(n+1)/2 # First find the sum of the first n numbers\n (1..n).each do |i| # Start one iteration from 1 to n, call that i\n (i+1..n).each do |j| # Start an inner iteration fron i+1 to n\n product = i*j \n gap_sum = sigma - i - j\n if product == gap_sum # if it meets our conditions then we're done\n return [[i,j],[j,i]]\n end\n end\n end\n return [] # if we have gotten this far then we have no solution\nend",
"title": ""
},
{
"docid": "4a21fd90da81a02895a7e32078bf0946",
"score": "0.632178",
"text": "def solution(a)\r\n # write your code in Ruby 2.2\r\n \r\n i=0;\r\n l=a.count\r\n arr=[]\r\n p=0\r\n loop do\r\n arr[a[i]-1] = a[i]\r\n i+=1\r\n \r\n if(i==l)\r\n k=1;\r\n \r\n for j in arr\r\n if(k!=j)\r\n p=k\r\n break\r\n end\r\n k+=1\r\n end\r\n \r\n break\r\n end\r\n end\r\n \r\n \r\n p\r\nend",
"title": ""
},
{
"docid": "58e1fa8bcd6897d0c0d2f244ac3d723b",
"score": "0.62829316",
"text": "def subsum(list) \r\n subs = []\r\n list.each_with_index do |el, i| #O(n)\r\n list.each_with_index do |el2, j| #O(n)\r\n subs << list[i..j] if j >= i #O(n)\r\n end\r\n end # => O(n^3)\r\n # O(n^2)\r\n subs.map{|sub| sub.sum}.max # => O(n)\r\nend",
"title": ""
},
{
"docid": "83415dea3d7100c1aaecd6d3d6b40414",
"score": "0.62580365",
"text": "def largest_contiguous_subsum(list) #O(n^2)\n sub_arrs = [] #O(1)\n num = list.first #O(1)\n (0...list.length).each do |i| #O(n)\n (i...list.length).each do |j| #O(n)\n sub_arrs << list[i..j] #??? O(1)\n #sub_arrs.shift O(n)\n #the length of sub_arrs\n end\n end \n p sub_arrs #O(1)\n sub_arrs.each do |sub| #O(n)\n if sub.sum > num #O(1)\n num = sub.sum #O(1)\n end \n end \n num #O(1)\nend",
"title": ""
},
{
"docid": "56e2f4c229d68e9d667cf5f5fe1d2177",
"score": "0.62361956",
"text": "def solution(a)\r\n # write your code in Ruby 2.2\r\n #a[0] = 1 [-1..1]\r\n #a[1] = 5 [-4..6]\r\n #a[2] = 2 [0..4]\r\n #a[3] = 1 [2..4]\r\n #a[4] = 4 [0..8]\r\n #a[5] = 0 [0]\r\n\r\n i=0\r\n arr=[]\r\n while(i<a.count) do\r\n \r\n arr[i] = (i-a[i].. i+a[i]).to_a\r\n i+=1 \r\n end\r\n \r\n \r\n \r\n l=arr.count\r\n i=0\r\n n=0\r\n while(i<l) do\r\n \r\n \r\n j=i+1\r\n while(j<l) do\r\n if(arr[i] != arr[j])\r\n \r\n if((arr[i] & arr[j]).empty? == false)\r\n n+=1\r\n end\r\n end\r\n j+=1\r\n end \r\n i+=1\r\n end\r\n n\r\nend",
"title": ""
},
{
"docid": "00ee2a773f8c3653a5307eecd31539c8",
"score": "0.6228257",
"text": "def solution(a)\n check_array = a.group_by{|n| n }\n (1..100001).each do |idx|\n return idx unless check_array[idx]\n end\nend",
"title": ""
},
{
"docid": "fd65d1f145815f32f434c3a3931d3c93",
"score": "0.6227644",
"text": "def solution(a)\n a1 = []\n a2 = []\n len = a.length\n count = 0\n \n a.each_with_index do |el, i|\n a1 << i-el\n a2 << i+el\n end\n \n a1.sort\n a2.sort\n \n (len-1).downto(0) do |i|\n position = a2.find_index(a1[i])\n if position && position >= 0\n while ((position < len) && (a2[position] == a1[i])) do\n position += 1\n end\n count += position \n else\n insertion_point = -(position+1)\n count += insertion_point\n end\n end\n \n sub = len*((len+1)/2)\n \n return -1 if (count > 10000000)\n \n count\nend",
"title": ""
},
{
"docid": "27f29666484272c0d973e8400c4c357c",
"score": "0.6214179",
"text": "def hash_two_sum?(arr, num)\n hash = Hash.new(0) #O(1) work\n arr.each do |ele| # N times\n return true if hash.has_key?(num - ele) # O(1) work\n hash[ele]+= 1 # O(1) work\n end\n false\nend",
"title": ""
},
{
"docid": "32a0ef79e59e9f9547a01b3fcc7312dd",
"score": "0.61944115",
"text": "def solution(a)\n acc = 0\n sum = 0\n\n a.each do |n|\n if n == 0\n acc += 1\n else\n sum += acc\n end\n\n return -1 if sum > 1000000000\n end\n\n sum\nend",
"title": ""
},
{
"docid": "d40fb1372be302f457e9d2d28c4b115f",
"score": "0.61874217",
"text": "def largest_contiguous_subsum(list)\n new_list = []\n i = 0\n while i < list.length # O(n)\n j = i\n while j < list.length # O(n)\n sub = list[i..j] # O(n)\n new_list << sub\n j += 1\n end\n i += 1\n end\n largest_sub_sum = new_list[0].sum #O(n)\n \n new_list.each do |sub| # O(n)\n sub_sum = sub.sum # O(n)\n largest_sub_sum = sub_sum if largest_sub_sum < sub_sum\n end\n\n p new_list\n return largest_sub_sum\nend",
"title": ""
},
{
"docid": "92946b9df716e5c3e932f5cf3c513c13",
"score": "0.61560273",
"text": "def solution(a)\n # write your code in Ruby 2.2\n sums = [nil]\n soln = 0\n\n currSum = 0\n a.each do |num,index|\n currSum += num\n sums.push currSum\n if currSum == 0\n soln += 1\n end\n end\n\n for i in (1...a.size) do\n x = a[i-1]\n for j in (i+1...a.size) do\n sums[j] = sums[j] - x\n soln += 1 if sums[j] == 0\n break if soln > 1000000000\n end\n break if soln > 1000000000\n end\n\n #if 0 exists in the array add [index,index]\n idx = a.index(0)\n soln += 1 if !(idx.nil?)\n\n soln > 1000000000 ? -1 : soln\n\nend",
"title": ""
},
{
"docid": "9eff65814391c7285afc2f2f87a89d08",
"score": "0.6155458",
"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": "b8b7d7fb43e0a5b4979a1606497cab28",
"score": "0.61350995",
"text": "def better_subsum(list)\r\n largest_sum = nil # O(1)\r\n current_sum = nil # O(1)\r\n list.each_with_index do |ele, i| # O(n)\r\n if current_sum == nil\r\n current_sum = ele\r\n largest_sum = current_sum if largest_sum == nil\r\n else\r\n current_sum += ele\r\n end\r\n\r\n if current_sum >= largest_sum\r\n largest_sum = current_sum\r\n end\r\n\r\n if ele > current_sum\r\n largest_sum = ele if ele > largest_sum\r\n current_sum = ele\r\n end\r\n end\r\n largest_sum # O(1)\r\nend",
"title": ""
},
{
"docid": "d8dacb5fc4fc1e05838533b0a605215a",
"score": "0.6128443",
"text": "def solution(a)\n # write your code in Ruby 2.2\n # max 100,000 elements, so don't care about >100,000 vals# also don't care about negatives\n a.delete_if{ |x| x < 0 || x > 100000 }\n # likely decreased the number of elements so might as well limit the number of loops necessary\n # could also do .uniq here to potentially decrease it further, but I think that's unnecessary\n max_count = a.size\n \n # keep track of elements via keys in a hash\n included_vals = {}\n a.each do |element|\n included_vals[element.to_s] ||= true\n end\n 1.upto(max_count+1).each do |i|\n return i unless included_vals[i.to_s]\n end\n \nend",
"title": ""
},
{
"docid": "72fa899102c258037694540f9f1f4414",
"score": "0.6117881",
"text": "def zaprzyjaznione(n)\n tab = []; (1..n).to_a.each {|x| a = suma_dzielnikow(x); b = suma_dzielnikow(a); tab.push([a,b].sort()) if (x == b) and (x!=a)}; tab.uniq\nend",
"title": ""
},
{
"docid": "9f058d080f26f609192ec4bbdb27a792",
"score": "0.61025923",
"text": "def two_sum_time(arr, sum)\n hash = {}\n arr.each do |n|\n hash[n] ? hash[n] += 1 : hash[n] = 1\n end\n\n result = []\n arr.each do |n|\n if hash[sum - n] && hash[sum - n] > 0\n hash[sum - n] -= 1\n hash[n] -= 1\n result.push([n, sum - n])\n end\n end\n result\nend",
"title": ""
},
{
"docid": "4adcd8ce1f663221c3c23c720e9dae18",
"score": "0.6102515",
"text": "def solution(n)\n counter_array = Array.new(n.size+1, 0)\n n.each do |v|\n counter_array[v-1] = 1\n end\n counter_array.find_index(0) + 1\nend",
"title": ""
},
{
"docid": "e074cc89f39364348a3a6d14bb3013cd",
"score": "0.6085164",
"text": "def solution(m, a)\n tail, count, q = 0, 0, 0\n used = [-1] * (m + 1)\n a.each_with_index do |n, head|\n if used[n] == -1\n used[n] = head\n else\n new_tail = used[n] + 1\n q = head - tail\n r = head - new_tail\n count += q*(q+1)/2 - r*(r+1)/2\n i = tail\n used[a[i]] = -1 while i += 1 and i < new_tail\n used[n] = head\n tail = new_tail\n # puts \"used: #{used}, q: #{q}, r: #{r}\"\n end\n end\n q = a.length - tail\n count += q*(q+1)/2\n [count, 1000000000].min\nend",
"title": ""
},
{
"docid": "0efc7a02b62549839a88810fbfd32865",
"score": "0.60828096",
"text": "def largest_contiguous_subsum_two(list)\n\n largest_sum = list.first # O(1)\n current_sum = list.first # O(1)\n\n list[1..-1].each do |ele| # O(n)\n if current_sum < 0 # O(1)\n current_sum = 0 # O(1)\n end\n current_sum += ele # O(1)\n if current_sum > largest_sum # O(1)\n largest_sum = current_sum # O(1)\n end\n end\n largest_sum # O(1)\nend",
"title": ""
},
{
"docid": "13080714a25d11a8ff3932a231d9887a",
"score": "0.60738754",
"text": "def method_12478687(arr, i)\n # Simple first answer\n # Linear or O(n) behavior\n #arr.sort.each { |n| return n if n > i }\n\n # Logarithmic or O(log n) behavior\n # Divide-and-counquer algorithm\n #high, low = arr.partition { |n| n > i }\n #high.sort!\n #while high.first <= i\n # high, low = high.partition { |n| n > i }\n #end\n #high.first\n\n # Sort and select greater in the one iteration\n greater = 0\n arr.each do |n|\n next if n <= i\n if greater == 0 || n < greater\n greater = n\n end\n end\n greater\nend",
"title": ""
},
{
"docid": "1f26f0e986d493418768645c08c1d530",
"score": "0.6063136",
"text": "def my_min(array) \n min = array.first # O(1)\n array.each do |ele| #O(n)\n if ele < min #O(1)\n min = ele #O(1)\n end\n end\n min #O(1) \nend",
"title": ""
},
{
"docid": "369faf5bab4f52230e0f993b5e42ce07",
"score": "0.60448194",
"text": "def find_duplicate(nums)\n slow = nums.size\n fast = nums.size\n \n begin\n slow = nums[slow - 1]\n fast = nums[nums[fast - 1] - 1]\n end while slow != fast\n \n slow = nums.size\n \n while slow != fast\n slow = nums[slow - 1]\n fast = nums[fast - 1]\n end \n \n slow\nend",
"title": ""
},
{
"docid": "e8dd4b022bb990b6c834f14602c975cc",
"score": "0.6033673",
"text": "def solution(a)\n uniq_array = a.uniq\n real_count = 0\n a.each_with_index do |e,i|\n dest_count = 0\n check_array = []\n\n j = i + 1\n while(j<a.count && uniq_array.count != check_array. count)\n dest_count +=1\n unless check_array.include?a[j]\n check_array.push(a[j]) \n end\n end \n real_count = dest_count if real_count < dest_count\n end\n return real_count \nend",
"title": ""
},
{
"docid": "1b46f9e46d230cc0f1dfb7236b181031",
"score": "0.6033346",
"text": "def find_unique(n)\n n = n.sort\n return n[0] if n[0] != n[1]\n n.map.with_index { |_, ind| return n[ind + 1] if n[ind] != n[ind + 1] && n[ind + 1] != n[ind + 2] }\nend",
"title": ""
},
{
"docid": "dd942fdcb9333d9fc57df0e3dbe48df7",
"score": "0.60331976",
"text": "def solution(a)\n a.uniq.count \nend",
"title": ""
},
{
"docid": "935543033b8f39002c5f47c08c759ee6",
"score": "0.6026527",
"text": "def two_sum?(arr, target_sum) # O(n + n)\n hash = Hash.new(0)\n arr.each do |ele|\n return true if hash.has_value?(ele)\n hash[ele] = target_sum - ele\n end\n false\nend",
"title": ""
},
{
"docid": "cb6463e088c265277f4e34f13c4357ac",
"score": "0.60142004",
"text": "def crossing1() #O=N**2\n p Time.now\n #a = read(\"crossing.txt\")\n a = read(\"smpl.txt\")\n cross = 0\n for i in 0...a.length\n for j in 0...i\n if a[i] < a[j]\n cross+=1\n end\n end\n end\n p Time.now\n return cross\nend",
"title": ""
},
{
"docid": "e4bf969521382732ac79be40ffa78c87",
"score": "0.600899",
"text": "def solution(a)\r\n ones=0\r\n temp=0\r\n ans=0\r\n for i in 0...a.size\r\n if a[i]==1\r\n ones+=1\r\n end\r\n end\r\n \r\n for i in 0...a.size\r\n if a[i]==1\r\n temp+=1\r\n else\r\n ans+=(ones-temp)\r\n end\r\n end\r\n \r\n if ans>1000000000\r\n return -1\r\n else\r\n return ans\r\n end\r\n \r\n \r\nend",
"title": ""
},
{
"docid": "493b5a14181948ed7023ef25a7072f0c",
"score": "0.5989126",
"text": "def largest_contiguous_subsum2(list)\n largest = list.first #O(1)\n current = list.first #O(1)\n\n (1...list.length).each do |idx| #O(n)\n current = 0 if current < 0 #O(1)\n current += list[idx] #O(1)\n largest = current if current > largest #O(1)\n end\n largest #O(1)\nend",
"title": ""
},
{
"docid": "2d1f5ffbab8c86bc000cce7ee42c2003",
"score": "0.59811723",
"text": "def solution(array)\n array.sort!\n return 0 if array.length == 1 && array.first != 1\n length = array.length\n start = 1\n length.times do |n|\n if array[start-1] != n + 1\n return 0\n end\n start += 1\n end\n return 1\nend",
"title": ""
},
{
"docid": "739c8257e3b26c4d651fdd5dd712c849",
"score": "0.59779495",
"text": "def find_dissappeared_numbers(nums)\n nums.each_with_index do |num, i|\n nums[num - 1] += 1_000_000 if nums[num - 1] < 1_000_000\n end\n\n res = []\n nums.each_with_index do |num, i|\n if num < 1_000_000\n res << (i + 1)\n end\n end\n\n nums.each_with_index do |num, i|\n if num > 1_000_000\n nums[i] -= 1_000_000\n end\n end\n\n res\nend",
"title": ""
},
{
"docid": "d342d82e565fe2eefb267643b543468f",
"score": "0.5976626",
"text": "def solution(a)\n hash = {}\n a.each { |v| \n hash[v] = true\n }\n\n i = 1\n while true\n return i if not hash[i]\n i += 1\n end\nend",
"title": ""
},
{
"docid": "803ddb77c208610ac4827e994b451008",
"score": "0.59760463",
"text": "def better_two_sum(arr, target)\n sorted = arr.sort #n log n\n sorted.each do |ele|\n dif = target - ele\n return true if sorted.bsearch{|x| x == dif}\n end\n false\nend",
"title": ""
},
{
"docid": "ba1958a12d523bd63f8d13a97f2ed084",
"score": "0.5975841",
"text": "def fibSeq(n)\n\ta=[0]\t\t\t\t\t\t# O(1)\n\tn.times do |index|\t\t\t\t# O(n)\n\t\tif index==0\t\t\t\t# O(1)\n\t\t\ta[index]=0\t\t\t# O(1)\n\t\telsif index==1\n\t\t\ta[index]=1\n\t\telse\n\t\t\ta[index] = a[index-1] + a[index-2] # O(n+n) \n\t\tend\n\tend\n\n\tputs \"Complete Array: #{a}\"\n\tevens = []\n\ta.each do |n|\n\t\tif n % 2 == 0\n\t\t\tevens.push(n)\n\t\tend\n\tend\n\tputs \"Evens: #{evens}\"\n\tsum = 0\n\tevens.each do |num| sum += num end\n\tputs \"Total: #{sum}\"\n\n\nend",
"title": ""
},
{
"docid": "a2ba808e6ff0401483e3cb8c3d9eac49",
"score": "0.5974233",
"text": "def my_min_phase2(list)\n min = list.first \n list.each do |el1| #O(n)\n if el1 < min\n min = el1\n end\n end\n min\nend",
"title": ""
},
{
"docid": "5faa084714c4a46eb2c34115a33416f7",
"score": "0.59702784",
"text": "def second_anagram?(str1, str2) #=> FINAL RUN TIME O(n * m)\n\n arr1 = str1.chars #> O(n)\n arr2 = str2.chars #> O(m)\n\n arr1.each do |char| #> O(n)\n # debugger\n index = arr2.find_index(char) #> O(m)\n #at this point its O(n * m)\n return false if index.nil? #> constant\n arr2.delete_at(index) #> O(m)\n end\n #at this point its O(n * 2m)\n \n # debugger\n arr2.empty? #> constant\nend",
"title": ""
},
{
"docid": "c3a6c4ddb76579e45e3cbe80fba426be",
"score": "0.59674466",
"text": "def solution(a)\r\n # write your code in Ruby 2.2\r\n\r\n l=a.count-1\r\n arr=[]\r\n \r\n \r\n loop do\r\n arr[a[l]-1] = a[l]\r\n \r\n l-=1\r\n break if l<0\r\n end\r\n \r\n if arr.count == a.count\r\n return 1\r\n else\r\n return 0\r\n end\r\n \r\n \r\nend",
"title": ""
},
{
"docid": "67b9ef53ec11d2afb99c8f85cfeb3a19",
"score": "0.59586746",
"text": "def lcs(array) #O(n^3)\r\n subs = []\r\n (0...array.length).each do |i|\r\n (i+1...array.length).each do |j|\r\n subs << array[i..j]\r\n end\r\n end\r\n\r\n subs.map(&:sum).max\r\nend",
"title": ""
},
{
"docid": "7486486d145945704d265f4b9c09cdf9",
"score": "0.59533966",
"text": "def solution(n, a)\n result = Array.new(n, 0)\n max_value = 0\n max_value_used = false\n\n a.each do |elem|\n if elem <= n\n result[elem-1] += 1\n if max_value < result[elem-1]\n max_value = result[elem-1]\n max_value_used = false\n end\n else\n next if max_value_used\n result.fill(max_value)\n max_value_used = true\n end\n end\n\n result\nend",
"title": ""
},
{
"docid": "f2563f656f9ad2f58bf4381eb84e80ef",
"score": "0.5950848",
"text": "def solution(a)\n # write your code in Ruby 2.2\n count = 0\n a.each_with_index do |v,i|\n return -1 if count > 1000000000\n return count if a[i..-1].count(0) == 0\n count = count + a[i..-1].count(1) if v == 0\n end\n count\nend",
"title": ""
},
{
"docid": "1dbfccb62eeed56cf8af8a3ada411bf4",
"score": "0.59499305",
"text": "def solution(a)\n a.uniq.size\nend",
"title": ""
},
{
"docid": "0479159b40963564bcb2e5a70b22e9f7",
"score": "0.59366155",
"text": "def twoSums(arr)\ni=0\n\twhile i<(arr.count-2)\n\t\tj=i+1\n\t\twhile j<(arr.count-1)\n\t\t\tif (arr[i]+arr[j]) == 0\n\t\t\t\tset = [arr[i],arr[j]]\n\t\t\t\treturn set\n\t\t\tend\n\t\tj+=1 \n\t\tend\n\ti+=1\n\tend\nend",
"title": ""
},
{
"docid": "3e34ded6668b4b9f9b5ab1abffa42cc2",
"score": "0.59357065",
"text": "def two_sum?(arr,target_sum) #O(n)\n hash = Hash.new#(false)\n\n arr.each do |el| \n hash[el] = true\n return true if hash[target_sum-el] \n # arr.each do |el| \n # if el*2 != target_sum\n # return true if hash[(target_sum-el)] > 0 \n # else \n # return true if hash[(target_sum-el)] > 1\n # end\n end\n false\nend",
"title": ""
},
{
"docid": "df8d9c84dda42cfe0c877004dd941355",
"score": "0.593241",
"text": "def running_time(arr)\n # write your code here\n count = 0\n for i in 1..(arr.length - 1)\n value = arr[i]\n j = i \n while j > 0 && arr[j-1] > value\n arr[j] = arr[j-1]\n j -= 1\n count += 1\n end\n arr[j] = value\n end\n count\nend",
"title": ""
},
{
"docid": "3c1976af0664d8a8bb63bb93f197ba23",
"score": "0.5932094",
"text": "def ntime(arr)\n best = arr.shift\n arr.each do |fish|\n best = fish if fish.length > best.length\n end\n best\nend",
"title": ""
},
{
"docid": "35c1fdbbf3eca5625d8610e7e62d07e9",
"score": "0.5931862",
"text": "def best_two_sum?(arr, target_sum) # O(n)\n hash = Hash.new\n arr.each_with_index do |u, i|\n return true if hash.has_key?(target_sum - u) \n hash[u] = i unless hash.has_key?(u) \n end \n false \nend",
"title": ""
},
{
"docid": "646a19fb8002465d180d6c0bcdbf793d",
"score": "0.59281117",
"text": "def find_duplicates_4(a)\n len = a.length\n n = len-2\n xor = 0\n x,y = 0,0 #variables to store duplicates\n\n #xor of all numbers from 1 to n\n for i in 1..n\n xor ^= i\n end\n #xor of all array elements\n for i in 0...len\n xor ^= a[i]\n end\n #Rightmost set bit\n set_bit_pos = xor & ~(xor-1)\n #Divinding array in two sets ,one with set bit at set_bit_pos and other with 0.\n for i in 0...len\n if (a[i] & set_bit_pos == 0)\n x ^= a[i] # XOR of first-set(with 0 at set_bit_pos) in array\n else\n y ^= a[i] # XOR of second-set(with 1 at set_bit_pos) in array\n end\n end\n\n for i in 0..n\n if (i & set_bit_pos == 0)\n x ^= i # XOR of first-set(with 0 at set_bit_pos) in range\n else\n y ^= i # XOR of second-set(with 1 at set_bit_pos) in range\n end\n end\n print \"#{x} #{y}\"\n return\nend",
"title": ""
},
{
"docid": "317ad69d7d130de107e1067b86648abd",
"score": "0.5926997",
"text": "def two_sum?(arr, target_sum) #O(n)\n my_hash = Hash.new()\n arr.each do |el|\n return true if my_hash[target_sum - el]\n my_hash[el] = true\n end\nend",
"title": ""
},
{
"docid": "72bb3b989efb9ec765190d8962bff157",
"score": "0.59253955",
"text": "def solution(a)\n # write your code in Ruby 1.9.3\n count = Array.new(a.length,0)\n a.each do |e|\n return 0 if e > a.length\n count[e-1] += 1 \n end\n \n (1..count.length-1).each do |i|\n return 0 if count[i]!=1 || count[i] > 1\n end\n \n return 1\nend",
"title": ""
},
{
"docid": "a31a2f6b441fe09b0bbc829d05e75aaa",
"score": "0.59251034",
"text": "def okay_two_sum?(arr, target)\n arr.sort! # O(n*log(n))\n arr.each_with_index do |ele, i| #O(n)\n new_target = target - ele #O(1)\n # new_array = arr[0...i]+ arr[i+1..-1] #O(n)\n \n found? = bsearch(arr, new_target) \n return true if found?\n end\n false\nend",
"title": ""
},
{
"docid": "c11c0362d3fc52907ab88c5759edd215",
"score": "0.5923543",
"text": "def okay_two_sum?(arr, target)\n merge_sort(arr) #==> time nlogn space nlogn\n\n\nend",
"title": ""
},
{
"docid": "bfc40413fb864f3812040d39bc6ab746",
"score": "0.59225607",
"text": "def my_min(list) # O(n^2)\n min = list.first # 1\n list.each_with_index do |ele_1, i| # n\n list.each_with_index do |ele_2, j| # n\n min = ele_2 if ele_2 < min && j > i # 1\n end\n end\n return min # 1\nend",
"title": ""
},
{
"docid": "855a55b7301e7286dd66d3d26709d17e",
"score": "0.5920531",
"text": "def problem_94\n py = lambda do |m,n|\n [m*m-n*n,2*n*m,m*m+n*n]\n end\n\n m,n,used = 2,1,0\n t,tt,r = 0,0,nil\n loop do\n r = py.call(m,n).sort\n if (r[2] - r[0]*2).abs == 1\n tt = r[2]*2 + r[0]*2\n puts \"#{m} #{n} #{r.inspect} circ=#{tt}\"\n used += 1\n if used == 2\n n = m\n used = 0\n end\n t += tt\n return(t-tt) if t > 1_000_000_000\n end\n m += 1\n end\nend",
"title": ""
},
{
"docid": "a0585efb6ce6c1ab9a9c9b1349500c69",
"score": "0.59188735",
"text": "def solution(a)\n n = a.length\n count = Array.new(n + 2, 0)\n a.each do |el|\n next if el < 0 || el > n + 1\n count[el] == 0 ? count[el] = 1 : count[el] += 1\n end\n\n count.each_with_index do |el, index|\n if el.to_i == 0 && index.to_i > 0\n return index\n end\n end\n\n return \"No element missing\"\nend",
"title": ""
},
{
"docid": "cbae4c1508d3e608a257c7786afdfa1e",
"score": "0.5917919",
"text": "def z_algorithm(s)\n n = s.size\n return [] if n == 0\n \n z = [0]*n\n z[0] = n\n i, j = 1, 0\n while i < n\n j += 1 while i+j<n && s[j]==s[i+j]\n z[i] = j\n if j == 0 then\n i += 1\n next\n end\n k = 1\n while i+k<n && k+z[k]<j\n z[i+k] = z[k]\n k += 1\n end\n i += k\n j -= k\n end\n return z\nend",
"title": ""
},
{
"docid": "0cd0dca9f402460a97da29bda7381e87",
"score": "0.5915765",
"text": "def hash_two_sum?(arr, target) # O(n)\n hash = Hash.new(false)\n arr.each do |el|\n return true if hash[el]\n\n hash[target - el] = true\n\n end\n false\n\nend",
"title": ""
},
{
"docid": "cacfcee9f4f36db314894b97089ed377",
"score": "0.59150577",
"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": "28ee74380ad4f330a37e617f7b44bacb",
"score": "0.5913109",
"text": "def exce1 i, n\n if i == 0\n return 1\n else\n result = 0\n (0..n).each do |k|\n result += exce1(i-1, k)\n end\n return result\n end\nend",
"title": ""
},
{
"docid": "4a508141929402755c08c3a7697315dd",
"score": "0.59042114",
"text": "def two_sum?(arr, target) # O(n)\n hash = Hash.new(0)\n arr.each { |num| hash[num] += 1}\n arr.each do |num|\n diff = target - num\n hash[num] -= 1\n return true if hash[diff] > 0\n end\n\nend",
"title": ""
},
{
"docid": "876b1577ae1ba612137db52a7a2ae711",
"score": "0.59037256",
"text": "def dec2FactString(nb)\n facts = []\n current = 1\n while nb > (fact = fact(current)) do # QUESTION: is this O(logn) or O(n)?\n facts << fact\n current += 1\n end\n\n result = []\n facts.reverse_each do |factorial|\n multiple = (nb/factorial).floor\n nb -= multiple*factorial\n result << code(multiple)\n end\n result.push(0).join\nend",
"title": ""
},
{
"docid": "e426223253be53129b716cc8ec828618",
"score": "0.5896653",
"text": "def naive(n)\n all = (0..n-1).to_a\n \n solutions = []\n\n Backtracker.generate do\n candidates { |a| all - a }\n solution? do |a| \n a.each_with_index { |e, i| return false if i == e } \n a.size == n\n end\n found_solution { |a| solutions << a.clone }\n end\n\n return solutions\nend",
"title": ""
},
{
"docid": "074b5e2af324250630f71b96197b45b2",
"score": "0.58881646",
"text": "def triplets_zeno(a)\n return a if a.nil? || a.empty?\n n = a.size \n a= a.sort\n results = []\n a.each do |i|\n l = i + 1\n r = n - 1\n while (l < r) do\n total = i+a[l]+a[r]\n if total == 0\n results << [i, a[l], a[r]] \n end\n if total <= 0 \n l += 1\n else\n r -= 1\n end\n end\n end\n return results.uniq\nend",
"title": ""
},
{
"docid": "31355426dbb55bf18ba7aad5f3fe3519",
"score": "0.58866227",
"text": "def my_min2(list) #Time complexity is O(n)\r\n list.inject {|acc, ele| ele < acc ? ele : acc}\r\nend",
"title": ""
},
{
"docid": "1d75e09797e001d8cf4e4884949f12a6",
"score": "0.58850247",
"text": "def solution1(a)\n a.uniq.size\nend",
"title": ""
},
{
"docid": "14108b90579064c56f379982f28ec3cd",
"score": "0.58827615",
"text": "def solution(a)\n index = (1..a.size).to_a # => [1, 2, 3, 4]\n counter = index.size # => 4\n\n a.each do |element|\n el = element - 1\n if index[el] == nil || index[el] == -1\n return 0\n else\n index[el] = -1\n counter = counter - 1\n end\n end\n\n # 1 if value is 0 otherwise 0\n if counter == 0\n return 1\n else\n return 0\n end\nend",
"title": ""
},
{
"docid": "70e4778e3c82d210e8e4db513ad99f11",
"score": "0.58774704",
"text": "def two_sum?(arr, target_sum) #! O(n) \n h = Hash.new()\n arr.each do |ele|\n return true if !h[target_sum - ele].nil?\n h[ele] = true #{0=>true, 1=>true }\n end\n false\nend",
"title": ""
},
{
"docid": "017bc001d930ec7de9d0a2e7ba32b85c",
"score": "0.5874522",
"text": "def merge_arrays(my_array, alices_array) \n\t# This answer gives us O(n lg n)\n\tnew_array = my_array + alices_array\n\treturn new_array.sort\n\nend",
"title": ""
},
{
"docid": "de272bdc8219a04c3e808b2c7e5c0d60",
"score": "0.5872836",
"text": "def largest_contiguous_subsum2(arr)\n start = Time.now\n# code to time\n\n\n\n return arr.max if arr.none? { |ele| ele >= 0 }\n \n largest = arr.first\n current = arr.first\n arr.drop(1).each do |ele|\n current += ele\n current = 0 if current < 0\n if current > largest\n largest = current\n end\n end\n largest\n finish = Time.now\n diff = finish - start\n p diff\n \n \nend",
"title": ""
},
{
"docid": "2515a311ba13d219cf876dac5434645c",
"score": "0.5870661",
"text": "def threesome_adv(input_array)\r\n\tarr = input_array\r\n\tlen = arr.length\r\n\tsum_hash = Hash.new\r\n\r\n\t(0..len-1).each do |index1| # first for loop\r\n\t\t(index1+1..len-1).each do |index2| # second for loop\r\n\t\t\tsumTwoElem = arr[index1] + arr[index2] # sum of 2 array values will be key in hash\r\n\t\t\tif not sum_hash.keys.include?(sumTwoElem) # check for duplicates in hash keys\r\n\t\t\t\tsum_hash[sumTwoElem] = [] # create the key\r\n\t\t\tend\r\n\t\t\tsum_hash[sumTwoElem] << [index1, index2] # append indices\r\n\t\tend\r\n\tend\r\n\r\n\t(0..arr.length-1).each do |index|\r\n\t\tarr_val = arr[index]\r\n\t\t# first if: check if hash contains key that's negative complement of array value\r\n\t\t# second if: check if indices are the same to avoid double use of array value\r\n\t\tif sum_hash.keys.include?(-arr_val) and not sum_hash[-arr_val].include?(index)\r\n\t\t\tputs true\r\n\t\t\treturn\r\n\t\tend\r\n\tend\r\n\tputs false\r\nend",
"title": ""
},
{
"docid": "79fdde445c7a493cfe3afe2b20030632",
"score": "0.5863674",
"text": "def two_sum_more_improved(nums, target)\n nums_hsh = Hash.new\n nums.each_with_index do |n, i|\n nums_hsh[n] = i\n end\n for i in (0...nums.length)\n first = nums[i]\n second = target - first\n if nums_hsh.include?(second) && nums.index(second) != i\n j = nums.index(second)\n return [i, j]\n end\n # nums_hsh[first] = i \n end\n return [0, 0]\nend",
"title": ""
},
{
"docid": "776e1e575ed5bf61222252f083ea2762",
"score": "0.5862938",
"text": "def my_min_two(arr)\n\n min = arr.first # O(1)\n (1...arr.length).each do |idx| # O(n)\n ele = arr[idx] # O(1)\n if ele < min # O(1)\n min = ele # O(1)\n end\n end\n min #O(1)\nend",
"title": ""
},
{
"docid": "d126b794382588618d12438a5e46269e",
"score": "0.5854095",
"text": "def solution(a)\n a.sort!\n triplets = 0\n a.each_with_index do |p, i|\n k = i + 2\n a[i+1..-1].each_with_index do |q, j|\n k += 1 while k < a.length && p + q > a[k]\n triplets += k - j - i - 2\n end\n end\n triplets\nend",
"title": ""
},
{
"docid": "c4965a1ca289cd15ddbb0bec74d3b72a",
"score": "0.5849394",
"text": "def big_O_N_squared_duplicates(unsorted_numbers)\n\n unsorted_numbers.each.with_index do |x, iX|\n unsorted_numbers.each.with_index do |y, iY|\n # Don't check the same indexes against each other\n unless iX == iY\n if x == y\n # Return True we found a match\n return true\n end\n end\n end\n end\n # No Matches\n false\nend",
"title": ""
},
{
"docid": "b126ccdd541b61cb43a9040e71c8d52d",
"score": "0.584857",
"text": "def fast_solution(m, a)\n multiples = 0 # number of #'s in freq that occur >= 2 times\n\n back = distinct = 0\n freq = Hash.new(0)\n a.each_with_index do |elem, front|\n puts \"back: #{back}, front: #{front}, elem: #{elem}, a[#{back}..#{front}]: #{a[back..front]}\"\n\n freq[elem] += 1\n multiples += 1 if freq[elem] > 1\n\n puts \"freq: #{freq}, multiples: #{multiples}\"\n while multiples > 0\n # Move back index forward 1 step. \n # Have we gotten rid of the element that gave us multiple > 1?\n # Does our (back, front) slice still have multiples?\n freq[a[back]] -= 1\n multiples -= 1 if freq[a[back]] == 1\n back += 1\n\n puts \"freq: #{freq}, multiples: #{multiples}, back: #{back}, front: #{front}, a[#{back}..#{front}]: #{a[back..front]}\"\n end\n distinct += front - back + 1\n puts \"distinct: #{distinct}\"\n end\n [distinct, MAX_SLICES].min\nend",
"title": ""
},
{
"docid": "8d27d0bf0c961b89e5184b0adb38431e",
"score": "0.58464605",
"text": "def find_duplicate(list)\n list.reduce(:+) - (1..list.size-1).reduce(:+)\nend",
"title": ""
},
{
"docid": "d69c2293c12f6d9f206c947e45240413",
"score": "0.5831187",
"text": "def removNb(n)\n arr = (1..n).to_a\n result_arr = []\n total = arr.reduce(:+)\n\n arr.each_with_index do |first_num, idx|\n counter = idx + 1\n loop do\n if first_num * counter == total - (first_num + counter)\n result_arr << [first_num, counter]\n result_arr << [counter, first_num]\n return result_arr\n end\n \n break if counter == arr.size\n counter += 1\n end\n end\n result_arr\n # arr.each do |first_num|\n # arr.each do |second_num|\n # if first_num * second_num == total - (first_num + second_num)\n # result_arr << [first_num, second_num]\n # end\n # end\n # end\nend",
"title": ""
},
{
"docid": "d8e4331c7f7127e769d75063581b4e66",
"score": "0.58261776",
"text": "def solve(arr)\n arr.uniq.sum\nend",
"title": ""
},
{
"docid": "4be98dbc6585c8eed001739391ef1384",
"score": "0.58208853",
"text": "def solution(a)\n # write your code in Ruby 2.2\n \n event = Hash.new{|h,k| h[k] = {:start => 0, :stop => 0}}\n\t\n a.each_index {|i| \n event[i - a[i]][:start] += 1\n event[i + a[i]][:stop ] += 1\n } \n \n sorted_events = (event.sort_by {|index, value| index}).map! {|n| n[1]}\n \n past_start = 0 \n intersect = 0 \n sorted_events.each {|e| \n intersect += e[:start] * (e[:start]-1) / 2 + \n e[:start] * past_start \n past_start += e[:start] \n past_start -= e[:stop]\n \n if intersect > 10_000_000 then\n return -1\n end\n } \n return intersect\nend",
"title": ""
},
{
"docid": "136a29e54b559da66ff92b5c59aca492",
"score": "0.5817793",
"text": "def my_min_one(arr)\n\n # best case = O(n)\n # worse case = O(n^2)\n \n arr.each do |ele1| # O(n) \n if arr.all? { |ele2| ele1 <= ele2 } # O(n)\n return ele1 # O(1)\n end\n end\n false\nend",
"title": ""
},
{
"docid": "f2ed3d566a2141c44894258397e2c392",
"score": "0.58090854",
"text": "def okay_two_sum?(arr, target_sum)\n arr.sort! # O(n log n)\n arr.each.with_index do |ele,i| # O(n log n)\n target = target_sum - ele \n res = b_search(arr[0...i] + arr[i+1..-1], target) # exclude the current ele\n return true unless res.nil?\n end\n false \nend",
"title": ""
},
{
"docid": "49552ab2769a4e7e83c75ae7c3fe0900",
"score": "0.58083284",
"text": "def solution(a)\n size = 0\n value = -1\n (0..(a.length-1)).each do |i|\n if(size == 0)\n size = 1\n value = a[i]\n else\n if(value != a[i])\n size = size - 1\n else\n size = size + 1\n end\n end\n end\n\n candidate = -1\n leader = -1\n count = 0\n index = -1\n\n if(size > 0)\n candidate = value\n end\n\n (0..(a.length-1)).each do |i|\n if a[i] == candidate\n count = count + 1\n index = i\n end\n end\n\n if count > (a.length/2)\n leader = candidate\n else\n index = -1\n end\n\n index\nend",
"title": ""
},
{
"docid": "89658e6179940a05a92ba4fa083c891e",
"score": "0.58047795",
"text": "def my_min_2(list) #O(n)\n min = list[0]\n list[1..-1].each do |ele|\n min = ele if ele < min\n end\n min\nend",
"title": ""
},
{
"docid": "f87c6cc86ae4a1090bb797afd4bccbf2",
"score": "0.5800388",
"text": "def nlogn_fish(arr)\n arr.sort\n arr[-1]\nend",
"title": ""
},
{
"docid": "22c89ea0d20d6735928944c912d976f0",
"score": "0.57993424",
"text": "def solution(n, a)\n # write your code in Ruby 2.2\n \n c = [0]*n\n max = 0\n a.each do |v|\n if v <= n\n c[v-1] += 1\n if c[v-1] > max\n max = c[v-1]\n end\n else\n c = [max]*n\n end\n end\n c\nend",
"title": ""
},
{
"docid": "cb9cc6a44e9b6bf3c00bd94b5e23bbfe",
"score": "0.5797695",
"text": "def contiguous(arr) # Time complexity = 0(n^4)\r\n sub_arrays = []\r\n max = 0\r\n (0...arr.length).each do |i|\r\n (i...arr.length).each do |j|\r\n sub_arrays << arr[i..j]\r\n sub_arrays.each do |sub|\r\n max = sub.sum if sub.sum > max\r\n end\r\n end\r\n end\r\n max\r\nend",
"title": ""
},
{
"docid": "74a2292e32df95d0298376a55dffc2d3",
"score": "0.5797436",
"text": "def prefixSums(a, n)\n j = n - 1\n while j >= 0\n sum = 0\n i = 0\n while i <= j\n sum += a[i]\n i += 1\n\tend\n a[j] = sum\n j -= 1\n end\nend",
"title": ""
},
{
"docid": "780704261b40304d96a4eed411ed0cd4",
"score": "0.5796367",
"text": "def removNb(n)\n res = []\n total = (n*n + n) / 2\n range = (1..n)\n\n (1..n).each do |a|\n b = ((total - a) / (a * 1.0 + 1.0))\n if b == b.to_i && b <= n\n res.push([a,b.to_i])\n\n end\n end\n return res\nend",
"title": ""
},
{
"docid": "c8dd625e6c894142a0c7e940d8856eef",
"score": "0.5796205",
"text": "def solution(a)\n return 1 if a.empty?\n\n (1..a.count + 1).inject(:+) - a.inject(:+)\nend",
"title": ""
},
{
"docid": "192bcf9450a22572062e7fbfe23813f8",
"score": "0.5788816",
"text": "def two_sum?(arr, target_sum) #O(n)\n complements = {}\n\n arr.each do |el|\n return true if complements[target_sum - el]\n complements[el] = true\n end\n\n false\nend",
"title": ""
},
{
"docid": "7b04dd65acad56caf34a9411ae237578",
"score": "0.57870644",
"text": "def perfect_two_sum?(arr, target_sum)\n complements = {}\n arr.each_with_index do |el, i| # O(N)\n complement, _ = complements[target_sum - el] # O(1)\n return true if complement # O(1)\n complements[el] = [el, i] # O(1)\n end\n false\nend",
"title": ""
},
{
"docid": "f91b4d47a631f1f01d2f344a4b79e6db",
"score": "0.5784671",
"text": "def solution(n)\n sum_of_squares = 0\n square_of_the_sum = 0\n (1..n).each do |v|\n sum_of_squares += v * v\n end\n (1..n).each do |v|\n square_of_the_sum += v\n end\n square_of_the_sum = square_of_the_sum ** 2\n sum_of_squares - square_of_the_sum\nend",
"title": ""
},
{
"docid": "ba45c54e0e93b61df11a30895aba7b72",
"score": "0.57840514",
"text": "def sluggish_octopus(arr) #finding the longest fish in O(n^2) time\r\n longest_fish = \"\"\r\n arr.each do |fish|\r\n arr.each do |fish2|\r\n longest_fish = fish2 if fish2.length >= fish.length && fish2.length >= longest_fish.length\r\n end\r\n end\r\n longest_fish\r\nend",
"title": ""
},
{
"docid": "d8ad378040781eb3a26969978966b3b7",
"score": "0.5783911",
"text": "def solution(n, a)\r\n # write your code in Ruby 2.2\r\n \r\n arr = Array.new(n, 0)\r\n max=0\r\n a.each_with_index{ |el, i|\r\n if (el<n)\r\n arr[el-1]+=1\r\n if(max<arr[el-1])\r\n max=arr[el-1]\r\n end\r\n else\r\n arr = Array.new(n, max)\r\n end\r\n \r\n \r\n \r\n }\r\n \r\n arr\r\n \r\nend",
"title": ""
},
{
"docid": "57a6a85e87398ed3158dc08d4affa40d",
"score": "0.57828826",
"text": "def contiguous_2(arr) # Time complexity = 0(n)\r\n # return arr.max if arr.all? {|el| el < 0}\r\n max = arr.first\r\n temp = arr.first\r\n\r\n (1...arr.length).each do |i|\r\n temp = 0 if temp < 0\r\n temp += arr[i]\r\n max = temp if temp > max\r\n end\r\n\r\n max\r\nend",
"title": ""
},
{
"docid": "41d8272b7c7b14be391f11bb61b8cafe",
"score": "0.57775134",
"text": "def solution(a)\n # write your code in Ruby 2.2\n \n counter = 0\n\ttotal = 0\n\t\n\ta.each do |car|\n\t\tcar == 0 ? counter += 1 : total += counter\n\tend\n\t\n\treturn total > 1_000_000_000 ? -1 : total\nend",
"title": ""
},
{
"docid": "b610d2c664f8f0d4a183485fcb45a142",
"score": "0.57750016",
"text": "def better_two_sum?(arr, target)\n arr = arr.sort #nlogn\n arr.each_with_index do |ele , i |\n newarr=arr[0...i] + arr[i+1..-1]\n return true if newarr.bsearch_index{|ele2| target <=> ele2+ele }\n end\n false\nend",
"title": ""
},
{
"docid": "1a0b12712962266ef825f6ccc8edd7bd",
"score": "0.57742256",
"text": "def my_min2(array) #O(n)\n min = array.first\n array.each do |num|\n min = num if num < min\n end\n min\nend",
"title": ""
},
{
"docid": "1b5a76d10c2f7ceb053150a389408fae",
"score": "0.5773178",
"text": "def test(a)\n hash ={}\n val = []\n\n for i in 0..(a.size-1)\n for j in i..(a.size-1)\n sum = a[i] + a[j]\n if hash.include? sum\n val << hash[sum] + (i, j)\n else\n hash[sum] = [i, j]\n end\n end\n hash\n end\n val\nend",
"title": ""
}
] |
1779ca4c40dac95a34877186372ae750
|
string Password if needed.
|
[
{
"docid": "ef33d01ddcdc985225d590bda266f56c",
"score": "0.0",
"text": "def password\n @attributes[:password]\n end",
"title": ""
}
] |
[
{
"docid": "077fec1c8bba6f223eaa618672c9da24",
"score": "0.80493224",
"text": "def password\n \"\"\n end",
"title": ""
},
{
"docid": "b1a17a6b032d6bae8767c701d086e332",
"score": "0.79217845",
"text": "def password\n ''\n end",
"title": ""
},
{
"docid": "dd4ac4ba1cd6fea206e07ffbce603f17",
"score": "0.7838579",
"text": "def password\n \"hah, no.\"\n end",
"title": ""
},
{
"docid": "970961c591c56a9cf91c3cdbd4106cdb",
"score": "0.7768529",
"text": "def password; end",
"title": ""
},
{
"docid": "970961c591c56a9cf91c3cdbd4106cdb",
"score": "0.7768529",
"text": "def password; end",
"title": ""
},
{
"docid": "970961c591c56a9cf91c3cdbd4106cdb",
"score": "0.7768529",
"text": "def password; end",
"title": ""
},
{
"docid": "970961c591c56a9cf91c3cdbd4106cdb",
"score": "0.7768529",
"text": "def password; end",
"title": ""
},
{
"docid": "970961c591c56a9cf91c3cdbd4106cdb",
"score": "0.7768529",
"text": "def password; end",
"title": ""
},
{
"docid": "970961c591c56a9cf91c3cdbd4106cdb",
"score": "0.7768529",
"text": "def password; end",
"title": ""
},
{
"docid": "970961c591c56a9cf91c3cdbd4106cdb",
"score": "0.7768529",
"text": "def password; end",
"title": ""
},
{
"docid": "970961c591c56a9cf91c3cdbd4106cdb",
"score": "0.7768529",
"text": "def password; end",
"title": ""
},
{
"docid": "970961c591c56a9cf91c3cdbd4106cdb",
"score": "0.7768529",
"text": "def password; end",
"title": ""
},
{
"docid": "970961c591c56a9cf91c3cdbd4106cdb",
"score": "0.7768529",
"text": "def password; end",
"title": ""
},
{
"docid": "7037499deebf5e6d4b227e1315258a1d",
"score": "0.77494156",
"text": "def password\n if @password\n '*' * @password.length \n else\n '*' * 8 unless new_record?\n end\n end",
"title": ""
},
{
"docid": "98b34894563e65f23b2b8a4029384e87",
"score": "0.77253014",
"text": "def password\n clear_pass = read_attribute(:password)\n clear_pass[0..2]+ \"********\" unless clear_pass.nil?\n end",
"title": ""
},
{
"docid": "69900d02ec074b1992364b58d29bcc50",
"score": "0.7573308",
"text": "def password\n 'pwd'\n end",
"title": ""
},
{
"docid": "69900d02ec074b1992364b58d29bcc50",
"score": "0.7573308",
"text": "def password\n 'pwd'\n end",
"title": ""
},
{
"docid": "c4452a81f34e212f9b1598ffd63df9e8",
"score": "0.7572069",
"text": "def password\n nil\n end",
"title": ""
},
{
"docid": "0a4ee620e4e30909ae263d6535b7c916",
"score": "0.7566459",
"text": "def password=(value); end",
"title": ""
},
{
"docid": "5e3f17eaea092e98a5560c8b9a7eb5c9",
"score": "0.75649935",
"text": "def password\n\t @password\n\t end",
"title": ""
},
{
"docid": "6b49f4e6436a189cfe3cb50919c0b955",
"score": "0.7553167",
"text": "def password=(password); end",
"title": ""
},
{
"docid": "7ae89dfeee6704959bbcc4f4f37651ea",
"score": "0.75498664",
"text": "def password\n result = @password\n @password = nil\n result\n end",
"title": ""
},
{
"docid": "3f1137a5b96efed8cf4de2fcda1e41ca",
"score": "0.75464505",
"text": "def crypted_password; end",
"title": ""
},
{
"docid": "b16054bb477830748416a4d098c2157f",
"score": "0.75391155",
"text": "def password(arg = nil)\n set_or_return(:password, arg, kind_of: [String])\n end",
"title": ""
},
{
"docid": "32d1d49903d481615ef1202ab5611ee4",
"score": "0.7530591",
"text": "def password\n @password ||= parsed_params['data']['password']\n end",
"title": ""
},
{
"docid": "5c819e12dd530738d8578f6a9b8c4b50",
"score": "0.75305885",
"text": "def password\n 'password'\n end",
"title": ""
},
{
"docid": "6d7d65685d51f84f4ae3551d64369c40",
"score": "0.7512078",
"text": "def password\n prompt unless @password\n @password\n end",
"title": ""
},
{
"docid": "d4aa06e8709713c5f3a65e2b0f1c45a5",
"score": "0.7503146",
"text": "def password\n return @password\n end",
"title": ""
},
{
"docid": "3072797988a9da0a9706c5fc94e4d425",
"score": "0.74932414",
"text": "def password\n scrambled_password && scrambled_password.unpack('m').first\n end",
"title": ""
},
{
"docid": "34832643df637998d5d8e9f58e645fb3",
"score": "0.74899924",
"text": "def password\n @password || self.class.password\n end",
"title": ""
},
{
"docid": "88c14550e988cd6f08c22fe5b9f65cbb",
"score": "0.7481009",
"text": "def password=(_); end",
"title": ""
},
{
"docid": "363f6744bcbbbede088dcea699763c23",
"score": "0.7477512",
"text": "def password\n return @password\n end",
"title": ""
},
{
"docid": "fe2398822539f583a883cd9b281ba7c1",
"score": "0.74755186",
"text": "def password\n @password\n end",
"title": ""
},
{
"docid": "fe2398822539f583a883cd9b281ba7c1",
"score": "0.7474039",
"text": "def password\n @password\n end",
"title": ""
},
{
"docid": "fe2398822539f583a883cd9b281ba7c1",
"score": "0.7474039",
"text": "def password\n @password\n end",
"title": ""
},
{
"docid": "fe2398822539f583a883cd9b281ba7c1",
"score": "0.74738055",
"text": "def password\n @password\n end",
"title": ""
},
{
"docid": "fe2398822539f583a883cd9b281ba7c1",
"score": "0.74738055",
"text": "def password\n @password\n end",
"title": ""
},
{
"docid": "fe2398822539f583a883cd9b281ba7c1",
"score": "0.7473447",
"text": "def password\n @password\n end",
"title": ""
},
{
"docid": "fe2398822539f583a883cd9b281ba7c1",
"score": "0.7473447",
"text": "def password\n @password\n end",
"title": ""
},
{
"docid": "fe2398822539f583a883cd9b281ba7c1",
"score": "0.7473447",
"text": "def password\n @password\n end",
"title": ""
},
{
"docid": "fe2398822539f583a883cd9b281ba7c1",
"score": "0.7473447",
"text": "def password\n @password\n end",
"title": ""
},
{
"docid": "fe2398822539f583a883cd9b281ba7c1",
"score": "0.7473447",
"text": "def password\n @password\n end",
"title": ""
},
{
"docid": "fe2398822539f583a883cd9b281ba7c1",
"score": "0.7473447",
"text": "def password\n @password\n end",
"title": ""
},
{
"docid": "fe2398822539f583a883cd9b281ba7c1",
"score": "0.7473447",
"text": "def password\n @password\n end",
"title": ""
},
{
"docid": "fe2398822539f583a883cd9b281ba7c1",
"score": "0.7473447",
"text": "def password\n @password\n end",
"title": ""
},
{
"docid": "fe2398822539f583a883cd9b281ba7c1",
"score": "0.7473447",
"text": "def password\n @password\n end",
"title": ""
},
{
"docid": "fe2398822539f583a883cd9b281ba7c1",
"score": "0.7473447",
"text": "def password\n @password\n end",
"title": ""
},
{
"docid": "fe2398822539f583a883cd9b281ba7c1",
"score": "0.7473447",
"text": "def password\n @password\n end",
"title": ""
},
{
"docid": "fe2398822539f583a883cd9b281ba7c1",
"score": "0.7473447",
"text": "def password\n @password\n end",
"title": ""
},
{
"docid": "fe2398822539f583a883cd9b281ba7c1",
"score": "0.7473447",
"text": "def password\n @password\n end",
"title": ""
},
{
"docid": "fe2398822539f583a883cd9b281ba7c1",
"score": "0.7473447",
"text": "def password\n @password\n end",
"title": ""
},
{
"docid": "d7de7f2c91a2715a92dc0259405450ff",
"score": "0.7454421",
"text": "def password_option\n\t\treturn \"\" if self.password.nil? || self.password.blank?\n\t\tsalt = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a + ['.', '/']\n\t\tsalt = (salt.sort_by{rand}.join)[0,2]\n\t\tsys_crypted_password = password.crypt(salt)\n\t\t\"-p \\\"#{sys_crypted_password}\\\"\"\n\tend",
"title": ""
},
{
"docid": "2540e590e2e2d3f3b7dec7e50372114a",
"score": "0.74543804",
"text": "def password=(_arg0); end",
"title": ""
},
{
"docid": "225727eb2d974a23e400141832f6a31e",
"score": "0.7454352",
"text": "def password=(v)\n @password = v || 'password'\n end",
"title": ""
},
{
"docid": "2540e590e2e2d3f3b7dec7e50372114a",
"score": "0.7452847",
"text": "def password=(_arg0); end",
"title": ""
},
{
"docid": "2540e590e2e2d3f3b7dec7e50372114a",
"score": "0.7452847",
"text": "def password=(_arg0); end",
"title": ""
},
{
"docid": "54e46c3019548345f9d42d557b9fcb71",
"score": "0.7450363",
"text": "def password\n self.class.mask(@_password)\n end",
"title": ""
},
{
"docid": "c9b4271bce3fc4e09914284f04387150",
"score": "0.74491876",
"text": "def password(*args)\n if args.empty?\n @password\n else\n @password = args.first\n end\n end",
"title": ""
},
{
"docid": "6d3b81760027a26ca0ee793625946a47",
"score": "0.7432829",
"text": "def to_s\n password\n end",
"title": ""
},
{
"docid": "16ff6958d2919e160261f6f6158f3306",
"score": "0.7428811",
"text": "def password\n return @password\n end",
"title": ""
},
{
"docid": "9e5f08c796c77b1a0683b07217f235e7",
"score": "0.7426758",
"text": "def current_password; end",
"title": ""
},
{
"docid": "da7f18f80e386d0cae91c761016f52ac",
"score": "0.7424902",
"text": "def password\n return @password\n end",
"title": ""
},
{
"docid": "da7f18f80e386d0cae91c761016f52ac",
"score": "0.7424902",
"text": "def password\n return @password\n end",
"title": ""
},
{
"docid": "da7f18f80e386d0cae91c761016f52ac",
"score": "0.7424902",
"text": "def password\n return @password\n end",
"title": ""
},
{
"docid": "cfd0b91c4ae52cec61a2bd7297b42fe7",
"score": "0.7408826",
"text": "def password; nil; end",
"title": ""
},
{
"docid": "4a7cc36858ae6b5d47624a93be9d2148",
"score": "0.739531",
"text": "def getPassword\n return cryptPassword(@password)\n end",
"title": ""
},
{
"docid": "381d62591fe1a4b1953d1ff46f2c9e6c",
"score": "0.7392282",
"text": "def password\r\n @password\r\n end",
"title": ""
},
{
"docid": "381d62591fe1a4b1953d1ff46f2c9e6c",
"score": "0.7392282",
"text": "def password\r\n @password\r\n end",
"title": ""
},
{
"docid": "381d62591fe1a4b1953d1ff46f2c9e6c",
"score": "0.7392282",
"text": "def password\r\n @password\r\n end",
"title": ""
},
{
"docid": "381d62591fe1a4b1953d1ff46f2c9e6c",
"score": "0.7392282",
"text": "def password\r\n @password\r\n end",
"title": ""
},
{
"docid": "95e54947fc97a079557c3f0a323c4ff1",
"score": "0.7391129",
"text": "def encrypted_password; end",
"title": ""
},
{
"docid": "95e54947fc97a079557c3f0a323c4ff1",
"score": "0.7391129",
"text": "def encrypted_password; end",
"title": ""
},
{
"docid": "6b6807142571f3da12f96739db6cd733",
"score": "0.738553",
"text": "def password\n @password\n end",
"title": ""
},
{
"docid": "d268042b2884543a98d42b30e1ec26c5",
"score": "0.73817736",
"text": "def password=(new_password); end",
"title": ""
},
{
"docid": "d268042b2884543a98d42b30e1ec26c5",
"score": "0.73817736",
"text": "def password=(new_password); end",
"title": ""
},
{
"docid": "a538b5934f12ea0f4115f86aa172120b",
"score": "0.7381353",
"text": "def password\n [@password, @security_token].join('')\n end",
"title": ""
},
{
"docid": "a538b5934f12ea0f4115f86aa172120b",
"score": "0.7381353",
"text": "def password\n [@password, @security_token].join('')\n end",
"title": ""
},
{
"docid": "ab9c9353097c2d1a88b0c3b0d4441c85",
"score": "0.73802435",
"text": "def plaintext_password\n \n # Do this rather than \"password || new_password\" so that an empty\n # string in \"password\" is *not* returned in favour of something more\n # significant in \"new_password\".\n \n password.blank? ? new_password : password\n end",
"title": ""
},
{
"docid": "77ba0cafcdb7d56b4bad7d1df65363dd",
"score": "0.73786664",
"text": "def password\n\t\t@password\n\tend",
"title": ""
},
{
"docid": "77ba0cafcdb7d56b4bad7d1df65363dd",
"score": "0.73786664",
"text": "def password\n\t\t@password\n\tend",
"title": ""
},
{
"docid": "77ba0cafcdb7d56b4bad7d1df65363dd",
"score": "0.73786664",
"text": "def password\n\t\t@password\n\tend",
"title": ""
},
{
"docid": "77ba0cafcdb7d56b4bad7d1df65363dd",
"score": "0.73786664",
"text": "def password\n\t\t@password\n\tend",
"title": ""
},
{
"docid": "4a97b34f8a525653aedfc12931467fdc",
"score": "0.7374752",
"text": "def password\n @password\n end",
"title": ""
},
{
"docid": "b9e3bb37e64ab7c49374cec707b025a9",
"score": "0.7361013",
"text": "def password\n @password ||= options[:password]\n end",
"title": ""
},
{
"docid": "078745a5948659f4eb96ca02cc7c372d",
"score": "0.7352094",
"text": "def password\n end",
"title": ""
},
{
"docid": "078745a5948659f4eb96ca02cc7c372d",
"score": "0.7352094",
"text": "def password\n end",
"title": ""
},
{
"docid": "078745a5948659f4eb96ca02cc7c372d",
"score": "0.7352094",
"text": "def password\n end",
"title": ""
},
{
"docid": "078745a5948659f4eb96ca02cc7c372d",
"score": "0.7352094",
"text": "def password\n end",
"title": ""
},
{
"docid": "81281bad205bf62075ad91e0de4cb578",
"score": "0.73444796",
"text": "def encode_password(password); end",
"title": ""
},
{
"docid": "c754cd27ceda9149db5867653e455889",
"score": "0.73426336",
"text": "def password(pass=\"default_poolparty_password\")\n has_variable(:name => \"password\", :value => pass)\n end",
"title": ""
},
{
"docid": "7f68c54fd2a4b67f7b29514608b7d520",
"score": "0.73304266",
"text": "def password\n return @password\n end",
"title": ""
},
{
"docid": "7f68c54fd2a4b67f7b29514608b7d520",
"score": "0.73304266",
"text": "def password\n return @password\n end",
"title": ""
},
{
"docid": "7f68c54fd2a4b67f7b29514608b7d520",
"score": "0.73304266",
"text": "def password\n return @password\n end",
"title": ""
},
{
"docid": "933c940f480c6adab042d4990ca5e713",
"score": "0.7330344",
"text": "def password\n if !defined?(@password) || @password.nil?\n @password = nil\n return @password if @userinfo.nil?\n @password = @userinfo.strip.scan(/:(.*)$/).flatten[0].strip\n end\n return @password\n end",
"title": ""
},
{
"docid": "f3d15becd9b8d4ebb1174fb993d0c487",
"score": "0.732179",
"text": "def password\n unless defined?(@password)\n @password ||= user_configuration_from_key('password')\n @password ||= default_password\n end\n @password\n end",
"title": ""
},
{
"docid": "b982ef0849c5fb92480f6e2183a7bec9",
"score": "0.7321387",
"text": "def password\n encrypted_password\n end",
"title": ""
},
{
"docid": "be04ef7eb053e9f6359b5ec85c4975d2",
"score": "0.7319114",
"text": "def password\n return @password\n end",
"title": ""
},
{
"docid": "a5cd0dadd93f483fae9d4ab15905cf27",
"score": "0.73061043",
"text": "def password()\n perturb()\n end",
"title": ""
},
{
"docid": "3033f13fd9c110e3ccfed4c089ba91d7",
"score": "0.73033553",
"text": "def password\n\t@password\n\tend",
"title": ""
},
{
"docid": "81575dd6026d9076f29696cc21ba0d6f",
"score": "0.73006505",
"text": "def define_password(pwd)\n if !pwd\n\n if true\n\n # Use the 'highline' gem to allow typing password without echo to screen\n require 'rubygems'\n require 'highline/import'\n pwd = ask(\"Password: \") {|q| q.echo = false}\n\n else\n printf(\"Password: \")\n pwd = gets\n end\n\n if pwd\n pwd.strip!\n pwd = nil if pwd.size == 0\n end\n if !pwd\n raise DecryptionError, \"No password given\"\n end\n end\n\n while pwd.size < KEY_LEN_MIN\n pwd *= 2\n end\n pwd\n end",
"title": ""
},
{
"docid": "9fb481eff3c18cb81be67aa96d589b33",
"score": "0.72998524",
"text": "def password(new_password = nil)\n @password = new_password.to_s unless new_password.nil?\n @password\n end",
"title": ""
}
] |
29a3c887b4fac0957ff249c5e688f516
|
Dirty implementation of the element replacing method Repalace element using css selector to link
|
[
{
"docid": "19fe7214ebd785ce3a86c8d01ad03851",
"score": "0.48290956",
"text": "def el_to_link(cmd)\n link = '<a style = \\\"text-decoration: underline\\\" class=\\\"link\\\"> Link instead of button </a>'\n @browser.execute_script(\"#{o_html(cmd[1])} = '#{link}' \")\n end",
"title": ""
}
] |
[
{
"docid": "2b3e3aa1a8bea994675ede859ec3d421",
"score": "0.63888955",
"text": "def selector_replace(selector, original, replacement); end",
"title": ""
},
{
"docid": "ea1733bbad69c668b39845211be9a531",
"score": "0.5687916",
"text": "def replace_tag(tag, html_string)\n links = generate_document(html_string).css(tag)\n links.each { |a| html_string.sub!(a.to_s, a.text) }\n return html_string\nend",
"title": ""
},
{
"docid": "7819be1a61c043c66caafbb1f53d644e",
"score": "0.5546553",
"text": "def handle_links anElement\r\n self.apply anElement\r\n end",
"title": ""
},
{
"docid": "63f65fc971588a957a7ba0dcc44b07da",
"score": "0.553672",
"text": "def replace_with(selector, html)\n select(selector).after(html).unlink\n end",
"title": ""
},
{
"docid": "ecac31a2c78d9580e3621e2719027949",
"score": "0.54440254",
"text": "def overwrite_element(node)\n\t\telement = self[node[\"id\"]]\n\t\tself.remove_element(element) if element\n\n\t\tRubyfocus::Parser.parse(self, node)\n\tend",
"title": ""
},
{
"docid": "3d5af0982faee575da2198ea7e0e29c2",
"score": "0.54006284",
"text": "def find_link(element)\n case element.how\n when :index\n%|var element = document.getElementsByTagName('A')[#{element.what-1}];|\n else\n%|var element = undefined;\nfor (var i = 0; i < document.links.length; i++) {\n if (document.links[i].#{handle_match(element)}) {\n element = document.links[i];\n break;\n }\n}|\n end\n end",
"title": ""
},
{
"docid": "0b080a38485a01f49ae63fc4603fd45f",
"score": "0.5384309",
"text": "def replace_element(position, element)\n #TODO\n raise \"This hasn't been implemented yet\"\n end",
"title": ""
},
{
"docid": "53a0b15fb0e09e18fb67e4ee36ddafa4",
"score": "0.53527755",
"text": "def selectorize(emote)\n return 'a[href|=\"/' + emote + '\"]'\nend",
"title": ""
},
{
"docid": "41a9d4a5b08a0ab700e84af47019ea02",
"score": "0.5188273",
"text": "def replace_element(element, replace_with, raise_on_unrecognized_element, attributes = {})\n\t\t\traise ArgumentError, \"Expected REXML::Element but got #{element.inspect}\" unless element.is_a?(REXML::Element)\n\t\t\traise ArgumentError, \"Expected String but got #{replace_with.inspect}\" unless replace_with.is_a?(String)\n\t\t\traise ArgumentError, \"Expected Hash but got #{attributes.inspect}\" unless attributes.is_a?(Hash)\n\t\t\tcontents = element.children.inject('') do |result, child|\n\t\t\t\tresult + recursive_transform(child, raise_on_unrecognized_element)\n\t\t\tend\n\t\t\tcontent_tag(replace_with, contents, attributes)\n\t\tend",
"title": ""
},
{
"docid": "3df9b05ab3f9468bdf4827544b73d372",
"score": "0.51843804",
"text": "def replace_with(new_obj)\n super\n # [self = original_element]. Replace @markup with content of the new_obj (<ul do='with'>...)\n if new_obj.markup.tag\n @markup.tag = new_obj.markup.tag\n else\n # Steal 'class' param\n @markup.steal_html_params_from(new_obj.params)\n end\n\n @markup.params.merge!(new_obj.markup.params)\n\n # We do not have to merge dyn_params since these are compiled before processing (and we are in\n # the pre-processor)\n\n if new_obj.params[:method]\n @method = new_obj.params[:method]\n elsif new_obj.sub_do\n @method = 'void'\n end\n end",
"title": ""
},
{
"docid": "59acc3144bf0e5159d64bf36b21786c0",
"score": "0.5176867",
"text": "def rewrite_anchors(doc)\n doc.css('a').each do |a|\n next if a[:'skip-conversion']\n next if a['href'] =~ %r{^/changes} # do not rewrite blog links\n next if a['href'] =~ %r{^/enterprise} # do not rewrite Enterprise links\n a['href'] = \"/enterprise/#{CURR_VERSION}#{a['href']}\" if a['href'] =~ %r{^/}\n end\n doc\nend",
"title": ""
},
{
"docid": "51f9e104462fac84eb32f2aa540f372c",
"score": "0.51402825",
"text": "def update_hrefs html\n html.\n gsub(%r|href='https?://www.artofmanliness.com/|, \"href='/\").\n gsub(%r|href=\"https?://www.artofmanliness.com/|, 'href=\"/')\nend",
"title": ""
},
{
"docid": "1a9d3c35c18d8fc006515a102547a621",
"score": "0.5133238",
"text": "def find_and_replace_charecter charecter\n\n end",
"title": ""
},
{
"docid": "9ab9e276e10d9f65057867150150e90b",
"score": "0.5127898",
"text": "def untag!\n parse\n @tags.each do |tag|\n @doc.xpath(\"//a[contains(@href,'#{tag}')]\").each do |element|\n element.swap(element.children)\n end\n end\n @doc.xpath(\"/#{@wrap_tag}\").inner_html\n end",
"title": ""
},
{
"docid": "e3629723d09594054a95f85b0f2bf235",
"score": "0.5070592",
"text": "def replace (node)\n\t\t`#@native.parentNode.replaceChild(#@native, #{Native.normalize(node)})`\n\n\t\tnode\n\tend",
"title": ""
},
{
"docid": "75c487a1cbd9ee7f3570322f8fbc073e",
"score": "0.5069894",
"text": "def replace_link_nodes_with_href(pattern)\n return doc if project.nil?\n\n doc.search('a').each do |node|\n klass = node.attr('class')\n next if klass && klass.include?('gfm')\n\n link = node.attr('href')\n text = node.text\n\n next unless link && text\n link = URI.decode(link)\n next unless link && link =~ /\\A#{pattern}\\z/\n\n html = yield link, text\n\n next if html == link\n\n node.replace(html)\n end\n\n doc\n end",
"title": ""
},
{
"docid": "41fc89f9274bac89d11191e5e5e47bff",
"score": "0.5064574",
"text": "def get_upgrade_element\n $browser.element(@selector).link(css: 'span > a')\n end",
"title": ""
},
{
"docid": "1278e13a4ffeca7b5bc24909f5a6f314",
"score": "0.5063737",
"text": "def partial_link_text_click(element)\n @suite.p(\"-- clicking on partial link: \" + element)\n this_element = @driver.find_element(:partial_link_text, element.gsub(/link=/, ''))\n raise \"-- ERROR: for some reason {#{element}} element was not found !\" unless this_element\n this_element.click\n end",
"title": ""
},
{
"docid": "fa2b02b95292f65ddeea75ce3c4d7dec",
"score": "0.5063393",
"text": "def replace_node(new_node)\n # Interface method\n end",
"title": ""
},
{
"docid": "02fec8bf3f268dd44b4b324bc36a99ae",
"score": "0.50152",
"text": "def replace(replace, html)\n function = {:inner =>\"update\",:outer => 'replace'}[replace.to_sym]\n invoke [function, escape_javascript(html)]\n end",
"title": ""
},
{
"docid": "b5461e81f70d35e1e79a97e61e521226",
"score": "0.5010825",
"text": "def replace_tag(node)\n node.replace Nokogiri::HTML.fragment(placeholder)\n end",
"title": ""
},
{
"docid": "b7663e5e46398dd9268ddcec25386b53",
"score": "0.49994856",
"text": "def replace!(replacable, converted)\n self.documentation = documentation.gsub(replacable, converted)\n end",
"title": ""
},
{
"docid": "907f3b790d8773bf602fdd17027ac9a5",
"score": "0.497195",
"text": "def _apply_element(element)\n instance_variable_set(to_instance(element.name), element.content)\n end",
"title": ""
},
{
"docid": "ea5e325bb3326fd2f595ffaff662ac29",
"score": "0.49515295",
"text": "def replace_html(id, *options_for_render)\n call 'Element.update', id, render(*options_for_render)\n end",
"title": ""
},
{
"docid": "661b719196615be8d85337340d83ec2d",
"score": "0.49496663",
"text": "def replace_html(id, *options_for_render)\n call \"Element.update\", id, render(*options_for_render)\n end",
"title": ""
},
{
"docid": "c7e3927a8e8d16d9b8ead4b59ed58f04",
"score": "0.49351284",
"text": "def link_bikeLight\n driver.find_element(:css, '#item_0_title_link > div')\n end",
"title": ""
},
{
"docid": "e64b8a3bd71559cbce8bd34f810bf39c",
"score": "0.49247563",
"text": "def hit_link link_text\n #link_href = self.full_content_element.html.match(/href=\".+\">#{link_text}/).to_s.sub('href=\"','').sub(\">#{link_text}\", '').sub('/','').sub(/\".+$/, '').sub('\"','')\n link_href = self.html.match(/href=\".+\">#{link_text}</).to_s.sub('href=\"','').sub(\">#{link_text}\", '').sub('/','').sub(/\".+$/, '').sub('\"','')\n self.execute_script \"window.location.href = '\" + BASE_URL + link_href + \"';\"\n\n end",
"title": ""
},
{
"docid": "85dbf8382f8af1ad09afdbb31faca383",
"score": "0.4921806",
"text": "def implant_link()\n\t\t#Does not interfere with sidebar link because of lowercase\n\t\treturn $test_driver.find_element(:link_text, \"dental implants\")\n\tend",
"title": ""
},
{
"docid": "63a87a037082c423dfbd8c1c95186de1",
"score": "0.49136648",
"text": "def cucumber_results_tweaked\n self.cucumber_results.gsub(/<div id=\"label\">(.*?)<\\/div>/){ |match|\n \"<div id=\\\"label\\\">#{$1}<a href='#{self.url}'>Back</a><a href='#{self.github_url}'>Edit Scenarios</a><\\/div>\"\n }\n end",
"title": ""
},
{
"docid": "db84bef8aeaaccfcd7b297bc37ef3592",
"score": "0.4901238",
"text": "def update_doc(doc, selector)\n return doc if selector.length.zero?\n\n # retrun\n doc.css(selector)\nend",
"title": ""
},
{
"docid": "54c3060eb004890b20f2728666149db6",
"score": "0.48901424",
"text": "def set_reference_labels content, labels\n content.gsub! %r{(<a href=\"#([^\"]+)\">)(</a>)} do |match|\n if labels.key? $2\n \"#{$1}#{h labels[$2]}#{$3}\"\n else\n match\n end\n end\nend",
"title": ""
},
{
"docid": "54c3060eb004890b20f2728666149db6",
"score": "0.48901424",
"text": "def set_reference_labels content, labels\n content.gsub! %r{(<a href=\"#([^\"]+)\">)(</a>)} do |match|\n if labels.key? $2\n \"#{$1}#{h labels[$2]}#{$3}\"\n else\n match\n end\n end\nend",
"title": ""
},
{
"docid": "40b764badb087aa065e980bfb096973b",
"score": "0.48860267",
"text": "def replace_link_nodes_with_text(pattern)\n return doc if project.nil?\n\n doc.search('a').each do |node|\n klass = node.attr('class')\n next if klass && klass.include?('gfm')\n\n link = node.attr('href')\n text = node.text\n\n next unless link && text\n\n link = URI.decode(link)\n # Ignore ending punctionation like periods or commas\n next unless link == text && text =~ /\\A#{pattern}/\n\n html = yield text\n\n next if html == text\n\n node.replace(html)\n end\n\n doc\n end",
"title": ""
},
{
"docid": "1587aae0546972e881ba0099baec5726",
"score": "0.48747465",
"text": "def pdef_replace_link(txt)\n # NOTE: it works with only link\n link_url = nil\n str_after = ''\n str_before = ''\n aa = txt.split('link:')\n if aa.size == 2\n aa[1].lstrip!\n bb = aa[1].index(/[\\)\\, ]/)\n link_url = aa[1][0..bb - 1]\n str_after = aa[1][bb..-1]\n str_before = aa[0]\n end\n\n if link_url\n str_link = \"<c:alink uri=\\\"#{link_url}\\\">#{link_url.gsub(\"http://\", \"\")}</c:alink>\"\n str_res = str_before + str_link + str_after\n else\n return txt\n end\n end",
"title": ""
},
{
"docid": "fc0295d4f6463efd0597692042884eb0",
"score": "0.4870848",
"text": "def prepend_element(element)\n # Interface method\n end",
"title": ""
},
{
"docid": "64f0fe2cb4d502b62181ed949fc7a669",
"score": "0.48607787",
"text": "def partial_link_text_click(element)\n @driver.partial_link_text_click(element)\n end",
"title": ""
},
{
"docid": "f47c4c97450bd45e0eb296523d9a002c",
"score": "0.48563424",
"text": "def simple_selectors(selector); end",
"title": ""
},
{
"docid": "35bae8c0d5fd3b675f553f5e904f71cb",
"score": "0.4853461",
"text": "def replace(idx, node)\n end",
"title": ""
},
{
"docid": "67629336a46cd11f391703c534c40820",
"score": "0.4847611",
"text": "def reset_element\n self.element_methods_object.reset_element\n end",
"title": ""
},
{
"docid": "bcd9b859f7c77c63d55f27a4e2d9fd3a",
"score": "0.48445603",
"text": "def link_with_text(link_text)\n self.find_custom_element(\"//a[contains(., '#{link_text}')]\")\n end",
"title": ""
},
{
"docid": "ebd115c4ac4f39394c04a07efc7c8f10",
"score": "0.48430753",
"text": "def link_onesie\n driver.find_element(:css, '#item_2_title_link > div')\n end",
"title": ""
},
{
"docid": "8caff2f4ed1a648125e28210603deacf",
"score": "0.4839317",
"text": "def element(selector)\n @element = @browser.element(css: selector)\nend",
"title": ""
},
{
"docid": "1c60034d0855d3d69e017f6c1fe3efa7",
"score": "0.48367697",
"text": "def handle_link anElement\r\n href = anElement.attributes[\"href\"]\r\n if (href != nil)\r\n @links[anElement.attributes[\"name\"]] = href\r\n else\r\n self.markups.a(:href => @links[anElement.attributes[\"name\"]]) { markup << anElement.attributes[\"name\"] }\r\n end\r\n end",
"title": ""
},
{
"docid": "e6afc4181c4f9cd27b3419d897dceaa0",
"score": "0.48234978",
"text": "def locate_element(how, what, _driver_scope = @query_scope.wd)\n return super unless @nokogiri\n\n el = @query_scope.doc.send(\"at_#{how}\", what)\n Watigiri::Element.new element: el, selector: {how => what}\n end",
"title": ""
},
{
"docid": "69f59b9cb3c378dd49260b47c1440dcb",
"score": "0.48178875",
"text": "def toggle_tag_link(tag)\n tag = tag.name if tag.is_a?(Tag)\n return content_tag('span',tag) unless @searched_tags\n if @searched_tags.include?(tag)\n remove_tag_link(tag)\n else\n add_tag_link(tag)\n end\n end",
"title": ""
},
{
"docid": "3ddf6fae60ce0eb9a6d320ed2cb70064",
"score": "0.48139602",
"text": "def unify(sels)\n return if type == :element && sels.any? do |sel|\n sel.is_a?(Pseudo) && sel.type == :element &&\n (sel.name != name || sel.arg != arg || sel.selector != selector)\n end\n super\n end",
"title": ""
},
{
"docid": "c1d170301cdc55ec65a8496ee350f76a",
"score": "0.48069587",
"text": "def relocate\n @element = locate\n self\n end",
"title": ""
},
{
"docid": "97f653c80ece7f9383d90ea9aecbc31c",
"score": "0.48044318",
"text": "def replaceInner(target_el_name, source_el)\n parent_el = doc.at_css(target_el_name)\n parent_el.children = source_el.children.to_xml\n end",
"title": ""
},
{
"docid": "4ec370f247f271c7af4d72e1c5283c5d",
"score": "0.4790591",
"text": "def link_redTshirt\n driver.find_element(:css, '#item_3_title_link > div')\n end",
"title": ""
},
{
"docid": "8a4cc5b4db9065f95183f164020d1f6a",
"score": "0.4788294",
"text": "def pseudo_element(name, locator)\n send(:define_method, name) do\n [name, locator]\n end\n end",
"title": ""
},
{
"docid": "500d2338c2098b908b201bf519c66ed3",
"score": "0.47840372",
"text": "def replace_resource_in_html html, original_filename, new_filename, resource_type\n # FIXME better to raise an error, return an unprocessed file maybe not good.\n return html if original_filename.blank? or new_filename.blank?\n doc = Nokogiri::HTML(html)\n doc.css('img, link').each do |element|\n # FIXME seems will have the problem if have duplicated filename in different dir\n next if element.name == \"link\" && element['href'].blank?\n next if element.name == \"img\" && element['src'].blank?\n\n case\n when element.name == \"link\" && get_resource_url(element['href'], resource_type) == original_filename\n element['href'] = element['href'].sub(original_filename, new_filename)\n when element.name == \"img\" && get_resource_url(element['src'], resource_type) == original_filename\n element['src'] = element['src'].sub(original_filename, new_filename)\n end\n end\n\n doc.to_html\n end",
"title": ""
},
{
"docid": "7c5237fcebcb3f08947f85d43a415dfa",
"score": "0.47833416",
"text": "def FindAndReplace( target , replacemen, options=0 )\n @raw_object.FindAndReplace( target , replacemen, options )\n end",
"title": ""
},
{
"docid": "39799de1b25c94cd8d73cc856d30f101",
"score": "0.4783228",
"text": "def partial_link_text_click(element)\n @suite.p(\"-- clicking on partial link: \" + element)\n @suite.p(\" :: NOT IMPLEMENTED FOR SELENIUM - PLEASE, SWITCH TO WEBDRIVER ! ::\")\n @suite.p(\" :: GOING TO TRY REGULAR CLICK, BUT SUCCESS IS NOT GUARANTEED... ::\")\n click(element)\n end",
"title": ""
},
{
"docid": "b4b6543afc24b21605edd71279c3bf34",
"score": "0.4774272",
"text": "def css_selector; end",
"title": ""
},
{
"docid": "6448a6094c939b67f6ce05bdd0637bd8",
"score": "0.47681364",
"text": "def extract_from_element(el)\n b = el.attribute_with_ns(\"base\", RDF::XML.to_s)\n lang = el.attribute_with_ns(\"lang\", RDF::XML.to_s)\n self.base = self.base.join(b) if b\n self.language = lang if lang\n self.uri_mappings.merge!(extract_mappings(el))\n end",
"title": ""
},
{
"docid": "646482677d6756703d786bf03d8fe55a",
"score": "0.47661942",
"text": "def element(doc, selector)\n doc.css(selector)\n end",
"title": ""
},
{
"docid": "77f1595a618c31c59e0140d85d24e58d",
"score": "0.47594962",
"text": "def apply( node )\n bug( \"you must override Selector.apply()\" )\n end",
"title": ""
},
{
"docid": "d94961c7f24b6ce2a2009b59cbc212f0",
"score": "0.47246122",
"text": "def method_missing(element, *args, &_block)\n name, selectors, rest = args\n context = RUTL::Element::ElementContext.new(destinations: rest,\n interface: @interface,\n selectors: selectors)\n case element\n when /button/, /checkbox/, /element/, /link/\n add_method(name: name, context: context, klass: element)\n when /text/\n add_method(name: name, context: context, klass: element)\n add_method(name: name, context: context, klass: element, setter: true)\n else\n # TODO: replace with a super call. This is useful for debugging for now.\n raise \"#{element} NOT FOUND WITH ARGS #{args}!!!\"\n end\n end",
"title": ""
},
{
"docid": "258d9b06b07327f7e6bdc5c0955926bf",
"score": "0.47233516",
"text": "def replace(content)\n content = content.to_elem if content.respond_to? :to_elem\n self.parent.replaceChildAtIndex self.index, withNode: content\n self\n end",
"title": ""
},
{
"docid": "54ec6cdf298eeecac9e852b97a5ac686",
"score": "0.47173718",
"text": "def link_backpack\n driver.find_element(:css, '#item_4_title_link > div')\n end",
"title": ""
},
{
"docid": "78232a883e2ae3bce765a1349a5ce00e",
"score": "0.47148183",
"text": "def move_to_element()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "230b7428abd32f4edfc0977fb51d024d",
"score": "0.4709407",
"text": "def unify(sels)\n return if type == :element && sels.any? do |sel|\n sel.is_a?(Pseudo) && sel.type == :element &&\n (sel.name != self.name || sel.arg != self.arg)\n end\n super\n end",
"title": ""
},
{
"docid": "1944a3eaada02815cfe0e55f06078818",
"score": "0.47073615",
"text": "def update_searchable_html\n doc = Nokogiri::HTML.fragment(html)\n %w(img a h1 h2 h3 h4 h5 h6 th dt).each do |tag|\n doc.search(tag).remove\n end\n self.searchable_html = ActionController::Base.helpers.\n strip_tags(doc.to_html).gsub(/\\s+/, ' ').tr(\"\\\"\\n\", '').gsub('()', '')\n end",
"title": ""
},
{
"docid": "d5506e7eaee96435013b11caaeccf5fd",
"score": "0.46662852",
"text": "def clickonRepostsLink()\n el= @driver.find_element(:xpath, \"//span[text()='repost']\")\n el.click\n end",
"title": ""
},
{
"docid": "7fb003bdafaf0d5d7ef8bab6b77a9bfe",
"score": "0.46639755",
"text": "def new_filter_option(option_name)\n link_element(xpath: \"//a[contains(text(),\\\"#{option_name}\\\")]\")\n end",
"title": ""
},
{
"docid": "45c70f5e92c4417fe6734ac468ce74d1",
"score": "0.46624428",
"text": "def replace_element(position, element)\n # TODO: Complain if element does not exist at that position.\n @elements[position] = element\n add_operation(:type => Operation::DOCUMENT_ELEMENT_REPLACE, :index => position, :property => element)\n\n element\n end",
"title": ""
},
{
"docid": "acd5600fd6ecca9cf236757d62f688a9",
"score": "0.4653812",
"text": "def replace(replace, html)\n function = {:inner =>\"html\",:outer => 'replaceWith'}[replace.to_sym]\n add \"#{function}('#{escape_javascript(html)}')\"\n end",
"title": ""
},
{
"docid": "eba329c90d3bc2f74a75da71581653c7",
"score": "0.46494472",
"text": "def edit_description(description)\n doc = Nokogiri::HTML(\"#{description}\")\n doc.xpath(\"//h1\").each { |div| div.name= \"p\"; }\n doc.css('strong').each { |node| node.replace(node.children) }\n doc.to_s\n end",
"title": ""
},
{
"docid": "c79cac46c55e2f90995b0143eeeca12f",
"score": "0.4644462",
"text": "def update_element(element_id, partial_name, options = {})\n s \"$('##{element_id}').html('#{j partial(partial_name, options)}');\"\n end",
"title": ""
},
{
"docid": "dc71c13db12cd924c013ece843ee4c02",
"score": "0.46421325",
"text": "def tweak_hrefs_in_line line,dir_name\n new_line = line\n line.split(/<a/i).each do |link|\n next if link == \"\"\n new_link = tweak_href_of_link(link,dir_name)\n new_line = new_line.gsub(link,new_link)\n end\n return new_line\n end",
"title": ""
},
{
"docid": "5873fac466adffaf5ad0c852abe04c5d",
"score": "0.4638725",
"text": "def set_reference_labels content, labels\n content.gsub! %r{(<a href=\"#([^\"]+)\">)(</a>)} do |match|\n if labels.key? $2\n \"#{$1}#{h labels[$2]}#{$3}\"\n else\n match\n end\n end\n end",
"title": ""
},
{
"docid": "1fe76e288e1f76044bae6e64b7faaec9",
"score": "0.46278584",
"text": "def method_missing(sym, *args, &block)\n text = sym.to_s\n if text.to_s =~ /_with_id!*$/\n element_with_id(text.sub(/_with_id!*$/,'').to_sym, *args, &block)\n else\n super\n end\n end",
"title": ""
},
{
"docid": "e2ae40a3713a0b87a0a91d5419bf907f",
"score": "0.46209756",
"text": "def sanitize_link_text!(node)\n node.inner_html = node.inner_html.gsub(RTLO, ENCODED_RTLO)\n end",
"title": ""
},
{
"docid": "a04bc872b0324081c79cabcdf6cbdc54",
"score": "0.46201718",
"text": "def extract_from_element(el, &cb)\n self.language = el.language if el.language\n if b = el.base\n b = RDF::URI(b)\n self.base = b.absolute? ? b : self.base.join(b)\n end\n self.uri_mappings.merge!(extract_mappings(el, &cb))\n end",
"title": ""
},
{
"docid": "b33f9de097dc3f98db5c929951b05722",
"score": "0.46163455",
"text": "def link(locator)\n locator = locator.to_s\n link = descendant(:a)[attr(:href)]\n link[attr(:id).equals(locator) | string.n.is(locator) | attr(:title).is(locator) | descendant(:img)[attr(:alt).is(locator)]]\n end",
"title": ""
},
{
"docid": "4d53f8137fad3cd0af7d829b1d50e7cf",
"score": "0.46005118",
"text": "def replace(opts, xpath = 'TEMPLATE')\n return unless self[xpath]\n\n opts.each do |att, value|\n xpath_u = xpath+\"/#{att}\"\n docs = retrieve_xmlelements(xpath_u)\n if docs.size == 1\n docs[0].set_content(value)\n end\n end\n update(template_like_str(xpath))\n end",
"title": ""
},
{
"docid": "dd4d93dfe31d17869a996959b707919e",
"score": "0.4600119",
"text": "def update_prices(donor_product)\n super donor_product, PRICE_CSS_SELECTOR\n end",
"title": ""
},
{
"docid": "dd4d93dfe31d17869a996959b707919e",
"score": "0.4600119",
"text": "def update_prices(donor_product)\n super donor_product, PRICE_CSS_SELECTOR\n end",
"title": ""
},
{
"docid": "329cf65e917c682aa1e1c4a4df4b55eb",
"score": "0.45963356",
"text": "def test_replace_with\n old = '<doc>old<foo/>old</doc>'\n d = REXML::Document.new(old).root\n new = REXML::Text.new('new',true,nil,true)\n child = d.children[2]\n child.replace_with(new)\n assert_equal( new, d.children[2] )\n end",
"title": ""
},
{
"docid": "f6ebd05898fcf9ca150b1bc4ee4ce3bf",
"score": "0.45905465",
"text": "def autolinked_html(html)\n nodes = Nokogiri::HTML::fragment(html)\n acceptable_nodes_for_autolinking = %w{p li b em i}\n nodes.traverse do |node|\n next unless node.text?\n next unless acceptable_nodes_for_autolinking.include?(node.parent.name)\n node.replace(autolinked_html_fragment(node.text))\n end\n nodes.to_html\n end",
"title": ""
},
{
"docid": "a38bec086a59704d8ec01cb3f84bacde",
"score": "0.45872867",
"text": "def basically_match(elem)\n elem = elem.dup\n # strip span surrounding an inline-attachment as this element\n elem.gsub!(/<span\\s+class=\"attachment-inline\">(.+?)<\\/span>/, '\\1')\n # a number of past inline attachments are incorrectly marked as rel=\"external\"\n # the last p element in a blockquote is given a class of last-child\n elem.gsub!(/(rel=\"external\"|class=\"last-child\")/, \"\")\n # it's very common for extra whitespace to be present.\n elem.gsub!(/\\s+/, \"\") # whitespace\n end",
"title": ""
},
{
"docid": "359dbf55d675d678dd8c96e5a1f75417",
"score": "0.45847782",
"text": "def replacement; end",
"title": ""
},
{
"docid": "359dbf55d675d678dd8c96e5a1f75417",
"score": "0.45847782",
"text": "def replacement; end",
"title": ""
},
{
"docid": "c8285ba6b4dd85ced44813c1e2ba7c51",
"score": "0.4582974",
"text": "def render_fulltext_links!(content)\n\n # === Turn e-mail addresses into \"mailto:\" links\n content.gsub!(MAILTO_REGEX) { email_link($1) }\n\n # === Link <img> element to its source\n content.gsub!(IMAGE_REGEX) { |match| ft_outlink(match, $1) }\n\n # === Turn explicit URLs into links\n # This (should) avoid touching URLs that included as the 'href' or 'src' of\n # existing HTML elements found in the content.\n content.gsub!(EXPLICIT_URL_REGEX) { ft_outlink($1, $1) }\n\n # === Turn implicit URLs into links\n # An implicit URL is not preceded by \"http://\" or \"https://\" but is clearly\n # a hostname (optionally followed by a path, optionally followed by URL\n # parameters). Some implicit URLs will not be caught because of hostnames\n # that do not match the simplified heuristics used here.\n content.gsub!(IMPLICIT_URL_REGEX) do |match|\n label = match.sub(/^(arXiv:|doi:)\\s*/i, '\\1')\n url =\n case label\n when /^arXiv:(\\d{4})\\.?(.*)$/i then \"#{ARXIV_BASE_URL}/#{$1}.#{$2}\"\n when /^arXiv:(.*)$/i then \"#{ARXIV_BASE_URL}/#{$1}\"\n when /^doi:(.*)$/i then \"#{DOI_BASE_URL}/#{$1}\"\n when /^10\\./ then \"#{DOI_BASE_URL}/#{label}\"\n else \"http://#{label}\"\n end\n ft_outlink(label, url)\n end\n\n # === Correct <a> elements that were already in the text\n # The above mappings will turn an HTML link already in the text -- e.g.:\n # '<a href=\"URL\">url</a>' -- into:\n # '<a href=\"URL\"><a href=\"http://url\">url</a></a>' -- or possibly:\n # '<a href=\"<a href=\"URL\">URL</a>\"><a href=\"http://url\">url</a></a>'.\n # This section corrects that by re-assembling the original <a> linkage,\n # extracting the label from the inner <a> and the URL from the outer <a>\n # href (which may or may not have been erroneously wrapped in an <a>).\n content.gsub!(OVER_PROCESSED_URL_REGEX) do\n attr, label = attr_to_options($1), $2\n url = attr.delete(:href).to_s.gsub(%r{<a[^>]*>\\s*([^<]+)\\s*</a>}, '\\1')\n ft_outlink(label, url, attr)\n end\n\n content\n end",
"title": ""
},
{
"docid": "89ce4da1180bcc978e8e96c2e026b20f",
"score": "0.4574744",
"text": "def link_loves(plan_html)\n # TODO: make actual rails links, probably in helper\n logger.debug('self.plan________' + plan_html)\n checked = {}\n loves = plan_html.scan(/\\[(.*?)\\]/)# get an array of everything in brackets\n loves.each do |love|\n item = love.first\n unless checked[item]\n checked[item] = true\n\n if item.match(/^\\d+$/) && SubBoard.find(:first, conditions: { messageid: item })\n # TODO: Regexp.escape(item, \"/\")\n plan_html.gsub!(/\\[#{Regexp.escape(item)}\\]/, \"[<a href=\\\"board_messages.php?messagenum=$item#{item}\\\" class=\\\"boardlink\\\">#{item}</a>]\")\n next\n end\n\n if item =~ /:/\n if item =~ /\\|/\n # external link with name\n love_replace = item.match(/(.+?)\\|(.+)/i)\n plan_html.gsub!(/\\[#{Regexp.escape(item)}\\]/, \"<a href=\\\"#{love_replace[1]}\\\" class=\\\"onplan\\\">#{love_replace[2]}</a>\")\n else\n # external link without name\n plan_html.gsub!(/\\[#{Regexp.escape(item)}\\]/, \"<a href=\\\"#{item}\\\" class=\\\"onplan\\\">#{item}</a>\")\n end\n next\n end\n\n account = Account.where(username: item.downcase).first\n unless account.blank?\n # change all occurences of person on plan\n plan_html.gsub!(/\\[#{item}\\]/, \"[<a href=\\\"#{Rails.application.routes.url_helpers.read_plan_path account.username}\\\" class=\\\"planlove\\\">#{item}</a>]\")\n end\n end\n\n end\n\n logger.debug('self.plan________' + plan_html)\n plan_html\n end",
"title": ""
},
{
"docid": "a4714c0a02f1fdfad1bf77fa64f6b6a0",
"score": "0.45735946",
"text": "def swap_language_link\n $tracer.trace(__method__)\n return ToolTag.new(a.id(\"/lnkLanguageSwap$/\"), __method__)\n end",
"title": ""
},
{
"docid": "f63d384ab200391a292addcc8a7864e4",
"score": "0.45694268",
"text": "def element_xpath(element)\n $xpath[\"review\"][element]\n end",
"title": ""
},
{
"docid": "29d7ed693dec95ebe2bfb33f3dbeda99",
"score": "0.45676205",
"text": "def link_by_class(class_name)\n return @browser.link(:class, cuke_class(class_name))\nend",
"title": ""
},
{
"docid": "c6c158d771020fd37a02e52fb8907139",
"score": "0.45655084",
"text": "def replace_each(selector, collection, &block)\n selected_elements = select(selector)\n ExampleElementTransformer.new(self, selected_elements).replace_each(collection, &block)\n end",
"title": ""
},
{
"docid": "9bed065a56fb1b9b48f577bc660897c6",
"score": "0.45607603",
"text": "def replace(node)\n `#@native.parentNode.replaceChild(#@native, #{Native.try_convert(node)})`\n\n node\n end",
"title": ""
},
{
"docid": "b06784ea767f950c2e294d8d90cf585e",
"score": "0.45447528",
"text": "def change_link_and_img_paths(dom, path)\n \n # First we get the correct path...\n path = path.split(\"/\")[0..-2].join(\"/\")\n \n # And we build the image path, which can go directly to deliverimages.acm...\n image_path = path.sub('delivery.','deliveryimages.')\n \n # Find images\n (dom/\"img\").each do |image|\n src = image.get_attribute :src\n unless src.include?(\"http\") # leave properly pointed images alone\n image.set_attribute :src, image_path + \"/\" + src # append relative src to path\n end\n end\n \n # Find links\n (dom/\"a\").each do |link|\n href = link.get_attribute :href\n \n unless href.nil?\n \n # again, leave good links and anchors alone\n unless href.starts_with(\"\\#\") or href.starts_with(\"http\") or href.starts_with(\"/\") or href.include?(\"www.\")\n link.set_attribute :href, path + \"/\" + href\n \n if href.include?('gif') or href.include?('jpg') or href.include?('png') or href.include?('jpeg')\n link.set_attribute :href, link.get_attribute(:href).sub('delivery.','deliveryimages.')\n end\n \n end\n \n end\n end\n \n end",
"title": ""
},
{
"docid": "9ba60e317419553d343fc63bd8cb447d",
"score": "0.45408753",
"text": "def replace(node)\n node = node.to_dom(document) if Opal.respond_to? node, :to_dom\n\n unless native?(node)\n if String === node\n node = `#@native.ownerDocument.createTextNode(node)`\n else\n node = Native.convert(node)\n end\n end\n\n `#@native.parentNode.replaceChild(node, #@native)`\n\n DOM(node)\n end",
"title": ""
},
{
"docid": "355828f5ef7921cf7e46ee2e8ea9e357",
"score": "0.45390046",
"text": "def visit_aref(node)\n node.copy(index: visit(node.index))\n end",
"title": ""
},
{
"docid": "e825dfef1a5349f3f030a07b7973dec1",
"score": "0.45380735",
"text": "def link_jacket\n driver.find_element(:css, '#item_5_title_link > div')\n end",
"title": ""
},
{
"docid": "df1329aafd3ac6095903866eb3ec9128",
"score": "0.453552",
"text": "def auto_link!(text)\n text.gsub!(AUTO_LINK_RE) do\n all, leading, proto, url, post = $&, $1, $2, $3, $6\n if leading =~ /<a\\s/i || leading =~ /![<>=]?/\n # don't replace URL's that are already linked\n # and URL's prefixed with ! !> !< != (textile images)\n all\n else\n # Idea below : an URL with unbalanced parethesis and\n # ending by ')' is put into external parenthesis\n if ( url[-1]==?) and ((url.count(\"(\") - url.count(\")\")) < 0 ) )\n url=url[0..-2] # discard closing parenth from url\n post = \")\"+post # add closing parenth to post\n end\n content = proto + url\n href = \"#{proto==\"www.\"?\"http://www.\":proto}#{url}\"\n %(#{leading}<a class=\"external\" href=\"#{ERB::Util.html_escape href}\">#{ERB::Util.html_escape content}</a>#{post}).html_safe\n end\n end\n end",
"title": ""
},
{
"docid": "dcf0ab866882fbb9cc3a1ed789e7bb5b",
"score": "0.45298582",
"text": "def search_by_element_class(options)\r\n @page = @page.css(options)\r\n end",
"title": ""
},
{
"docid": "b17a5c59377b6dc5e6fc49db6da9a883",
"score": "0.4528357",
"text": "def replace(url)\n `#@native.replace(#{url.to_s})`\n end",
"title": ""
},
{
"docid": "9f5f5350f442919a7beb2b19ac7563b2",
"score": "0.45228487",
"text": "def set_custom_elements(**clues)\n clues.each do |el_name, selector|\n public_send :element, el_name.to_sym, selector\n end\n end",
"title": ""
},
{
"docid": "e3b161d65b630639600b326f2b40ce2a",
"score": "0.45210716",
"text": "def reset_element(element_name)\n self.current_tag = nil\n self.current_tag_text = nil\n self.current_tag_attributes_hash = {}\n end",
"title": ""
},
{
"docid": "38dea3ced61017ef2ec463c6a841b451",
"score": "0.45206976",
"text": "def visit_aref(node); end",
"title": ""
}
] |
681352ac20b75eddcf994ec1fdc944bd
|
This code is based directly on the Text gem implementation Returns a value representing the "cost" of transforming str1 into str2
|
[
{
"docid": "7177d0d53f6aab3e01dbd02e1666780e",
"score": "0.62878233",
"text": "def levenshtein_distance(str1, str2)\n s = str1\n t = str2\n n = s.length\n m = t.length\n\n return m if (0 == n)\n return n if (0 == m)\n\n d = (0..m).to_a\n x = nil\n\n str1.each_char.each_with_index do |char1,i|\n e = i + 1\n\n str2.each_char.each_with_index do |char2,j|\n cost = (char1 == char2) ? 0 : 1\n x = min3(\n d[j + 1] + 1, # insertion\n e + 1, # deletion\n d[j] + cost # substitution\n )\n d[j] = e\n e = x\n end\n\n d[m] = x\n end\n\n return x\n end",
"title": ""
}
] |
[
{
"docid": "9013c482c636841bb63c11ad5abfbee5",
"score": "0.7139104",
"text": "def transformation_distance(str1, str2)\n # puts \"#{@count += 1}\"\n\n str1,str2 = str1.downcase, str2.downcase\n # Dont need to compute if it has already been computed earlier, return from the aux hash.\n return @aux[\"#{str1}_#{str2}\"] if !(@aux[\"#{str1}_#{str2}\"].nil?)\n\n # if one string is empty, return the length of other string - obviously!\n return (@aux[\"#{str1}_#{str2}\"] = str2.size) if str1.empty?\n return (@aux[\"#{str1}_#{str2}\"] = str1.size) if str2.empty?\n\n \n # reduced_str denotes the last character removed from the original string.\n reduced_str1 = str1.size==1 ? \"\" : str1[0..-2]\n reduced_str2 = str2.size==1 ? \"\" : str2[0..-2]\n\n # Levenshtein algorithm:\n cost = (str1[-1] == str2[-1]) ? 0 : 1\n return (@aux[\"#{str1}_#{str2}\"] = [transformation_distance(reduced_str1,str2) + 1,\n transformation_distance(str1,reduced_str2) + 1,\n transformation_distance(reduced_str1, reduced_str2) + cost].min)\nend",
"title": ""
},
{
"docid": "49a10d00bdf4f88cfa965ba2a319fccf",
"score": "0.6378511",
"text": "def str_distance(str1, str2)\n end",
"title": ""
},
{
"docid": "49a10d00bdf4f88cfa965ba2a319fccf",
"score": "0.6378511",
"text": "def str_distance(str1, str2)\n end",
"title": ""
},
{
"docid": "4fb3103535146addb8b5032e419f7665",
"score": "0.62670416",
"text": "def str_distance(str1, str2)\n return @str_cache[str1][str2] if @str_cache[str1][str2]\n return str1.length if str2.nil?\n return str2.length if str1.nil?\n\n if str1 == str2\n @str_cache[str1][str2] = 0\n return 0\n end\n\n if str1[0] == str2[0]\n @str_cache[str1][str2] = str_distance(str1[1..-1], str2[1..-1])\n else\n replace_dist = 1 + str_distance(str1[1..-1], str2[1..-1])\n delete_dist = 1 + str_distance(str1[1..-1], str2)\n insert_dist = 1 + str_distance(str1, str2[1..-1])\n @str_cache[str1][str2] = [replace_dist, delete_dist, insert_dist].min\n end\n @str_cache[str1][str2]\n end",
"title": ""
},
{
"docid": "fd9e848d420324b50b4223360bc81c50",
"score": "0.6254553",
"text": "def levenshtein_distance(str1, str2)\n s = str1\n t = str2\n n = s.length\n m = t.length\n\n return m if (0 == n)\n return n if (0 == m)\n\n d = (0..m).to_a\n x = nil\n\n str1.each_char.each_with_index do |char1,i|\n e = i+1\n\n str2.each_char.each_with_index do |char2,j|\n cost = (char1 == char2) ? 0 : 1\n x = min3(\n d[j+1] + 1, # insertion\n e + 1, # deletion\n d[j] + cost # substitution\n )\n d[j] = e\n e = x\n end\n\n d[m] = x\n end\n\n return x\n end",
"title": ""
},
{
"docid": "476cc9db133b339af52c7b0da4622d09",
"score": "0.62324864",
"text": "def levenshtein_distance(str1, str2)\n n = str1.length\n m = str2.length\n return m if n.zero?\n return n if m.zero?\n\n d = (0..m).to_a\n x = nil\n\n # to avoid duplicating an enumerable object, create it outside of the loop\n str2_codepoints = str2.codepoints\n\n str1.each_codepoint.with_index(1) do |char1, i|\n j = 0\n while j < m\n cost = (char1 == str2_codepoints[j]) ? 0 : 1\n x = min3(\n d[j + 1] + 1, # insertion\n i + 1, # deletion\n d[j] + cost # substitution\n )\n d[j] = i\n i = x\n\n j += 1\n end\n d[m] = x\n end\n\n x\n end",
"title": ""
},
{
"docid": "fa639f9b4c2e187899f5268542667186",
"score": "0.6177223",
"text": "def tr_s(p0, p1) end",
"title": ""
},
{
"docid": "3db845e1fa7c58f4aa725e725f83379e",
"score": "0.61667883",
"text": "def levenshtein_distance(str1, str2)\n s = str1\n t = str2\n n = s.length\n m = t.length\n\n return m if n.zero?\n return n if m.zero?\n\n d = (0..m).to_a\n x = nil\n\n str1.each_char.with_index do |char1, i|\n e = i + 1\n\n str2.each_char.with_index do |char2, j|\n cost = (char1 == char2 ? 0 : 1)\n x = [\n d[j + 1] + 1, # insertion\n e + 1, # deletion\n d[j] + cost # substitution\n ].min\n d[j] = e\n e = x\n end\n\n d[m] = x\n end\n\n x\n end",
"title": ""
},
{
"docid": "4df2782c49e2fd5cbd7dc1fa0ed3c26a",
"score": "0.61568195",
"text": "def str_distance(str1, str2)\n ans = str_distance_helper(str1, str2)\n @dist_cache = Hash.new { |hash, key| hash[key] = {} }\n ans\n end",
"title": ""
},
{
"docid": "17b1046de849885d7cef311a41651dc1",
"score": "0.6135172",
"text": "def levenshtein_distance str1, str2\n s = str1\n t = str2\n n = s.length\n m = t.length\n max = n/2\n\n return m if (0 == n)\n return n if (0 == m)\n return n if (n - m).abs > max\n\n d = (0..m).to_a\n x = nil\n\n n.times do |i|\n e = i+1\n\n m.times do |j|\n cost = (s[i] == t[j]) ? 0 : 1\n x = [\n d[j+1] + 1, # insertion\n e + 1, # deletion\n d[j] + cost # substitution\n ].min\n d[j] = e\n e = x\n end\n\n d[m] = x\n end\n\n return x\n end",
"title": ""
},
{
"docid": "928809d46a75869f22fbd120108f7910",
"score": "0.61270773",
"text": "def str_distance(str1, str2)\n return str2.length unless str1\n return str1.length unless str2\n return @str_cache[str1][str2] if @str_cache[str1][str2]\n\n if str1 == str2\n dist = 0\n elsif str1[0] == str2[0]\n dist = str_distance(str1[1..-1], str2[1..-1])\n else\n move_both = 1 + str_distance(str1[1..-1], str2[1..-1])\n move_left = 1 + str_distance(str1[1..-1], str2)\n move_right = 1 + str_distance(str1, str2[1..-1])\n dist = [move_both, move_left, move_right].min\n end\n\n @str_cache[str1][str2] = dist\n end",
"title": ""
},
{
"docid": "453cf566aece6c125587b4eb664ddce7",
"score": "0.6122138",
"text": "def str_distance(str1, str2, dist_cache = Hash.new { |hash, key| hash[key] = {} })\n return dist_cache[str1][str2] if dist_cache[str1][str2]\n\n l1, l2 = str1.length, str2.length\n\n if str1 == \"\"\n count = str2.length\n elsif str2 == \"\"\n count = str1.length\n elsif str1[0] == str2[0]\n count = str_distance(str1.slice(1, l1), str2.slice(1, l2), dist_cache)\n else\n test1 = str_distance(str1.slice(1, l1), str2.slice(1, l2), dist_cache)\n\n if l1 > l2\n test2 = str_distance(str1.slice(1, l1), str2, dist_cache)\n else\n test2 = str_distance(str1, str2.slice(1, l2), dist_cache)\n end\n\n count = 1 + [test1, test2].min\n end\n\n dist_cache[str1][str2] = count\n count\n end",
"title": ""
},
{
"docid": "6576b111ae053345ebfeda8305d6c0c2",
"score": "0.6121288",
"text": "def mix(s1, s2)\n # s1とs2から2文字以上含まれる文字を抽出\n selection = (\"a\"..\"z\").to_a.select { |letter| s1.count(letter) > 1 || s2.count(letter) > 1 }\n # s1とs2の出現回数を比較し、プレフィックスを付与した配列を作成する\n selection.map! do |selection|\n if s1.count(selection) > s2.count(selection)\n \"1:#{selection * s1.count(selection)}\"\n elsif s1.count(selection) < s2.count(selection)\n \"2:#{selection * s2.count(selection)}\"\n else\n \"=:#{selection * s1.count(selection)}\"\n end\n end\n # 出現回数(文字列の長さ)、1or2、アルファベット順でソートする\n selection.sort_by { |x| [-x.size, x[0], x[-1]] }.join(\"/\")\nend",
"title": ""
},
{
"docid": "31dcdd32f4d4123e953841dfabf3b99b",
"score": "0.6001235",
"text": "def levenshtein_distance(string1, string2)\n ld = Class.new.extend(Gem::Text).method(:levenshtein_distance)\n\n ld.call(string1, string2)\n end",
"title": ""
},
{
"docid": "62698342e024bb7cdafbb4dadea0ac1e",
"score": "0.5990104",
"text": "def short_long_short(str1, str2)\n arr = [str1, str2].sort_by(&:length)\n\n arr[0] + arr[1] + arr[0]\nend",
"title": ""
},
{
"docid": "ee13cbb0260b7670f6516f5d2aece1cb",
"score": "0.59868765",
"text": "def elegant_convert(input, source, target)\n value = input.chars.reduce(0) do |s, c|\n source.size * s + source.index(c)\n end\n res = ''\n while value >= 0\n res = target[value % target.size] + res\n value = value < target.size ? -1 : value/target.size\n end\n res\nend",
"title": ""
},
{
"docid": "06fafe27b800eaa798d42b6e9d5f747c",
"score": "0.5985285",
"text": "def str2; end",
"title": ""
},
{
"docid": "06fafe27b800eaa798d42b6e9d5f747c",
"score": "0.5985285",
"text": "def str2; end",
"title": ""
},
{
"docid": "10c2ecf5314a0321e8d18773eac6de0d",
"score": "0.5927997",
"text": "def diff_string(string1, string2); end",
"title": ""
},
{
"docid": "37af6ce12b8f53cb80130be27e176ad7",
"score": "0.59086853",
"text": "def compute(left_strand,right_strand)\n return 0 if left_strand == right_strand\n\n left_chars = left_strand.chars\n right_chars = right_strand.chars\n\n distance = 0\n\n left_chars.each_with_index do |left_char,idx|\n right_char = right_chars[idx]\n break if right_char.nil? # ignore extra length on first strand when longer\n\n distance += 1 unless left_char == right_char\n end\n\n distance\n end",
"title": ""
},
{
"docid": "bf4792499320d424a8c54f6ecdee6117",
"score": "0.59072345",
"text": "def rlevenshtein(str1, str2)\n return 0 if (str1 == \"\" || str2 == \"\")\n return ([str1.length, str2.length].max - levenshtein(str1, str2)) / [str1.length, str2.length].min.to_f\n end",
"title": ""
},
{
"docid": "965d209b8b03e6e8a9b48f157de3255f",
"score": "0.5898102",
"text": "def short_long_short(string1, string2)\n if string1.length < string2.length\n string1 + string2 + string1\n else \n string2 + string1+ string2\n end \nend",
"title": ""
},
{
"docid": "fcaca4d8b81e54b7691c6e2fb0741ce6",
"score": "0.5896801",
"text": "def shortest(word1, word2)\n \n end",
"title": ""
},
{
"docid": "5cc2f5d520bacbbaa1259c788b36be53",
"score": "0.5866649",
"text": "def mix(s1, s2)\n s1_counts = lowercase_count(s1)\n s2_counts = lowercase_count(s2)\n shared_letters = (s1_counts.keys + s2_counts.keys).uniq.sort\n results = []\n shared_letters.each do |letter|\n if (s1_counts[letter] == s2_counts[letter]) && s1_counts[letter] > 1\n results << \"=:#{letter * s1_counts[letter]}\"\n elsif (s1_counts[letter] > s2_counts[letter]) && s1_counts[letter] > 1\n results << \"1:#{letter * s1_counts[letter]}\"\n elsif (s1_counts[letter] < s2_counts[letter]) && s2_counts[letter] > 1\n results << \"2:#{letter * s2_counts[letter]}\"\n end\n end\n results_arranger(results).join(\"/\")\nend",
"title": ""
},
{
"docid": "2b817a035f42ec6175b2abef5ad167af",
"score": "0.58603215",
"text": "def str_sim(other)\n max = Math.max(self.size, other.size)\n min = (self.size - other.size).abs.to_f\n 1 - (self.levenshtein(other)-min) / (max - min)\n end",
"title": ""
},
{
"docid": "928025d5755c63492ca5f865333b83e9",
"score": "0.5857096",
"text": "def distance(str1, str2)\n\t\twords1 = str1.downcase.split\n\t\twords2 = str2.downcase.split\n\t\tlen1 = words1.count.to_f\n\t\tlen2 = words2.count.to_f\n\t\tadded = (words2 - words1).count.to_f\n\t\tkept = len1 - (words1 - words2).count.to_f\n\t\treturn 0 if kept == 0\n\t\td = kept/len1\n\t\td *= 1 - (added/len2) unless added == 0\n\t\treturn d\n\tend",
"title": ""
},
{
"docid": "5b4f86da3c5cd75c00d1c4d080789dbc",
"score": "0.58423996",
"text": "def short_long_short(string1, string2)\n if string1.length > string2.length\n string2 + string1 + string2\n else\n string1 + string2 + string1\n end\nend",
"title": ""
},
{
"docid": "5e3a6819f923e35161744f4034871505",
"score": "0.58156157",
"text": "def string_edit(string1, string2)\n\nreturn true of string1==string2\nreturn false if (string1.length=string2.length).abs>1\n if string1.length<string2.length\n short_string=string1\n long_string=string2\n else \n short_string=string2 \n long_string=string1\n end\n long_string_hash={}\n \n long_string.each_char do |char|\n long_string_hash[char]||=0\n long_string_hash[char]+1\n end\n \n if short_string.length<long_string.length \n short_string.each_char do |char|\n return false if !!long_string_hash[char]\n long_string_hash[char]-=1\n return false if long_string_hash[char]<0\n end\n return true\n end \n diff_letts=0\n short_string.each_char do |char|\n diff_letts+=1 if !!long_string_hash[char]\n return false if diff_letts>1\n end\n return true\n \n \n end",
"title": ""
},
{
"docid": "cb155efd8f60745db3ca7f1143ddc1b1",
"score": "0.58124554",
"text": "def distance(str1, str2)\n validate(str1)\n validate(str2)\n ffi_distance(str1, str2)\n end",
"title": ""
},
{
"docid": "8f28a9a4930ceb728b271cac478e803c",
"score": "0.5799115",
"text": "def levenshtein(str1, str2)\n m = str1.length\n n = str2.length\n return m if n == 0\n return n if m == 0\n d = Array.new(m+1) {Array.new(n+1)}\n (0..m).each { |i| d[i][0] = i}\n (0..n).each { |j| d[0][j] = j}\n (1..n).each do |j|\n (1..m).each do |i|\n d[i][j] = if str1[i-1] == str2[j-1] # adjust index into string\n d[i-1][j-1] # no operation required\n else\n [ d[i-1][j]+1, # deletion\n d[i][j-1]+1, # insertion\n d[i-1][j-1]+1, # substitution\n ].min\n end\n end\n end\n return d[m][n]\n end",
"title": ""
},
{
"docid": "ccc0a17993f46684701c2c63a72c64d2",
"score": "0.5790925",
"text": "def short_long_short(string1, string2)\n return string1 + string2 + string1 if string1.size < string2.size\n return string2 + string1 + string2\nend",
"title": ""
},
{
"docid": "0fbfdc28628680b56a1b9bb66c4343fe",
"score": "0.57885045",
"text": "def short_long_short(string1, string2)\n if string1.size > string2.size\n string2 + string1 + string2\n else\n string1 + string2 + string1\n end\nend",
"title": ""
},
{
"docid": "f2d3832021df829587824b059a98a662",
"score": "0.57748276",
"text": "def mix(s1, s2)\n selection = ('a'..'z').to_a.select { |letter| s1.count(letter) > 1 || s2.count(letter) > 1 }\n selection.map! do |selection| \n if s1.count(selection) > s2.count(selection)\n \"1:#{selection * s1.count(selection)}\"\n elsif s1.count(selection) < s2.count(selection)\n \"2:#{selection * s2.count(selection)}\"\n else\n \"=:#{selection * s1.count(selection)}\"\n end\n end\n selection.sort_by { |x| [-x.size, x[0], x[-1]] }.join(\"/\")\nend",
"title": ""
},
{
"docid": "10605001aea98b5f3f8499b1c4c32141",
"score": "0.57713026",
"text": "def short_long_short(str1, str2)\n short, long = [str1, str2].sort_by(&:length)\n short+long+short\nend",
"title": ""
},
{
"docid": "5dac8be290ce4c0c0ecc4c3d9c725ccc",
"score": "0.575821",
"text": "def short_long_short(str1, str2)\n if str1.length > str2.length\n str2 + str1 + str2\n elsif str2.length > str1.length\n str1 + str2 + str1\n end\nend",
"title": ""
},
{
"docid": "ab13506bdf671705d92e86773ec9bda7",
"score": "0.5749699",
"text": "def tr_s!(p0, p1) end",
"title": ""
},
{
"docid": "c746f666835e31bc402763bab3ca9579",
"score": "0.57472795",
"text": "def solution(a, b)\n if a.length > b.length\n return (b + a + b).to_s\n else\n return (a + b + a).to_s\n end\nend",
"title": ""
},
{
"docid": "30e812de86a3fc0841d1f494157a424b",
"score": "0.57359934",
"text": "def my_version(lorem)\n points = proc { |word| word.chars.map { |l| l.ord - 96 }.sum }\n lorem.split.reduce do |memo, word|\n points.call(word) > points.call(memo) ? word : memo\n end\nend",
"title": ""
},
{
"docid": "0f5ad49ea0dcd556536b517b12a5de9e",
"score": "0.5721834",
"text": "def calculate_str(st)\n first_num = ''\n operator = ''\n second_num = ''\n \n characters = st.chars\n \n characters.each do |char|\n if char.match?(/[0-9]/) or char.eql?('.')\n if operator == ''\n first_num << char\n else\n second_num << char\n end\n elsif char.match?(/(\\+|-|\\*|\\/)/)\n operator << char \n else\n next\n end\n end\n result = eval first_num + operator + second_num\n result.round.to_i.to_s\nend",
"title": ""
},
{
"docid": "4ab10013d3c1fe07c2d07c798fea2298",
"score": "0.5718492",
"text": "def str1; end",
"title": ""
},
{
"docid": "4ab10013d3c1fe07c2d07c798fea2298",
"score": "0.5718492",
"text": "def str1; end",
"title": ""
},
{
"docid": "1711f645efed2c1af286199e15022f14",
"score": "0.57028335",
"text": "def short_long_short(str1, str2)\n if str1.length > str2.length\n str2 + str1 + str2\n else\n str1 + str2 + str1\n end\nend",
"title": ""
},
{
"docid": "1711f645efed2c1af286199e15022f14",
"score": "0.57028335",
"text": "def short_long_short(str1, str2)\n if str1.length > str2.length\n str2 + str1 + str2\n else\n str1 + str2 + str1\n end\nend",
"title": ""
},
{
"docid": "9435f092830eb2ea01c02d4aec2c6fcf",
"score": "0.5682311",
"text": "def short_long_short(str1, str2)\n new_string = ''\n if str1.size > str2.size\n new_string = str2 + str1 + str2\n else\n new_string = str1 + str2 + str1\n end\n new_string\nend",
"title": ""
},
{
"docid": "bf8942b0a2d243fcddb3a77fcb126048",
"score": "0.5679002",
"text": "def far_better_mix(s1, s2)\n hist = ('a'..'z').map{ |c| [c, s1.count(c), s2.count(c)] }.select{ |v| v[1] > 1 || v[2] > 1 }\n hist2 = hist.map { |v| [v[1] > v[2] ? -v[1] : -v[2], v[1] > v[2] ? '1' : v[1] < v[2] ? '2' : '=', v[0]] }\n hist2.sort.map{ |v| v[1] + ':' + v[2] * -v[0] }.join('/')\nend",
"title": ""
},
{
"docid": "9164282bcefdab90ee8533e310f86f90",
"score": "0.56751364",
"text": "def short_long_short(str1, str2)\n\tif str1.length < str2.length\n\t\tstr1 + str2 + str1\n\telse\n\t\tstr2 + str1 + str2\n\tend\n\t\nend",
"title": ""
},
{
"docid": "4912080dbba8cb5d69bff57b738594a0",
"score": "0.5671146",
"text": "def short_long_short(str1, str2)\n return str2 + str1 + str2 if str1.size > str2.size\n return str1 + str2 + str1 if str2.size > str1.size\nend",
"title": ""
},
{
"docid": "f7add19d1db9a3ed273dd18fb289cbcc",
"score": "0.56686723",
"text": "def checkStrings(st1, st2)\n\n\tdups = {}\n\n\tst1.each_key { | key | \n\t\t#puts \"key is #{key}\"\n\t\tif st2.has_key?(key) == true \n\t\t\tval1 = st1.values_at(key).join.to_i\n\t\t\tval2 = st2.values_at(key).join.to_i\n\t\t\tif val1 > val2\n\t\t\t\tst2.delete(key)\n\t\t\telsif val1 < val2\n\t\t\t\tst1.delete(key)\n\t\t\telsif val1 == val2\n\t\t\t\ttemp = {\"=\" + key => val1}\n\t\t\t\tdups = dups.merge(temp)\n\t\t\t\tst2.delete(key)\n\t\t\t\tst1.delete(key)\t\n\t\t\tend\n\t\tend\n\n\t}\n\n\tif st1 != nil \n\t\tst1 = appendCharacters(st1, \"1\")\n\tend\n\n\tif st2 != nil\n\t\tst2 = appendCharacters(st2, \"2\")\n\tend\n\n\n\tfinalString = st1.merge(st2).merge(dups).sort_by { | key, value | -value }.to_a.join.split\"\"\n\n\treturn finalString\n\t\n\nend",
"title": ""
},
{
"docid": "4f2ad5065aebd358b463d718ca2dd48f",
"score": "0.56638354",
"text": "def short_long_short(str1, str2)\n if str1.length < str2.length\n str1 + str2 + str1\n else\n str2 + str1 + str2\n end\nend",
"title": ""
},
{
"docid": "f9872be6868ab791a6cbd46ae2bd90ee",
"score": "0.5661854",
"text": "def short_long_short(str1, str2)\n if str1.length <= str2.length\n str1 + str2 + str1\n else\n str2 + str1 + str2\n end\nend",
"title": ""
},
{
"docid": "f35982b50696bea3afed4893e5799007",
"score": "0.5642915",
"text": "def short_long_short(txt1, txt2)\n txt1.length < txt2.length ? (shrt_txt, lng_txt = txt1, txt2) : (shrt_txt, lng_txt = txt2, txt1) \n shrt_txt + lng_txt + shrt_txt\nend",
"title": ""
},
{
"docid": "a5906c4b83bf3f4abbd6284f34538d8b",
"score": "0.56402624",
"text": "def short_long_short(str1, str2)\n if str1.size < str2.size\n str1 + str2 + str1\n else\n str2 + str1 + str2\n end\nend",
"title": ""
},
{
"docid": "a5906c4b83bf3f4abbd6284f34538d8b",
"score": "0.56402624",
"text": "def short_long_short(str1, str2)\n if str1.size < str2.size\n str1 + str2 + str1\n else\n str2 + str1 + str2\n end\nend",
"title": ""
},
{
"docid": "a5906c4b83bf3f4abbd6284f34538d8b",
"score": "0.56402624",
"text": "def short_long_short(str1, str2)\n if str1.size < str2.size\n str1 + str2 + str1\n else\n str2 + str1 + str2\n end\nend",
"title": ""
},
{
"docid": "2cd6560b0848e754bc36029fcc64ff32",
"score": "0.5626702",
"text": "def short_long_short(str1, str2)\n\tif str1.length > str2.length\n\t\tstr2 + str1 + str2\n\telse\n\t\tstr1 + str2 + str1\n\tend\nend",
"title": ""
},
{
"docid": "05f039b7b1fbb45d5817c37d24c0f48c",
"score": "0.56187356",
"text": "def dynamicEditDistance(str1, str2)\n matrix = Array.new(str1.length + 1) { Array.new(str2.length + 1) }\n\n # Set up first row of matrix\n (0...matrix[0].length).each do |i|\n matrix[0][i] = i\n end\n\n # Set up first column of matrix\n (0...matrix.length).each do |i|\n matrix[i][0] = i\n end\n\n # Build the matrix\n (1..str1.length).each do |i|\n (1..str2.length).each do |j|\n # If the current letters are the same, we take the old value\n # since there is no edit distance. Otherwise, we take the minimum\n # of the three values of substituion, deletion, or insertion\n if str1[i-1] == str2[j-1]\n matrix[i][j] = matrix[i-1][j-1]\n else\n matrix[i][j] = 1 + min(matrix[i-1][j-1], matrix[i-1][j], matrix[i][j-1])\n end\n end\n end\n\n return matrix[str1.length][str2.length]\nend",
"title": ""
},
{
"docid": "8009fa7b004865f9f59d917708c51246",
"score": "0.56128585",
"text": "def build_lcs_length_table(str1, str2)\n p str1\n p str2\n lcs_length_table = []\n directional_table = nil\n #in both of the table the the first dimansion representing str2 and the second demansion representing str1\n (0..str2.size).each do |i|\n lcs_length_table[i] = [0]\n end\n \n (0..str1.size).each do |j|\n lcs_length_table[0][j] = 0\n end\n \n directional_table = deep_copy(lcs_length_table)\n\n (1..str2.size).each do |j|\n (1..str1.size).each do |i|\n devired_val = [ lcs_length_table[ j - 1 ][i], lcs_length_table[ j][ i -1 ]].max\n #determind the direction of the devired_val\n if lcs_length_table[ j - 1 ][i] == devired_val #prefre go up first when the two values are the same\n devired_from = \"^\"\n else\n devired_from = \"<\"\n end\n #puts \"#{\"\"<<str2[j - 1] } #{\"\"<<str1[i - 1]} #{j-1} #{i-1}\"\n if str2[j - 1] == str1[i - 1]\n lcs_length_table[j][i] = lcs_length_table[j-1][i-1] + 1\n directional_table[j][i] = \"=\"\n else\n lcs_length_table[j][i] = devired_val\n directional_table[j][i] = devired_from\n end\n end\n end\n\n\n lcs_length_table.each do |row|\n p row\n end\n\n directional_table.each do |row|\n p row\n end\n \n p get_common_sequence_from_directional_table(directional_table, str1.size, str2.size, str2)\n\n return lcs_length_table\nend",
"title": ""
},
{
"docid": "942014442e0169dd97518d4401b242f9",
"score": "0.5610378",
"text": "def shortest_common_supersequence(str1, str2)\n dp = Array.new(str1.size + 1){Array.new(str2.size + 1, 0)}\n# build the minimum length matrix for all sub-problems, 2D-dp means minimum length of the substring for str1's prefix of length L1 and str2's prefix of length L2\n# fill 1st row & col\n for i in 0...str2.size\n dp[0][i] = i\n end\n for i in 0...str1.size\n dp[i][0] = i\n end\n \n for i in 1..str1.size\n for j in 1..str2.size\n if str2[j - 1] == str1[i - 1]\n dp[i][j] = dp[i - 1][j - 1] + 1\n else\n dp[i][j] = [dp[i - 1][j], dp[i][j - 1]].min + 1\n end\n end\n end\n \n new_str = \"\"\n len_str1 = str1.size\n len_str2 = str2.size\n \n while len_str1 != 0 || len_str2 != 0\n if len_str1 == 0 && len_str2 != 0\n new_str << str2[len_str2 - 1]\n len_str2 -= 1\n end\n if len_str2 == 0 && len_str1 != 0\n new_str << str1[len_str1 - 1]\n len_str1 -= 1\n end\n \n if str1[len_str1 - 1] == str2[len_str2 - 1] && len_str1 != 0\n new_str << str1[len_str1 - 1]\n len_str1 -= 1\n len_str2 -= 1\n elsif dp[len_str1 - 1][len_str2] < dp[len_str1][len_str2 - 1] && len_str1 != 0\n new_str << str1[len_str1 - 1]\n len_str1 -= 1\n elsif len_str2 != 0\n new_str << str2[len_str2 - 1]\n len_str2 -= 1\n end\n end\n new_str\nend",
"title": ""
},
{
"docid": "ba0cbb894f5ff5724a653a52a9dce1f9",
"score": "0.55880296",
"text": "def longer_string(str1, str2)\n # Write your code here\nend",
"title": ""
},
{
"docid": "381acfb78555be987ca3e6c8f7f9b253",
"score": "0.55840784",
"text": "def plus(word_number1, word_number2)\n\tresult = dewordify(word_number1) + dewordify(word_number2)\n\tif result > 1000\n\t\treturn \"Sorry answer > 1000\"\n\telse\n\t\treturn wordify(result)\n\tend\nend",
"title": ""
},
{
"docid": "5d3fabaa3f65c47a2f2b39e8aebac1bf",
"score": "0.5583092",
"text": "def diff( s1, s2 )\n t = s1.chars\n return s2.chars.map{|c| c == t.shift ? '-' : c}.join\nend",
"title": ""
},
{
"docid": "daacf9fbce6c2f700326be6b823d688f",
"score": "0.5578656",
"text": "def mix(s1, s2)\n a1, a2 = freq_list(s1), freq_list(s2)\n reduced_ary = (a1.map do |el|\n @element\n if a2.find { |el2| el == el2 }\n a2.delete el\n \"=:\" + el\n elsif a2.find { |el2| @element = el2; el[el2] }\n a2.delete @element\n \"1:\" + el\n elsif a2.find { |el2| @element = el2; el2[el] }\n a2[a2.index(@element)] = \"2:\" + @element\n next\n else\n \"1:\" + el\n end\n end.compact + a2.map { |el| el[0] == \"2\" ? el : \"2:\" + el }).sort { |a,b| a <=> b }\n lengths = reduced_ary.map { |el| el.length }.uniq.sort { |a,b| b <=> a }\n lengths.map do |l|\n accum = \"\"\n reduced_ary.select { |el| el.length == l }.each do |el2|\n equals_i = accum.index(\"=\")\n if equals_i && el2[0] != \"=\"\n accum.insert(equals_i, el2 + \"/\")\n else\n accum += el2 + \"/\"\n end\n end\n accum\n end.join.slice(0..-2)\nend",
"title": ""
},
{
"docid": "f6d6d39939f5d3d8cedf36553d9ef4d3",
"score": "0.5569638",
"text": "def short_long_short(str1, str2)\n str1.size > str2.size ? (str2 + str1 + str2) : (str1 + str2 + str1)\nend",
"title": ""
},
{
"docid": "c01074320960ad0ba60dafbeca3bae79",
"score": "0.5555318",
"text": "def calculate\n @output << @first << (@op.to_s + @second.to_s)\n \n case @op\n when \"+\" then @result = @first + @second\n when \"-\" then @result = @first - @second\n when \"*\" then \n @result = @first * @second\n # Nasobeni pod sebou ma smysl resit jenom pokud ma druhy citatel vic nez jednu cislici\n if @second.to_s.length > 1\n @output << '-'\n # Iterace pozadu pres druhy citatel pro nasobeni pod sebou\n # Idealne by to zde slo zjednodusit na @second.to_s.reverse.each_char.with_index,\n # ale to jak jsem zjistil neni podporovano v 1.8.x\n @second.to_s.reverse.split(\"\").each_with_index do |char, i|\n @output << (@first * char.to_i).to_s + (' ' * i)\n end \n end\n end\n @output << '-'\n @output << @result\n self # pro zjednoduseni chain callu \n end",
"title": ""
},
{
"docid": "0e3a24c9ffda4b75a460a00d1e2785fe",
"score": "0.5548842",
"text": "def benchmark(s1, s2)\n puts \"s1=#{s1}\"\n puts \"s2=#{s2}\"\n puts \n \n start_time = Time.now\n #match = number_match(s1, s2)\n match = slide_cache(s1, s2)\n duration = Time.now - start_time\n \n puts \"Slide match: #{match}\"\n puts \"Took: #{(duration * 1000).round(5)}ms\"\n puts\n \n=begin \n start_time = Time.now\n a1 = build_substrings(s1)\n a2 = build_substrings(s2)\n match = find_longest_match(a1, a2)\n duration = Time.now - start_time\n \n puts \"Table match: #{match}\"\n puts \"Took: #{duration * 1000}ms\"\n=end \nend",
"title": ""
},
{
"docid": "d9a0ba5b2b16a0da5637466837e4b554",
"score": "0.55426645",
"text": "def string_distance(word1, word2, max: 3, th: 3)\n d = DamerauLevenshtein.distance(word1, word2, 1, max)\n (d - [word1.length, word2.length].min).abs < th ? nil : d\nend",
"title": ""
},
{
"docid": "df33f0fe9f850997874e9a5fe5bccef6",
"score": "0.5540358",
"text": "def short_long_short(string1, string2)\n if string1.size > string2.size\n long_string = string1\n short_string = string2\n else\n long_string = string2\n short_string = string1\n end\n\n short_string + long_string + short_string\n\nend",
"title": ""
},
{
"docid": "33c49cddf41408c813b77fd02d1068f0",
"score": "0.5536402",
"text": "def total_cost(text)\n text.split(\"\\n\").inject(0){ |acc, line| acc + line_cost(line) }\n end",
"title": ""
},
{
"docid": "cb9000d4f2a131b86a8fd597484fe47a",
"score": "0.55354464",
"text": "def wordplay(string1, string2)\n str1_hash = {}\n str2_hash = {}\n position_hash = {}\n\n # save string1 into an hash\n string1.split('').each do |ch|\n if str1_hash[ch]\n str1_hash[ch] += 1\n else\n str1_hash[ch] = 1\n end\n end\n\n # save string2 into an hash\n string2.split('').each do |ch|\n if str2_hash[ch]\n str2_hash[ch] += 1\n else\n str2_hash[ch] = 1\n end\n end\n\n # check if each character of string2 can be found in string1\n # and if there are enough characters to make string2\n str2_hash.each do |key, value|\n if !str1_hash.key?(key)\n return false\n elsif str1_hash[key] < value\n return false\n end\n end\n\n # save the position of the characters found in string1\n # i = 0\n # while i < string1.length\n # position_hash[string1[i]] = i unless position_hash[string1[i]]\n # i += 1\n # end\n i = 0\n while i < string1.length\n if !position_hash.key?(string1[i])\n position_hash[string1[i]] = i\n end\n i += 1\n end\n\n # save the indices needed to create string2\n i = 0\n str2_arr = []\n while i < string2.length\n str2_arr << position_hash[string2[i]]\n i += 1\n end\n\n str2_arr\nend",
"title": ""
},
{
"docid": "1ce64b7fb1229c4d2b1a943ea84a1205",
"score": "0.5535199",
"text": "def short_long_short(string1, string2)\n string1.size < string2.size ? string1 + string2 + string1 : string2 + string1 + string2\nend",
"title": ""
},
{
"docid": "ad60922ea9cd1b1b18d908a43b0255cc",
"score": "0.55328035",
"text": "def convert(input, source, target)\n input = input.reverse.split('')\n\n mult = source.length\n div = target.length\n\n base10_val = input.map.with_index { |c, i| source.index(c) * (mult ** i) }.reduce(:+)\n\n base_target = (0..find_place(base10_val, div)).to_a.reverse.map do |n|\n index = base10_val / (div ** n)\n base10_val %= (div ** n)\n target[index]\n end.join\nend",
"title": ""
},
{
"docid": "1e2e374ff08f2822f0447a1b57a5a068",
"score": "0.5532443",
"text": "def add_string_as_number(a, b)\n sum_of_strings = a.to_i + b.to_i\n return sum_of_strings\nend",
"title": ""
},
{
"docid": "702387fae72912b6017a98934c44294c",
"score": "0.5531996",
"text": "def short_long_short(str1, str2)\n str1.length < str2.length ? (str1 + str2 + str1) : (str2 + str1 + str2)\nend",
"title": ""
},
{
"docid": "1a1092ee1032b95e83cf5b0d00cea0e1",
"score": "0.5527278",
"text": "def short_long_short(str1, str2)\n short = ''\n long = ''\n if str1.length > str2.length\n short = str2\n long = str1\n else\n short = str1\n long = str2\n end\n short + long + short\nend",
"title": ""
},
{
"docid": "2b4209ebb63abf72f262d92fe6384576",
"score": "0.5526827",
"text": "def sort_strings_by_cost(strings)\n ## put code here\nend",
"title": ""
},
{
"docid": "889ac6e309ae00912e4c4c3731acfc4c",
"score": "0.5524063",
"text": "def combine(str)\n int, frac = str.gsub(/[\\(\\)]/, '').split(' + ')\n n, d = frac.count('/') == 1 ?\n frac.split('/') :\n frac.split('/')[1,2].reverse\n \"#{n.to_i + int.to_i*d.to_i}/#{d}\"\nend",
"title": ""
},
{
"docid": "fa17f7f9f8fe363b17db54a62b506452",
"score": "0.552108",
"text": "def short_long_short(str1, str2)\n str_arr = [str1, str2]\n short_str = str_arr.min { |a, b| a.size <=> b.size }\n long_str = str_arr.max { |a, b| a.size <=> b.size }\n \n short_str + long_str + short_str\nend",
"title": ""
},
{
"docid": "df3ac3770094aa89e461c5fd7f31f749",
"score": "0.55186677",
"text": "def add_string_as_number(string_1, string_2)\n string_a = string_1.to_i\n string_b = string_2.to_i\n return string_a + string_b\nend",
"title": ""
},
{
"docid": "c82e9f00c11c57c88c07c8c247664627",
"score": "0.55145323",
"text": "def calculate\n string.\n each_byte.\n to_a.\n each_with_index.\n map { |byte, index| (index + 1) * byte }.\n reduce(0, :+)\n end",
"title": ""
},
{
"docid": "52d69b92e19826d060fca3956acaa4b7",
"score": "0.55070007",
"text": "def short_long_short(str1, str2)\n return \"#{str1}#{str2}#{str1}\" if str1.length < str2.length\n return \"#{str2}#{str1}#{str2}\" if str2.length < str1.length\nend",
"title": ""
},
{
"docid": "bf0a191a65dfda038605640b07ae4996",
"score": "0.5505776",
"text": "def short_long_short(str_a, str_b)\n if str_a.size > str_b.size\n return str_b + str_a + str_b\n else\n return str_a + str_b + str_a\n end\nend",
"title": ""
},
{
"docid": "ee74a492ffd82894e745aebd48986241",
"score": "0.5501498",
"text": "def short_long_short(string1, string2)\n if string1.length > string2.length\n puts string2 + string1 + string2\n else\n puts string1 + string2 + string1\n end\nend",
"title": ""
},
{
"docid": "5fbec9fe29f17748b7b0d1de71aafd95",
"score": "0.5491986",
"text": "def shorter(str1, str2)\n arr = [str1, str2].sort_by { |el| el.length }\n arr.first + arr.last + arr.first\nend",
"title": ""
},
{
"docid": "509354729c7442565b5e552df463303c",
"score": "0.548124",
"text": "def translate_string_to_number(input)\n\n #take the input\n #break it up into individual letters\n #map the letters to a dictionary (a = 1) or\n #map the input to a placement in an array\n\nend",
"title": ""
},
{
"docid": "30d34a0649ccea58a7af0f18ebcba15a",
"score": "0.5478384",
"text": "def initialize(str1, str2, lcs = nil, sdiff = nil)\n raise ArgumentError, \"nil string\" if str1 == nil || str2 == nil\n sdiff = TextAlignment::LCSMin.new(str1, str2).sdiff if sdiff.nil?\n _compute_position_map(str1, str2, sdiff)\n end",
"title": ""
},
{
"docid": "4df552a1c0a73d59852a6f8c6147709f",
"score": "0.5477634",
"text": "def short_long_short(string1, string2)\r\n if string1.length > string2.length\r\n \"#{string2}#{string1}#{string2}\"\r\n else\r\n \"#{string1}#{string2}#{string1}\"\r\n end\r\nend",
"title": ""
},
{
"docid": "707467bbf23febb830c134052b88779e",
"score": "0.5476767",
"text": "def hamming_distance str1, str2\n result = 0\n \n str1.split('').each_index do |i|\n result += 1 if str1[i] != str2[i]\n end\n\n p result\nend",
"title": ""
},
{
"docid": "ed777645d216cfe350acfa74c28aec8e",
"score": "0.54766643",
"text": "def short_long_short(string1, string2)\n long_string = ' '\n short_string = ' '\n\n if string1.size > string2.size\n long_string = string1\n short_string = string2\n short_string + long_string + short_string\n elsif string2.size > string1.size\n long_string = string2\n short_string = string1\n short_string + long_string + short_string\n end\n\nend",
"title": ""
},
{
"docid": "3b48c753cfc910ba06faff6b11a87976",
"score": "0.5473377",
"text": "def calculate(op1, operator, op2)\n\tstring = op1.to_s + operator + op2.to_s\n\n\t# operator is assumed to be a string; \n\t# make one big string of it and the two operands \n\teval(string) # evaluate and return a value - never use eval ! eval is EVIL lol \nend",
"title": ""
},
{
"docid": "f1f3d75b33ce9ec495ab32d2e2d13f3d",
"score": "0.5470979",
"text": "def compute(code, template)\n # first string is assumed to be coding strand\n # second string is assumed to be template strand\n length = get_length(code, template)\n difference = calculate_difference(code, template, length)\nend",
"title": ""
},
{
"docid": "99c3805d790791a04128f777d9c332b6",
"score": "0.54651654",
"text": "def long_addition(num1, num2)\n num1_is_negative = num1.count('-') > 0\n num2_is_negative = num2.count('-') > 0\n\n maxLength = [num1.length, num2.length].max\n\n num1 = format_string(num1, maxLength)\n num2 = format_string(num2, maxLength)\n\n carry_term = 0\n string_sum = \"\"\n\n num1.each_with_index do |char, index|\n num1_int = num1[index].to_i\n num2_int = num2[index].to_i\n\n num1_int = num1_is_negative ? num1_int * -1 : num1_int\n num2_int = num2_is_negative ? num2_int * -1 : num2_int\n\n puts \"Adding #{num1_int} + #{num2_int} + #{carry_term}\"\n\n int_result = num1_int + num2_int + carry_term\n\n if int_result < 0\n int_result += 10\n carry_term = (int_result / 10) + 1\n else\n carry_term = int_result / 10\n end\n\n puts \"int_result: #{int_result}, carry_term: #{carry_term}\"\n puts \"String Sum Before: #{string_sum}\"\n string_sum += (int_result % 10).to_s\n puts \"String Sum After: #{string_sum}\"\n end\nputs carry_term\n if carry_term != 0\n string_sum += carry_term.to_s\n\n if carry_term < 0 && string_sum.count('-') == 0\n string_sum += '-'\n end\n end\n\n string_sum = string_sum.reverse\nend",
"title": ""
},
{
"docid": "3c6875045ef18b55f357a473571e04d8",
"score": "0.54645544",
"text": "def short_long_short(string1, string2)\n array = [string1, string2].sort_by{|x| x.length} \n array.first + array.last + array.first\nend",
"title": ""
},
{
"docid": "d69499adf1754e50f9e553a3586965b8",
"score": "0.5454027",
"text": "def distance(str1, str2, max_distance = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "ecae235548c7078fcc69872e50c88fbc",
"score": "0.54535353",
"text": "def short_long_short(string1, string2)\n newstring = \"\"\n if string1.length > string2.length\n newstring = string2.concat(string1, string2)\n else\n newstring = string1.concat(string2, string1)\n end\nend",
"title": ""
},
{
"docid": "cad2fbebaf48e18fff69645bd53dfeaa",
"score": "0.5445009",
"text": "def add_string_as_number(string_1, string_2)\n return string_1.to_i + string_2.to_i\nend",
"title": ""
},
{
"docid": "0992c0028aa1fc3ecb1a9d3e3ca82fa9",
"score": "0.5431607",
"text": "def short_long_short(str1, str2)\n concat_string = ''\n \n if str1.size < str2.size\n concat_string << str1\n concat_string << str2\n concat_string << str1\n else\n concat_string << str2\n concat_string << str1\n concat_string << str2\n end\n concat_string\nend",
"title": ""
},
{
"docid": "c658e7bb6f683f3c438f61ede6560e50",
"score": "0.5430234",
"text": "def score_text_two(text)\n txt = text.downcase\n txt_length = txt.length.to_f\n total_score = 0\n\n ALL_LETTERS.each_with_index do |l, i|\n l_freq = (txt.count(l) / txt_length) * 100\n total_score += (l_freq - CHAR_FREQ[i]).abs\n end\n\n space_ratio = txt.scan(/.\\s./).count / txt_length\n total_score += ((space_ratio * 100) - 14.0).abs\n\n return total_score\nend",
"title": ""
},
{
"docid": "218e51f656020c526d7633d94ac3cff4",
"score": "0.54240185",
"text": "def normalize_version_strings(first_string, second_string)\n if first_string.nil? || second_string.nil? || first_string.empty? || second_string.empty?\n return first_string, second_string\n end\n first_groups = first_string.split(\".\").length\n second_groups = second_string.split(\".\").length\n if first_groups != second_groups\n if first_groups > second_groups\n ((1..first_groups-second_groups).to_a).each do |digit|\n second_string += \".0\"\n end\n end\n if first_groups < second_groups\n ((1..second_groups-first_groups).to_a).each do |digit|\n first_string += \".0\"\n end\n end\n end\n return first_string, second_string\nend",
"title": ""
},
{
"docid": "d1a307feae85a00b9d07a3378f8a03f5",
"score": "0.54197395",
"text": "def mix_up(str1, str2)\n str1_initial = str1[0,2]\n str1_end = str1[2, str1.length - 1]\n str2_initial = str2[0,2]\n str2_end = str2[2, str2.length - 1]\n puts \"#{str2_initial + str1_end} #{str1_initial + str2_end}\"\nend",
"title": ""
},
{
"docid": "54618c102f912435d7a3a98cede98475",
"score": "0.5413357",
"text": "def modify(cost)\n answer = ''\n if cost == cost.to_f || cost == cost.to_i\n return cost\n else \n cost = cost.to_s\n arr = cost.split('.')\n arr[0].each_char do |c|\n if isNum?(c) \n answer += c.to_s\n end\n end\n end\n return answer.to_i + arr[1].to_i.round(2)* 0.01\nend",
"title": ""
}
] |
7955ad6abefce6eade5f6ed91ba94601
|
Add more fields make sure they follow the custom field naming conventions _d, _i, _k, _t
|
[
{
"docid": "b7cc339a38d2e70ab828a5f0238d9066",
"score": "0.0",
"text": "def assemble_collection_specific\n # @json[\"fieldname_k\"] = some_value_or_method\n end",
"title": ""
}
] |
[
{
"docid": "514bf8c50471d07092180029adf347f0",
"score": "0.7139017",
"text": "def set_extra_fields\n return unless challenge\n\n challenge.challenge_idea_fields.each_with_index do |field, i|\n field_name = \"cfield#{i}\"\n unless respond_to? field_name\n self.class.send :hstore_column, :properties, field_name, :text\n # self.class.send :validates, field_name, presence: true if field.required\n end\n end\n end",
"title": ""
},
{
"docid": "f8f1fe5c8a18a5f718ee0dfb998639b9",
"score": "0.7062374",
"text": "def set_extra_fields\n return unless challenge\n\n challenge.challenge_entry_fields.each_with_index do |field, i|\n field_name = \"cfield#{i}\"\n unless respond_to? field_name\n self.class.send :hstore_column, :properties, field_name, :text\n # self.class.send :validates, field_name, presence: true if field.required\n end\n end\n end",
"title": ""
},
{
"docid": "691f2218bccdf8c225bbf1c7b49f0ab0",
"score": "0.68081397",
"text": "def setup_fields\n\t\t\tself.fields.each do |field|\n\t\t\t\tself.symbols[field] = underscore(field).to_sym\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "7f78f282e87cfc6eb06c16b266e4ce19",
"score": "0.67779523",
"text": "def _fields; end",
"title": ""
},
{
"docid": "a6aac98f88237de334b0ba2b90328dcd",
"score": "0.6682164",
"text": "def add_fields(namespace, fields, signed=true)\n fields.each {|k,v| self.add_field(namespace, k, v, signed)}\n end",
"title": ""
},
{
"docid": "9f985e98afbbea577e86a941879f6e14",
"score": "0.65496415",
"text": "def additional_fields\n {}\n end",
"title": ""
},
{
"docid": "9f4d0f1b11a9496429d445cd59397a96",
"score": "0.6544932",
"text": "def fields(*args)\n @values[:fields] += args\n self\n end",
"title": ""
},
{
"docid": "a4cfbd62069db4a2a530f7e960b670e6",
"score": "0.64680207",
"text": "def fields(fields)\n fields.each { |options| add_field(nil, options) }\n end",
"title": ""
},
{
"docid": "a76a35ae2c9f8770844e9e93ad4d76a6",
"score": "0.6452628",
"text": "def field_definitions; end",
"title": ""
},
{
"docid": "28954c380f445fe3e4639cab40e4ad54",
"score": "0.64499944",
"text": "def set_standard_fields(fields)\n\t\tend",
"title": ""
},
{
"docid": "e17795b591bbbd5e136976aecb58374b",
"score": "0.6412743",
"text": "def add_fields(row, attrs)\n fields = (@config.fields - @config.export_only_fields).map(&:to_s)\n fields.each do |name|\n row.has_key? name or next\n attrs[name] = row.field name\n end\n end",
"title": ""
},
{
"docid": "52c4c308b27392698433bf3498a9723a",
"score": "0.64096594",
"text": "def add_non_heading_subfields_to_name_field(field, new_field)\n subf4 = field.subfields.select { |subfield| subfield.code == '4' }\n subf4.each do |subfield|\n new_field.append(subfield)\n end\n subf5 = field.subfields.select { |subfield| subfield.code == '5' }\n subf5.each do |subfield|\n new_field.subfields.append(subfield)\n end\n subfi = field.subfields.select { |subfield| subfield.code == 'i' }\n subfi.each do |subfield|\n new_field.subfields.insert(0, subfield)\n end\n subf3 = field.subfields.select { |subfield| subfield.code == '3' }\n subf3.each do |subfield|\n new_field.subfields.insert(0, subfield)\n end\n subf6 = field.subfields.select { |subfield| subfield.code == '6' }\n subf6.each do |subfield|\n new_field.subfields.insert(0, subfield)\n end\n subf8 = field.subfields.select { |subfield| subfield.code == '8' }\n subf8.each do |subfield|\n new_field.subfields.insert(0, subfield)\n end\n new_field\nend",
"title": ""
},
{
"docid": "c19061b271aea0ddcc7bbbd4b0b00d03",
"score": "0.640449",
"text": "def fields\n {\n 'field1' => 'field1',\n 'field4' => 'field4',\n 'field2' => 'field2'\n }\n end",
"title": ""
},
{
"docid": "23b0d529d7fbd928ef844e0b90b1d46d",
"score": "0.6400201",
"text": "def addFields index, data\n @fields[index.to_sym] = data\n end",
"title": ""
},
{
"docid": "27ba279a616e684a552dba105cf9d68c",
"score": "0.6379836",
"text": "def add_extra_fields(*args)\n @extra_fields += [ *args ]\n @retain_fields += [ *args ]\n end",
"title": ""
},
{
"docid": "5bb35a3c49306f3302f5342080459c9b",
"score": "0.63646513",
"text": "def fields; end",
"title": ""
},
{
"docid": "5bb35a3c49306f3302f5342080459c9b",
"score": "0.63646513",
"text": "def fields; end",
"title": ""
},
{
"docid": "5bb35a3c49306f3302f5342080459c9b",
"score": "0.63646513",
"text": "def fields; end",
"title": ""
},
{
"docid": "5bb35a3c49306f3302f5342080459c9b",
"score": "0.63646513",
"text": "def fields; end",
"title": ""
},
{
"docid": "5bb35a3c49306f3302f5342080459c9b",
"score": "0.63646513",
"text": "def fields; end",
"title": ""
},
{
"docid": "5bb35a3c49306f3302f5342080459c9b",
"score": "0.63646513",
"text": "def fields; end",
"title": ""
},
{
"docid": "5bb35a3c49306f3302f5342080459c9b",
"score": "0.63646513",
"text": "def fields; end",
"title": ""
},
{
"docid": "5bb35a3c49306f3302f5342080459c9b",
"score": "0.63646513",
"text": "def fields; end",
"title": ""
},
{
"docid": "5bb35a3c49306f3302f5342080459c9b",
"score": "0.63646513",
"text": "def fields; end",
"title": ""
},
{
"docid": "5bb35a3c49306f3302f5342080459c9b",
"score": "0.6364539",
"text": "def fields; end",
"title": ""
},
{
"docid": "2f1aa6ab9068dcf36737e3bf2297bd35",
"score": "0.63296694",
"text": "def prepare_custom_fields(fields)\n fields.each_with_object({}) { |e, o| o[\"copyleaks-client-custom-#{e[0]}\"] = e[1] }\n end",
"title": ""
},
{
"docid": "1e91b8d134c804f3e22fe3620b6fde03",
"score": "0.63223827",
"text": "def custom_fields(group_builder)\n group_builder.fields_for :fields do |fields_f|\n capture do\n concat custom_field(fields_f)\n end\n end\n end",
"title": ""
},
{
"docid": "5749aa6027a828f4b341858912d017f0",
"score": "0.631848",
"text": "def custom_fields(post)\n #return self.custom_field_names = {:tags => \"test\"}\n test = self.custom_field_names.map{|k| { :key => k, :value => post.data[k.to_s] ? post.data[k.to_s].to_s : \"\" } }\n test.insert(0, {:key => \"photo\", :value => post.photo ? post.photo : \"\"})\n test.insert(1, {:key => \"photo-alt-text\", :value => post.photoAltText ? post.photoAltText : \"\"})\n return test\n end",
"title": ""
},
{
"docid": "98e7689ad52e48535e80e5ee592ed2eb",
"score": "0.6308602",
"text": "def add_fields(fields)\n return if @payload.except(:payload_key, :partition_key).blank?\n\n if fields.include?('message_id')\n @payload['message_id'] ||= SecureRandom.uuid\n end\n if fields.include?('timestamp')\n @payload['timestamp'] ||= Time.now.in_time_zone.to_s\n end\n end",
"title": ""
},
{
"docid": "7ab7610410e7021bb5b5b786d310aa1d",
"score": "0.6300945",
"text": "def add_field(field_name, options = {})\n field = BaseFieldWriter.field_for(field_name.to_s, options)\n field.name = change_field_name_to_avoid_collision(field.name)\n @fields[field.name] = field\n self\n end",
"title": ""
},
{
"docid": "db68b9311b9bb3e079dd2c32a2075e61",
"score": "0.6293551",
"text": "def populate_fields; end",
"title": ""
},
{
"docid": "1b47d7941ae47b65c1103eb6f68af18c",
"score": "0.62834525",
"text": "def field_name\n {\n accession_number: 'AccNo',\n title: 'Title',\n access_status: 'AccessStatus',\n copyright: 'Copyright',\n creator: 'CreatorName',\n date: 'Date',\n description: 'Description',\n user_description: 'Description',\n keywords: 'Keyword',\n language: 'Language',\n filename: 'Title',\n level: 'Level'\n }\n end",
"title": ""
},
{
"docid": "17b8efd89183a0ab134f106b3a7707cd",
"score": "0.6240306",
"text": "def fillFields\n \n end",
"title": ""
},
{
"docid": "6707a3267a25a434a73b91a5b812a44c",
"score": "0.62299013",
"text": "def additional_field_methods_with_values\n get_additional_fields.each_with_object({}){|f, hsh| hsh[\"route_additional_fields_\" + f.id.to_s] = f.name}\n end",
"title": ""
},
{
"docid": "9e99d0bbdfa5df058aee8c1fa0880b16",
"score": "0.6228086",
"text": "def fields_for(record_or_name_or_array, *args, &block)\n super\n end",
"title": ""
},
{
"docid": "0b1ebd7f30e94219164263cf434bdd84",
"score": "0.62178683",
"text": "def add_field(field)\n fields[field.name] = field\n end",
"title": ""
},
{
"docid": "905bf65381bb96f8225ef3a87ae00459",
"score": "0.62034047",
"text": "def dublin_core_field_names\n [:contributor, :coverage, :creator, :date, :description, :format, :identifier, :language, :publisher, :relation,\n :rights, :source, :subject, :title, :type, :thumbnail]\n end",
"title": ""
},
{
"docid": "0564110751af7873005cc97d593ecb49",
"score": "0.6201284",
"text": "def iamswer_fields *fields\n @iamswer_defined_fields ||= []\n\n fields.each do |field|\n delegate field, to: :iamswer_user\n delegate \"#{field}=\", to: :iamswer_user\n\n if field == :created_at || field == :updated_at\n # created_at and updated_at are statistical data. they\n # are not considered as user-defined fields\n next\n else\n @iamswer_defined_fields << field\n end\n end\n end",
"title": ""
},
{
"docid": "548a4dd864b4f016245f68fe77352ddc",
"score": "0.61752176",
"text": "def fields=(unfolded_fields); end",
"title": ""
},
{
"docid": "31c89b1982b48f779846bc18da879251",
"score": "0.6175186",
"text": "def fields(*args)\r\n @fields += args\r\n return self\r\n end",
"title": ""
},
{
"docid": "e6002cb6459ee291c7d3b314530cc505",
"score": "0.61746466",
"text": "def addFields(fields, model, source=nil); fields.each { |f| addField f, model, source } end",
"title": ""
},
{
"docid": "8ab6a63869ce643c7ffe9773023903c9",
"score": "0.6171096",
"text": "def method_missing(meth, *args, &blk)\n super unless Fields.all.include?(meth)\n field meth, *args\n end",
"title": ""
},
{
"docid": "c13933890e18eee3ce4e6546ea8fccff",
"score": "0.61702627",
"text": "def process_field(field_name)\n if ['id', 'parent_id', 'project_id', 'section_id', 'kpath', 'name', 'event_at', 'custom_a', 'idx_foo1' , 'amount'].include?(field_name)\n \"#{table}.#{field_name}\"\n elsif field_name == 'REF_DATE'\n context[:ref_date] ? insert_bind(context[:ref_date]) : 'now()'\n elsif %w{age size}.include?(field_name)\n tbl = add_key_value_table('idx', 'idx_nodes', field_name) do |tbl_name|\n # This block is only executed once\n \"#{tbl_name}.node_id = #{table}.id AND #{tbl_name}.key = #{quote(field_name)}\"\n end\n\n \"#{tbl}.value\"\n else\n super # raises an error\n end\n end",
"title": ""
},
{
"docid": "51af8fb3f8f450ccb2e8c4fa9e478c5e",
"score": "0.6157841",
"text": "def parse_custom_fields(custom_fields)\r\n if custom_fields.present?\r\n combined_keys = combined_values = []\r\n custom_fields.each_with_index do |(key, value), index|\r\n combined_keys << (key.present? ? key.to_s : '-')\r\n combined_values << (value.present? ? value.to_s : '-')\r\n end\r\n \"Fields: #{combined_keys.join(', ')} Values: #{combined_values.join(', ')}\"\r\n end\r\n end",
"title": ""
},
{
"docid": "ccbc85be02956e4ec65d824f612bf307",
"score": "0.6152052",
"text": "def fields\n raise NotImplementedError.new\n end",
"title": ""
},
{
"docid": "b08df9aa742fb15c9cb701c36804d4d0",
"score": "0.6139845",
"text": "def field_definition; end",
"title": ""
},
{
"docid": "0f2bd0a3be0aeb32897509655b41a411",
"score": "0.6130684",
"text": "def fields(*field_names)\n @fields_added = true\n boosted_fields = field_names.pop if field_names.last.is_a?(Hash)\n field_names.each do |field_name|\n @setup.text_fields(field_name).each do |field|\n @query.add_fulltext_field(field, field.default_boost)\n end\n end\n if boosted_fields\n boosted_fields.each_pair do |field_name, boost|\n @setup.text_fields(field_name).each do |field|\n @query.add_fulltext_field(field, boost)\n end\n end\n end\n end",
"title": ""
},
{
"docid": "b4a2b9d135aeeb54c8f3ffe5f150021e",
"score": "0.61294",
"text": "def extra(*fields)\n @all_fields.push *fields\n @extra_fields.push *fields\n define_readers fields\n end",
"title": ""
},
{
"docid": "061e93247ec24b8e4626232bc60ec4dc",
"score": "0.6125925",
"text": "def add_fields(fields)\n @tables_fields << fields\n end",
"title": ""
},
{
"docid": "0642c6c83dc1d1570515d3c56443adf7",
"score": "0.612287",
"text": "def database_field_names\n [\"person_id\", \"exercise_type_id\", \"intensity_id\", \"duration_id\", \"date\"]\n end",
"title": ""
},
{
"docid": "a1820a88feaff1b37f38d7223add6934",
"score": "0.61141384",
"text": "def fields\n {\n job: \"junior developer\",\n happy_in_job: \"yes\",\n happy_info: \"It's ok\",\n gender: \"female\",\n city: \"Berlin\",\n country: \"DE\",\n days_per_week: \"5\",\n salary: \"15000\",\n currency: \"€\",\n technology: \"RoR\",\n focus: \"backend\",\n age: 30,\n years_working_total: \"less than 1 year\",\n years_working_at_job: \"less than 1 year\",\n education: \"self taught\",\n first_job: \"no\",\n remote: \"no\",\n tech_team_size: \"5 - 10 people\",\n company_size: \"less than 10 people\",\n company_age: 5,\n person_of_colour: false,\n other: \"Thanks\",\n freelancer: \"f\"\n }\n end",
"title": ""
},
{
"docid": "1e56202998511abfb2e2ceefdbed7718",
"score": "0.61093044",
"text": "def apply_default_fields(fields)\n fields.map! { |field| field =~ /:/ ? field : \"#{field}:string\" }\n end",
"title": ""
},
{
"docid": "391a8882d8bf063895f473289d4e5f68",
"score": "0.60946774",
"text": "def extra_fields\n self.attributes.keys - MY_FIELDS\n end",
"title": ""
},
{
"docid": "2f650f5386de3372cdf391886789e602",
"score": "0.6094498",
"text": "def add_field!(field_name, value = nil)\n fields << Field.new({'name' => field_name}, value)\n end",
"title": ""
},
{
"docid": "df17998877d004de499ebb703f3a99c8",
"score": "0.6079846",
"text": "def key_fields; end",
"title": ""
},
{
"docid": "df17998877d004de499ebb703f3a99c8",
"score": "0.6079846",
"text": "def key_fields; end",
"title": ""
},
{
"docid": "5b02e52cb5956081e23f858e604c0c2a",
"score": "0.6076655",
"text": "def additional_fields\n return @additionals unless @additionals.blank?\n\n @additionals = Hash.new\n plain.to_hash.keys.each do |key|\n key = key.to_s\n value = plain[key.to_sym]\n if key[0,1] == ADDITIONAL_FIELD_SEPARATOR and !RESERVED_ADDITIONAL_FIELDS.include?(key.to_s)\n @additionals[key[1, key.length]] = value\n end\n end\n\n return @additionals\n\n # XXX ELASTIC: sort alphabetically\n end",
"title": ""
},
{
"docid": "4eaa7a3014dd3e04ca2ca6e24634a736",
"score": "0.6070344",
"text": "def available_fields\n raise 'You need to redeclare this methods in your model'\n end",
"title": ""
},
{
"docid": "f296a355428ccfa0c2efee66f7fd3f4e",
"score": "0.60632896",
"text": "def make_user_fields\n @@fields[User.current.login] = Hash.new\n User.current.available_custom_fields.each do |field|\n @@fields[User.current.login][field.name.to_sym] = User.current.custom_field_value(field.id)\n end\n @@fields\n end",
"title": ""
},
{
"docid": "304a2110f48acb438d3039f897c40a9b",
"score": "0.6060117",
"text": "def field_name; end",
"title": ""
},
{
"docid": "304a2110f48acb438d3039f897c40a9b",
"score": "0.6060117",
"text": "def field_name; end",
"title": ""
},
{
"docid": "a00f62b85d9aaf4911bcb6ce3b04d450",
"score": "0.6059178",
"text": "def extended_fields\n @hash ||= {}\n @hash\n end",
"title": ""
},
{
"docid": "24cc687fe9a6b24ce3adccd3fecb65d0",
"score": "0.60479885",
"text": "def add_custom_field(name, value)\n add_field name, value\n end",
"title": ""
},
{
"docid": "c8b5a9cd8eacecb848912fe5deab9a38",
"score": "0.6039451",
"text": "def custom_field_mappings\n CustomFieldMapping.new(self, super)\n end",
"title": ""
},
{
"docid": "039ba05d13b4101e9e69500b19a3a7c9",
"score": "0.6037867",
"text": "def create_fields (namespace_id)\n format_definition.meta_data.each do |field_name, _|\n Field.create(name: field_name,\n namespace_id: namespace_id,\n sql_type: 'TEXT')\n end\n end",
"title": ""
},
{
"docid": "89d1aa058c0fb54267b7c3dad48d54d5",
"score": "0.601863",
"text": "def dynamic_fields\n attributes.keys - fields.keys\n end",
"title": ""
},
{
"docid": "bc71d73088e4722375134462666fe5fb",
"score": "0.6017093",
"text": "def add_field(field:)\n @data.push(field.select { |k, _v| FIELD_NAMES.include? k })\n validate_field(field: @data.last)\n end",
"title": ""
},
{
"docid": "7a6095b6a3aef7052149846784f4b171",
"score": "0.59952027",
"text": "def dfield(fname, type, indexed, multiple, stored=false)\n i = indexed ? 'true' : 'false'\n m = multiple ? 'true' : 'false'\n s = stored ? 'true' : 'false'\n %Q[<dynamicField name=\"*_#{fname}\" type=\"#{type}\" indexed=\"#{i}\" stored=\"#{s}\" multiValued=\"#{m}\" />]\nend",
"title": ""
},
{
"docid": "5c6dd4a3e4f84a1ef6cd1230c6c1fb7a",
"score": "0.5983635",
"text": "def define_base_fields!\n class_eval do\n sorcery_config.username_attr_names.each do |username|\n sorcery_orm_adapter.define_field(\n username,\n String,\n length: 255\n )\n end\n # FIXME: LineLength here is a little tricky to solve.\n # rubocop:disable Layout/LineLength\n unless sorcery_config.username_attr_names.include?(sorcery_config.email_attr_name)\n sorcery_orm_adapter.define_field(\n sorcery_config.email_attr_name,\n String,\n length: 255\n )\n end\n # rubocop:enable Layout/LineLength\n sorcery_orm_adapter.define_field(\n sorcery_config.password_digest_attr_name,\n String,\n length: 255\n )\n end\n end",
"title": ""
},
{
"docid": "c9ec20f97a46e687a6139ce5011faa7f",
"score": "0.5976129",
"text": "def field(name)\n @fields << name.to_s\n end",
"title": ""
},
{
"docid": "22d937ca53df837968490e469f94020b",
"score": "0.5970987",
"text": "def extend_for_custom_fields(name)\n class_eval do\n field :\"#{name}_custom_fields_counter\", :type => Integer, :default => 0\n field :\"#{name}_custom_fields_version\", :type => Integer, :default => 0\n\n embeds_many :\"#{name}_custom_fields\", :class_name => self.dynamic_custom_field_class_name(name), :cascade_callbacks => true\n\n attr_accessor :\"invalidate_#{name}_klass_flag\" # flag for invalidating the custom class\n\n accepts_nested_attributes_for :\"#{name}_custom_fields\", :allow_destroy => true\n end\n\n class_eval <<-EOV\n\n before_save :bump_#{name}_custom_fields_version\n after_save :mark_#{name}_custom_fields_as_persisted\n after_save :rebuild_#{name}_relation\n after_save :reset_#{name}_klass_invalidated_flag\n after_destroy :invalidate_#{name}_klass\n\n def #{name}_klass\n self.klass_with_custom_fields('#{name}')\n end\n\n def #{name}_klass_name\n self.class.klass_name_with_custom_fields('#{name}', self)\n end\n\n def #{name}_klass_out_of_date?\n self.#{name}_klass.nil? || self.#{name}_klass.version != self.#{name}_custom_fields_version\n end\n\n def invalidate_#{name}_klass\n self.invalidate_klass_with_custom_fields('#{name}')\n end\n\n def invalidate_#{name}_klass?\n self.invalidate_klass_with_custom_fields?('#{name}')\n end\n\n def rebuild_#{name}_relation\n # puts \"--> AFTER SAVE (#{name})\"\n if self.#{name}_klass_out_of_date?\n # puts 'rebuild relation for #{name} after save'\n self.rebuild_custom_fields_relation('#{name}')\n end\n end\n\n protected\n\n def bump_#{name}_custom_fields_version\n # puts \"--> BEFORE SAVE (#{name})\"\n self.bump_custom_fields_version('#{name}')\n end\n\n def mark_#{name}_custom_fields_as_persisted\n self.mark_custom_fields_as_persisted('#{name}')\n end\n\n def reset_#{name}_klass_invalidated_flag\n self.reset_klass_with_custom_fields_invalidated_flag('#{name}')\n end\n\n EOV\n end",
"title": ""
},
{
"docid": "493dc78de515974fc0fd20b3490243d3",
"score": "0.5966137",
"text": "def call\n add_fields(undetermined: true)\n end",
"title": ""
},
{
"docid": "ee10935074e7c0dc39c2d1faa1235f5f",
"score": "0.5964707",
"text": "def add_field(field_defn)\n own_fields[field_defn.name] = field_defn\n nil\n end",
"title": ""
},
{
"docid": "89df49a9078c20ad543ac5c6c932b562",
"score": "0.5953961",
"text": "def expand_fields(fields, distance_field, sql)\n f = DataMapper::Property::Distance.new(self, \"#{distance_field}_distance\".to_sym, :field => \"#{sql} as #{distance_field}_distance\")\n if fields.is_a?(Array) # user specified fields, just tack this onto the end\n [f] + fields\n else # otherwise since we specify :fields, we have to add back in the original fields it would have selected\n [f] + self.properties(repository.name).defaults\n end\n end",
"title": ""
},
{
"docid": "f6787a48566d75bfe6fb37faf054ff18",
"score": "0.5953089",
"text": "def fields; @_fields; end",
"title": ""
},
{
"docid": "5ca102684f009c9511482b19dc28a89b",
"score": "0.59515274",
"text": "def import_fields(section_id, field_rows)\n field_rows.each do | row |\n custom_field = CustomField.find_by(key: row[\"name\"]&.strip)\n if custom_field\n puts \"🟠 Field: \\\"#{row[\"name\"]}\\\" already exists, skipping.\"\n else\n custom_field = CustomField.new(\n key: row[\"name\"]&.strip,\n field_type: row[\"field_type\"].downcase,\n options: row[\"field_options\"],\n hint: row[\"hint\"],\n custom_field_section_id: section_id\n )\n if custom_field.save\n puts \"🟢 Field: \\\"#{row[\"name\"]}\\\" created (id: #{custom_field.id}).\"\n else\n puts \"🟠 Field: \\\"#{row[\"name\"]}\\\" failed to save. Continuing with import. #{custom_field.errors.messages}\"\n end \n end\n end\n end",
"title": ""
},
{
"docid": "d8b89e550677f65106db5ba27fabfc9e",
"score": "0.594861",
"text": "def add_field(name, position, size, colour)\n @fields[name] = { :name => name, :position => position, :size => size, :colour => colour }\n end",
"title": ""
},
{
"docid": "8996deefbe7bb98609f8ea5bf2df3bf2",
"score": "0.59294736",
"text": "def prepare_fields_and_override_hashes fields\n\n fields = fields.dup\n one_per_request_count = 0\n\n fields.each_pair do |field, setup|\n if Hash === setup\n value = setup[:value]\n case setup[:type]\n\n when OnePerRequest\n\n one_per_request_count += 1\n raise MultiplePerRequestFieldError unless one_per_request_count == 1\n\n # use first one for initial request, and rest for additional, yielding n - 1 new requests\n fields[field] = value.shift\n (value.map {|val| {field => val} }).each do |overrides|\n yield overrides\n end\n\n when Csv\n fields[field] = value.join(',') \n \n end\n end\n \n fields\n end\n end",
"title": ""
},
{
"docid": "7d69494e9c8fa1e465913ac13a63249e",
"score": "0.5928093",
"text": "def add(field_name, message); end",
"title": ""
},
{
"docid": "227f1ad8dfa82866467a8a23e390c841",
"score": "0.59279233",
"text": "def add_all_fields(multiple,fields)\n\t\tMETADATA_FIELDS.keys.each { |ns|\n\t\t\tadd_fields_by_ns(multiple,fields,ns)\n\t\t}\n\tend",
"title": ""
},
{
"docid": "558f1b0618a900f54dce9e627d8382b7",
"score": "0.5927597",
"text": "def fields( *args )\n args = object.attribute_names - RESERVED_FIELDS if args.size == 0\n output = ''\n args.each do |f|\n output += field f\n end\n output\n end",
"title": ""
},
{
"docid": "f2bd9d9b578ba6c78c9e5c4f4ea0fa6e",
"score": "0.5923816",
"text": "def add_fields\n @fields = JsonApiServer::Fields.new(request)\n self\n end",
"title": ""
},
{
"docid": "38fb9f3538b0ecf687902ec7167142d6",
"score": "0.592061",
"text": "def extra_fields\n return {} if extra_fields_to_display.blank?\n fields = {}\n for field in extra_fields_to_display.split(/$/)\n f = field.strip.split(\"|\")\n fields[f[0]] = f[1]\n end\n fields\n end",
"title": ""
},
{
"docid": "d186f7ab61942633a78f40b9a9efbae3",
"score": "0.59198076",
"text": "def format_field(*names)\n names.compact.join(\"_\").gsub(/[^A-Za-z0-9_]/, '_')\n end",
"title": ""
},
{
"docid": "cedec1619b344a05b146ed33f398298a",
"score": "0.59184206",
"text": "def field_names; @field_names; end",
"title": ""
},
{
"docid": "d87a4a3638cd9424a8ea63b4c5d5dd2c",
"score": "0.5917221",
"text": "def init_fields(fields)\n if fields.is_a?(Hash)\n self.class_eval { write_inheritable_attribute(:ss_fields, fields.values.select { |val| !val.blank? }) }\n elsif fields.is_a?(Array)\n self.class_eval { write_inheritable_attribute(:ss_fields, fields.select { |val| !val.blank? }) }\n end\n end",
"title": ""
},
{
"docid": "88e9fbc65de9b40a6955577f6527ec33",
"score": "0.5912259",
"text": "def addAdditionalFields(fieldName=nil, displayName=nil, matchingRule=nil, value=nil)\n additionalField = Hash.new()\n if fieldName!=nil #FieldName is the only mandatory field\n additionalField['FieldName'] = fieldName\n else\n return false\n end\n additionalField['DisplayName'] = displayName\n additionalField['MatchingRule'] = matchingRule\n additionalField['Value'] = value\n @additionalFields << additionalField\n end",
"title": ""
},
{
"docid": "d68e80cb337ce96e84a8ba50b6e47b77",
"score": "0.5908324",
"text": "def field(*field_names, &block)\n field_names.each do |field_name|\n field = @setup.field(field_name)\n @group.add_field(field)\n end\n end",
"title": ""
},
{
"docid": "3a802b68bff52acb51c5a6855e39605e",
"score": "0.5907526",
"text": "def field(name, field_obj)\n base_fields[name] = field_obj\n end",
"title": ""
},
{
"docid": "2eb1df77726aa2a86e2dc97874652ad2",
"score": "0.5897153",
"text": "def add_field(name, value, last=false)\n\t\t\tline = \"\"\n\t\t\[email protected] do line << \" \" end\n\n\t\t\tline << \"\\\"#{name}\\\": \"\n\t\t\t\n\t\t\tline << \"\\\"#{value}\\\"\" if value.is_a?(String)\n\t\t\tline << \"#{value}\" if value.is_a?(Integer)\n\t\t\t\n\t\t\tlast ? line << \"\\n\" : line << \",\\n\"\n\n\t\t\treturn line\n\t\tend",
"title": ""
},
{
"docid": "de5bd5d372976a9ac25847cfc1799651",
"score": "0.58970535",
"text": "def new_fields\n (self.fields ||= []).reject {|f| real_field_names.include?(f.name.to_s) }\n end",
"title": ""
},
{
"docid": "e4757d2713fd4508ae5b167c517b7271",
"score": "0.58892983",
"text": "def store_fields\n @data.inject([]) do |fields, data|\n hash = { :name => data[:dataIndex], :mapping => data[:mapping] }\n hash.merge!(:type => data[:renderer]) if data[:renderer] &&\n (data[:renderer] == :date || data[:renderer] == :datetime || data[:renderer] == :time_to_date)\n fields << hash\n fields\n end\n end",
"title": ""
},
{
"docid": "47de2dafe1e778a7d089f2323307ebe5",
"score": "0.5888698",
"text": "def rename_fields fields, newfields\n newfields.each do |of,nf|\n v = fields.delete(of)\n next unless v\n fields[nf] = v\n end\n return fields\n end",
"title": ""
},
{
"docid": "cfeb610ba8cfec0fc8c7e19c1ac4d289",
"score": "0.58877665",
"text": "def map_fields fields\n @idate = fields[:charging_date]\n @itime = fields[:charge_time]\n rename_fields fields,map_time_fields([:charging_date])\n end",
"title": ""
},
{
"docid": "23e1e96345ae395c6cb129499b54d8ee",
"score": "0.5882293",
"text": "def add_user_fields(user_fields, client)\n user_fields.each_index do |uf_idx|\n client.users.update!(\n id:user_fields[uf_idx][5],\n time_zone:\"Arizona\",\n tags: [\"tag1\", \"tag2\"],\n user_fields:{\n # text fields or drop downs\n custom_field_1:\"#{user_fields[uf_idx][1]}\",\n custom_field_2:\"#{user_fields[uf_idx][2]}\",\n custom_field_3:\"#{user_fields[uf_idx][3]}\",\n # numeric\n custom_field_4:user_fields[uf_idx][4]\n }\n )\n puts \"\\n\"\n puts \"-\" * 40\n puts \"#{user_fields[uf_idx][0]} complete!\"\n puts \"-\" * 40\n puts \"\\n\"\n end\nend",
"title": ""
},
{
"docid": "ad30e62ae8d9b3041baa8947d7bf1fb1",
"score": "0.58797014",
"text": "def automatic_translation_fields\n globalize_options[:translated_attributes].inject({}) do |cols, field| \n cols[field] = columns_hash[field.to_s].type\n cols\n end\n end",
"title": ""
},
{
"docid": "0ec05dce7baf9bbce9d03c1b79136a37",
"score": "0.5876885",
"text": "def import_fields\n ['contributor', 'coverage', 'creator', 'date', 'description', 'format', 'identifier', 'language', 'publisher', 'relation', 'rights', 'source', 'subject', 'title', 'type']\n end",
"title": ""
},
{
"docid": "611063c9ea08dcb6fedfadbfaf3e228a",
"score": "0.5874162",
"text": "def initialize_fields\n self.class.fields.each do |name,options|\n next if name == \"rod_id\"\n value =\n case options[:type]\n when :integer\n 0\n when :ulong\n 0\n when :float\n 0.0\n when :string\n ''\n when :object\n nil\n else\n raise InvalidArgument.new(options[:type],\"field type\")\n end\n send(\"#{name}=\",value)\n end\n end",
"title": ""
},
{
"docid": "463519cf2da2824c840ce985ca44a060",
"score": "0.5873612",
"text": "def format_params_field(name, params_fields, abstract)\n data =[]\n case name\n when :co_authors\n params_fields.reject(&:empty?).each do |params_field|\n data << params_field\n end\n abstract.update!(co_authors: data)\n when :references\n params_fields.split(\"\\r\\n\").each do |params_field|\n data << params_field\n end\n abstract.update!(references: data)\n #binding.pry\n when :keywords\n params_fields.split(\",\").reject(&:empty?).each do |params_field|\n data << params_field\n #binding.pry\n end\n abstract.update!(keywords: data)\n else\n puts \"Please edit abstract according to instructions.\"\n end\n end",
"title": ""
},
{
"docid": "8646d3128cb4f69f1f930e50a7983ab3",
"score": "0.58711946",
"text": "def add_field(name, value, options = {})\n @fields << Field.new(options.merge({:name=>name}), value)\n end",
"title": ""
},
{
"docid": "0c842080626f56161c8913106262667d",
"score": "0.5869656",
"text": "def database_field_names\n attributes = instance_variables.collect{|a| a.to_s.gsub(/@/,'')}\n attributes.delete(\"location_id\")\n attributes.delete(\"timeslot_id\")\n attributes.delete(\"errors\")\n attributes\n end",
"title": ""
}
] |
2ec5063d214bcfc80ca846161d48e324
|
Did I have published this message? Return: true|false
|
[
{
"docid": "1ed60c1e1e656e584a21a95a31812919",
"score": "0.0",
"text": "def isSelfMessage?\n if(@fromNick==@selfNick)\n return true\n else\n return false\n end\n end",
"title": ""
}
] |
[
{
"docid": "880c526bf1ae3460a92e677b5c0388a5",
"score": "0.7748866",
"text": "def publish?\n false\n end",
"title": ""
},
{
"docid": "bca7cdd0eb2267683c108d90c2e7da3d",
"score": "0.7674823",
"text": "def published?\n if self.publish_at < Time.now.utc\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "e6083867791373c1c536e0496231fafa",
"score": "0.7409524",
"text": "def published?\n published.eql?(true)\n end",
"title": ""
},
{
"docid": "1a9ea9176b94d65090158b99ec49402c",
"score": "0.73590755",
"text": "def publishing?\n # This probably does not need to be synchronized\n @publishing\n end",
"title": ""
},
{
"docid": "c3ef5626f003e8696ddbb21035f8bfe4",
"score": "0.7343774",
"text": "def can_publish?\n\t\ttrue\n\tend",
"title": ""
},
{
"docid": "75b893c656cca656576991ee9074866e",
"score": "0.73232746",
"text": "def published?\n (status == PUBLISHED)\n end",
"title": ""
},
{
"docid": "75b893c656cca656576991ee9074866e",
"score": "0.73232746",
"text": "def published?\n (status == PUBLISHED)\n end",
"title": ""
},
{
"docid": "75b893c656cca656576991ee9074866e",
"score": "0.73232746",
"text": "def published?\n (status == PUBLISHED)\n end",
"title": ""
},
{
"docid": "75b893c656cca656576991ee9074866e",
"score": "0.73232746",
"text": "def published?\n (status == PUBLISHED)\n end",
"title": ""
},
{
"docid": "75b893c656cca656576991ee9074866e",
"score": "0.73232746",
"text": "def published?\n (status == PUBLISHED)\n end",
"title": ""
},
{
"docid": "54ccfd609935ee6ad9f57a021986b550",
"score": "0.7300896",
"text": "def publishable?\n self.status == STATUS_PENDING\n end",
"title": ""
},
{
"docid": "97e7c2e23eb9042a5736f369f076ba2d",
"score": "0.729707",
"text": "def should_send_email?\n self.published? && !self.email_sent?\n end",
"title": ""
},
{
"docid": "4208760b27f83fcc87d3b13366970ad3",
"score": "0.72482693",
"text": "def publish_immediately?\n params[:publish_type].to_i > 0\n end",
"title": ""
},
{
"docid": "acf2127371eb92cfc8539d0b2bf6fbdc",
"score": "0.72384286",
"text": "def newly_published?\n !!@newly_published\n end",
"title": ""
},
{
"docid": "48c88e8baf7042581d4e969fbf31c194",
"score": "0.72225255",
"text": "def published?\n self.published\n end",
"title": ""
},
{
"docid": "69685dabe99db9c9404f40a446b29308",
"score": "0.7215078",
"text": "def published?\n if self.status == \"live\"\n true\n else\n false\n end\n end",
"title": ""
},
{
"docid": "fd5efd853b8eb8ae3cefd5abc57fa4c1",
"score": "0.7195793",
"text": "def is_published?\n self.publishing_state == PublishingState::PUBLISHED\n end",
"title": ""
},
{
"docid": "ae97055e0ee67fe5373b51ecf37adfc9",
"score": "0.7194179",
"text": "def published?\r\n (publish_at.nil? || (publish_at <=> Time.now) <= 0) && (unpublish_at.nil? || (unpublish_at <=> Time.now) >= 0)\r\n end",
"title": ""
},
{
"docid": "23808043d1638280746fdf0a7024e1af",
"score": "0.71870404",
"text": "def published?\n is_published && Time.at(publish_at.to_i).to_datetime <= DateTime.now\n end",
"title": ""
},
{
"docid": "f5e2764591bc1c261ad878543ae4bdfb",
"score": "0.71041024",
"text": "def published?\n published_at.present?\n end",
"title": ""
},
{
"docid": "53810be240afd91bb80fd5b0b4d77b51",
"score": "0.70899665",
"text": "def published_work?\n true\n end",
"title": ""
},
{
"docid": "4fcc65f3812b06eac04d18e645826c72",
"score": "0.70787966",
"text": "def mentioning?\n # Skip send notification if Doc not in publishing\n if instance_of?(Doc)\n publishing?\n else\n true\n end\n end",
"title": ""
},
{
"docid": "ba5ca4c83489e719cc5f1c759b894253",
"score": "0.7034456",
"text": "def published?\n !(data.key?(\"published\") && data[\"published\"] == false)\n end",
"title": ""
},
{
"docid": "ba5ca4c83489e719cc5f1c759b894253",
"score": "0.7034456",
"text": "def published?\n !(data.key?(\"published\") && data[\"published\"] == false)\n end",
"title": ""
},
{
"docid": "48ceb76dad1cb7d75db893815ca62fef",
"score": "0.6992681",
"text": "def published?; end",
"title": ""
},
{
"docid": "48ceb76dad1cb7d75db893815ca62fef",
"score": "0.6992681",
"text": "def published?; end",
"title": ""
},
{
"docid": "52a03c9f560b7efb5aa67ef973adde47",
"score": "0.6964981",
"text": "def msg_sent?\n true\n end",
"title": ""
},
{
"docid": "ca775defbfeccd880b0146e83ceb8f8f",
"score": "0.6957032",
"text": "def published?\n self.published_at.present?\n end",
"title": ""
},
{
"docid": "9042c8e3677f8afc894bd44260fde8c5",
"score": "0.69441867",
"text": "def published?\n [:public, :private].include?(self.status)\n end",
"title": ""
},
{
"docid": "227890b00335e757a49838b47e718ebf",
"score": "0.69402325",
"text": "def can_publish?\n !published_at\n end",
"title": ""
},
{
"docid": "c53c17dfcc2bfb0ca558266857210b1e",
"score": "0.69395286",
"text": "def publish!\n return true if published?\n publish_status!\n end",
"title": ""
},
{
"docid": "4eeffbf84649ba1b3b2462e8f9453eb1",
"score": "0.693183",
"text": "def trackable?\n published?\n end",
"title": ""
},
{
"docid": "22a9d76b3cb2422fb2160c3fb86805e2",
"score": "0.692391",
"text": "def published?\n !self.versions.published.last.nil?\n end",
"title": ""
},
{
"docid": "cabb2df7c32af59f823f3d17763e3045",
"score": "0.69103384",
"text": "def published?\n !published_at.nil?\n end",
"title": ""
},
{
"docid": "868bbb6e74f5aa7c10b096c49ecc7fb8",
"score": "0.69095033",
"text": "def finishable?\n self.status == STATUS_PUBLISHED\n end",
"title": ""
},
{
"docid": "174a50edd75dd74fc01b54040cac4c2c",
"score": "0.6898409",
"text": "def published?\n status == Status[:published]\n end",
"title": ""
},
{
"docid": "ea01424216638da57a97b3f9b47ada1e",
"score": "0.6885091",
"text": "def check_published\n \n if self.publishing_state == PublishingState::PUBLISHED\n self.publishing_date = Time.now\n self.publishing_publisher = connected_user.username\n end\n\n end",
"title": ""
},
{
"docid": "99974fe124fe855db752b012f7b0ee68",
"score": "0.68688405",
"text": "def has_message?\n has_message\n # && messages.count > 0\n end",
"title": ""
},
{
"docid": "0b6eb2d41cd5e646d37757b32ec4d3df",
"score": "0.6863373",
"text": "def is_published?\n return false if self.published_on.nil?\n return true if self.published_on <= Time.now.beginning_of_day\n return false\n end",
"title": ""
},
{
"docid": "e0b36c5c48a4793d21001a4297c03019",
"score": "0.6843244",
"text": "def published?\n sys[:publishedAt] ? true : false\n end",
"title": ""
},
{
"docid": "7574d1051fc7a99a43dc324f73febec9",
"score": "0.6825477",
"text": "def published?\n published == true || published == \"1\" || published == \"t\" || published == \"true\"\n end",
"title": ""
},
{
"docid": "3c1c32fc782b2da100175b4de2c87fb5",
"score": "0.6809321",
"text": "def publishable?\n false\n end",
"title": ""
},
{
"docid": "3bb5cf0ea072cf178b66fd84ac873215",
"score": "0.68074524",
"text": "def published?\n data['published'] != false && (blog_options.publish_future_dated || date <= Time.current)\n end",
"title": ""
},
{
"docid": "552d0ffeee2d5c7884b003274f604745",
"score": "0.67970103",
"text": "def notification?\n false\n end",
"title": ""
},
{
"docid": "58e77123e9540e03eecc6fd0a1dcccab",
"score": "0.6774833",
"text": "def unpublished?\n (status == UNPUBLISHED)\n end",
"title": ""
},
{
"docid": "58e77123e9540e03eecc6fd0a1dcccab",
"score": "0.6774833",
"text": "def unpublished?\n (status == UNPUBLISHED)\n end",
"title": ""
},
{
"docid": "58e77123e9540e03eecc6fd0a1dcccab",
"score": "0.6774833",
"text": "def unpublished?\n (status == UNPUBLISHED)\n end",
"title": ""
},
{
"docid": "58e77123e9540e03eecc6fd0a1dcccab",
"score": "0.6774833",
"text": "def unpublished?\n (status == UNPUBLISHED)\n end",
"title": ""
},
{
"docid": "58e77123e9540e03eecc6fd0a1dcccab",
"score": "0.6774833",
"text": "def unpublished?\n (status == UNPUBLISHED)\n end",
"title": ""
},
{
"docid": "80e417056967cec31e1a7fe664d1ef95",
"score": "0.67265725",
"text": "def published?\n is_public && pcp_step.released?\n end",
"title": ""
},
{
"docid": "1a12f06053b2f122562a2c35232cf5d9",
"score": "0.6708309",
"text": "def published?\n self.published_at.present?\n end",
"title": ""
},
{
"docid": "1141822a9d51d1b0a60eea1bc16616a1",
"score": "0.67035234",
"text": "def suscription_on?\n is_subscribed == true\n end",
"title": ""
},
{
"docid": "a03695ec7f11dab50014ab911a96f7be",
"score": "0.66698164",
"text": "def delivered?\n @delivered\n end",
"title": ""
},
{
"docid": "a09483773aca70ec7da73a30c910e2c4",
"score": "0.6631409",
"text": "def delivered?\n processed? && !held? && !bounced? && message.present?\n end",
"title": ""
},
{
"docid": "dc75241bdd742554b4759c1b779aad8d",
"score": "0.66250813",
"text": "def published?\n !is_privacy_private? && (!builder? || !derived? || mapcapped?)\n end",
"title": ""
},
{
"docid": "bb1333a9f7c8cdd7431244c36f8b3937",
"score": "0.66208285",
"text": "def message?\n false\n end",
"title": ""
},
{
"docid": "ea359a329f153724683fb85466335697",
"score": "0.6618306",
"text": "def published?\n if is_standard?\n respond_to?(:published_copy_count_col) ? (published_copy_count_col || 0) > 0 : copies.any?(&:published?)\n else\n read_attribute(:published)\n end\n end",
"title": ""
},
{
"docid": "cc2408170df86e26f4756f364a090d06",
"score": "0.66091573",
"text": "def publish\r\n if update_attribute('published', true)\r\n log_activity\r\n true\r\n else\r\n false\r\n end\r\n end",
"title": ""
},
{
"docid": "5b0d7b10a58e1b57218dae92e5753a49",
"score": "0.66088724",
"text": "def message_sent?\n message.state == 'sent'\n end",
"title": ""
},
{
"docid": "5b0d7b10a58e1b57218dae92e5753a49",
"score": "0.66088724",
"text": "def message_sent?\n message.state == 'sent'\n end",
"title": ""
},
{
"docid": "3b73c13d8dc8e2feddf90cb3250a7f87",
"score": "0.6606726",
"text": "def is_published? obj\n if obj.respond_to?(\"resource_state\") && obj.respond_to?(\"resource_published?\")\n obj.resource_published?\n else\n # if the object does not contain resource_state, we will assume that it is a published un-queued object\n true \n end\n end",
"title": ""
},
{
"docid": "7987d19eb26b7905a0eb3b1340bb4332",
"score": "0.66027033",
"text": "def publication_pending?\n validating? || creating? || testing?\n end",
"title": ""
},
{
"docid": "218a2cbd4a6a00374ce0c916a299a2e1",
"score": "0.6590885",
"text": "def verify_pinterest_post\n return @page.has_content?(@message_content)\n end",
"title": ""
},
{
"docid": "fc626f0e0f8cd29196591171d78a3333",
"score": "0.6588323",
"text": "def publishable?\n [ UNPUBLISHED, OUT_OF_DATE ].include? flickr_status\n end",
"title": ""
},
{
"docid": "83d4c574a83ceff199c46b17bf97b3d0",
"score": "0.65428334",
"text": "def has_unread_messages?\n received_messages.count > 0\n end",
"title": ""
},
{
"docid": "09c88d2cb117920b767e8f088a8db062",
"score": "0.6521906",
"text": "def require_push_notification?\n if action =~ /up_vote/ && subject.respond_to?(:votes)\n first_notification = !similar_notifications.exists?\n first_notification || subject.votes.count % PUSH_VOTES_INTERVAL == 0\n elsif action =~ /subscription\\.create/\n false\n else\n true\n end\n end",
"title": ""
},
{
"docid": "424a85e68706c4a354f941a0d5235d71",
"score": "0.65129036",
"text": "def unpublished?\n self.status == \"Unpublished\"\n end",
"title": ""
},
{
"docid": "9c9a0fc98eadbca5842121771ff9207c",
"score": "0.65067935",
"text": "def notification?\n kind == 'notification'\n end",
"title": ""
},
{
"docid": "b095fd038efaabba0107405f5965949b",
"score": "0.64676744",
"text": "def is_published?\n status === 'published'\n end",
"title": ""
},
{
"docid": "bbe64e2253a2a98ec9b45b52c61a8e16",
"score": "0.6463881",
"text": "def available?\n published? && published_at <= Time.current\n end",
"title": ""
},
{
"docid": "537d70634e024015c619d5461b7395cf",
"score": "0.6459081",
"text": "def published?\n published_at && published_at == edited_at\n end",
"title": ""
},
{
"docid": "537d70634e024015c619d5461b7395cf",
"score": "0.6459081",
"text": "def published?\n published_at && published_at == edited_at\n end",
"title": ""
},
{
"docid": "545a536b797420465200fb4592b9604b",
"score": "0.64587146",
"text": "def isMyMessage(message)\r\n return message[:type] == :Sent\r\n end",
"title": ""
},
{
"docid": "5f8cc9f84206903a490dde2e01e7e349",
"score": "0.64383334",
"text": "def published_very_soon?\n Edition\n .scheduled\n .where(\"scheduled_publication <= ?\", 5.seconds.from_now)\n .exists?(document_id: id)\n end",
"title": ""
},
{
"docid": "d4ff7103dbe643808e1974e410741352",
"score": "0.64365953",
"text": "def published?\n self.targets.map { |tgt| File.exist?(File.join(\n self.publish_path, self.to_s, tgt)) }.all?\n end",
"title": ""
},
{
"docid": "6009b2fb29a842e218846876218fd00e",
"score": "0.64320797",
"text": "def published?\n # He I don't use the static attr because a finished tip is also published\n !!self.published_at\n end",
"title": ""
},
{
"docid": "5c34032f8216d5e74474045ade89ce10",
"score": "0.642815",
"text": "def publish\n return true if self.published_at\n\n if self.new_record?\n return false unless self.save\n end\n\n self.published_at = Time.now\n self.save\n end",
"title": ""
},
{
"docid": "ee35703d7c8368df241d7c5d19534dca",
"score": "0.6424274",
"text": "def alerted?\n !alert_sent.nil?\n end",
"title": ""
},
{
"docid": "f7ab3e7dd4354f2ee8b285bf026345d6",
"score": "0.6420079",
"text": "def has_messages?\n\t\t\treturn !(messages.empty?)\n\t\tend",
"title": ""
},
{
"docid": "bf1a19951991b77c03fa2ae86d08320a",
"score": "0.6415913",
"text": "def is_published?\n\t !self.is_discontinued? && (Time.now >= Time.parse(self.date_available.to_s))\n\tend",
"title": ""
},
{
"docid": "0bca91c3d2aa9599f6cefba3b8220afd",
"score": "0.6396815",
"text": "def can_publish?\n !user.discourse_username.empty?\n end",
"title": ""
},
{
"docid": "022b3cc21b3f842f144bbf63b3eaaaad",
"score": "0.6394376",
"text": "def subscribed?\n self.type == :subscribed\n end",
"title": ""
},
{
"docid": "fde08486f35eabd207b2c48d4c9a3187",
"score": "0.6389236",
"text": "def message_rendered?\n @_message_rendered\n end",
"title": ""
},
{
"docid": "23c58afb75b997801a0d2953e378792f",
"score": "0.63765585",
"text": "def published?\n is_standard? ? false : forms.any?(&:published?)\n end",
"title": ""
},
{
"docid": "d4e782daffa1a4bc84c8a7d39bd1ff9c",
"score": "0.6375363",
"text": "def published?\n if is_standard?\n respond_to?(:copy_form_published_col) ? copy_form_published_col == 1 : copies.any?(&:published?)\n else\n respond_to?(:form_published_col) ? form_published_col == 1 : forms.any?(&:published?)\n end\n end",
"title": ""
},
{
"docid": "e365bb6753f4a5935a1d9b0da1b24bea",
"score": "0.6373418",
"text": "def subscribed?\n self.subscription == :subscribed\n end",
"title": ""
},
{
"docid": "17613709647461b5fad55baeab3a6729",
"score": "0.63566834",
"text": "def first_time_authorized?\n self.authorized == true && self.message_sent == false\n end",
"title": ""
},
{
"docid": "5572dfefe105be0d074032c2ad00f25a",
"score": "0.63520366",
"text": "def has_subscribed?( publication )\n subscriptions.by_publication(publication).exists?\n end",
"title": ""
},
{
"docid": "e24c66a90267a7768e9794c3aac3704a",
"score": "0.63330436",
"text": "def subscribed?\n self.friendship_status > 0\n end",
"title": ""
},
{
"docid": "6b975a7f7ecdc60d3cf4447212341570",
"score": "0.6332142",
"text": "def able_to_send_freeform_text?\n last_inbound_message = messages.inbound.last\n return false unless last_inbound_message\n\n last_inbound_message.created_at + 24.hours >= Time.zone.now\n end",
"title": ""
},
{
"docid": "90aa2a5a2e05f016a4b8d2ddc57cbb03",
"score": "0.6330991",
"text": "def draft?\n self.sent? || self.batch_sent? ? false : true\n end",
"title": ""
},
{
"docid": "573177292c782d7dab8542c953a638a4",
"score": "0.6312031",
"text": "def verify_notification\n wait_for_css(input_elements[:entries])\n entries = get_entries\n entries.each do |entry|\n if entry[\"data-mention-id\"].eql?(@stream_post_id)\n user_icon = entry.all(input_elements[:notification_icon]).first\n return true if user_icon[\"data-original-title\"].include?(\"Assigned to \")\n return false\n end\n end\n return false\n end",
"title": ""
},
{
"docid": "c7286538dd4de1c838972c8b06604a99",
"score": "0.63045835",
"text": "def system_msg?\n posts.first.system_msg? rescue nil\n end",
"title": ""
},
{
"docid": "1b9300423dfd232499201c0aa7da4cde",
"score": "0.6291196",
"text": "def should_publish(id)\n (@play_counts[id] < 100) || (@batch_counter > 99) || (Time.now - @oldest_time_in_batch > 60)\n end",
"title": ""
},
{
"docid": "4c3b8a8acdd4b65d5355501d946a268c",
"score": "0.6281243",
"text": "def permitted_to_publish?\n @pcp_subject.user_is_owner_or_deputy?( current_user, @pcp_subject.current_step.acting_group_index )\n end",
"title": ""
},
{
"docid": "7a82554b7d93da8a1ba3e8729fc590e9",
"score": "0.62800497",
"text": "def to_pubsub_domain?\n stream.config.pubsub?(validate_to)\n end",
"title": ""
},
{
"docid": "1f15939835cca1cdd56e4a6ddf81ea88",
"score": "0.62785035",
"text": "def publish\n update!(email_status: \"verified\", published_at: Time.now.utc)\n end",
"title": ""
},
{
"docid": "8a2134ca5e0eeba51729ae4bac677131",
"score": "0.6275221",
"text": "def publish_button?\n return false unless params[:button]\n\n [PUBLISH, UNPUBLISH].include? params[:button].upcase\n end",
"title": ""
},
{
"docid": "ba28930e8ab6ec6d5c2fbd25ecb4a17a",
"score": "0.6267715",
"text": "def successfully_sent?(resource)\n message_kind = resolve_message_kind!(resource)\n\n return false if message_kind.nil?\n\n @message = find_message(message_kind, {})\n true\n end",
"title": ""
},
{
"docid": "2cc2f7293e9391be860f6d9d7aefda1b",
"score": "0.62657624",
"text": "def has_notifications?\n !notification_queue.empty?\n end",
"title": ""
},
{
"docid": "ff8e1aaa8f8f282d36b844b23a9620f3",
"score": "0.62632805",
"text": "def already_thanked?(topic)\n notification = Notification.thanked_by(self.id, topic.id)\n !notification.empty?\n end",
"title": ""
}
] |
c5117a0ceaa747132e9540726786e937
|
def household_first_phone Phone.find(:first, :conditions => ['phonable_id = ?', self.household_id]) end
|
[
{
"docid": "f99f3095f91e997d466b621fca218801",
"score": "0.0",
"text": "def first_email\n\t Email.find(:first, :conditions => ['emailable_id = ?', self.id])\n\tend",
"title": ""
}
] |
[
{
"docid": "351ceb714c3f3ae43d8a89c7b2339df4",
"score": "0.77081347",
"text": "def primary_phone\n phone_numbers.find(:first, :conditions => {:preferred => true}) || phone_numbers.first\n end",
"title": ""
},
{
"docid": "ccae77145b3b8805a891069bb4f00270",
"score": "0.68381274",
"text": "def mobile_number\n person.phones.first.number\n end",
"title": ""
},
{
"docid": "0c939bbc59b4b27af2a4e7dc5173e388",
"score": "0.67264295",
"text": "def phones\n Phone.find(:phone_owner => id)\n end",
"title": ""
},
{
"docid": "215e6c87b67b1bce5ca8147b05e48f73",
"score": "0.6589058",
"text": "def primary_address_phone\n primary_phone\n end",
"title": ""
},
{
"docid": "ce7e33a61a6fef798846fa9784697a13",
"score": "0.6498689",
"text": "def phone\n record.phone\n end",
"title": ""
},
{
"docid": "8148eb7e1b94e415c764401e47a32304",
"score": "0.6471667",
"text": "def phone_number\n accounts.where(\"phone_number is not null\").first.phone_number \n end",
"title": ""
},
{
"docid": "5a7920931194204bfe0f6aac679b2691",
"score": "0.6443314",
"text": "def retrieve_phone(shipment)\n shipment.address.phone\n end",
"title": ""
},
{
"docid": "5a7920931194204bfe0f6aac679b2691",
"score": "0.6443314",
"text": "def retrieve_phone(shipment)\n shipment.address.phone\n end",
"title": ""
},
{
"docid": "de65dfb0c77987ff8fbe3693f3a81380",
"score": "0.6357176",
"text": "def supplier_phone\n composite = product.supply_details.first\n composite.nil? ? nil : composite.telephone_number\n end",
"title": ""
},
{
"docid": "ed473a836d4ce62fa0b74fd70f954233",
"score": "0.6355014",
"text": "def first_round\n self.rounds.find(:first,\n :conditions => \"number = #{1}\" )\n end",
"title": ""
},
{
"docid": "76ef19a68e1c5d80e1a2193200b9b2ce",
"score": "0.6332024",
"text": "def first\n self.find(:first)\n end",
"title": ""
},
{
"docid": "fac2d207702b6ad968a755f65f75a549",
"score": "0.6324987",
"text": "def first_voice_or_hotline_phone_for(phones)\n phones.find { |phone| voice_or_hotline?(phone) }\n end",
"title": ""
},
{
"docid": "b0fa79fbd7faadd2eb4b22c3452f929f",
"score": "0.63199514",
"text": "def address\n self.addresses.where(\"is_primary = true\").first\n end",
"title": ""
},
{
"docid": "733d25fb5185623a96b20139d6e69c41",
"score": "0.6253616",
"text": "def phone\n number_to_phone object.phone\n end",
"title": ""
},
{
"docid": "d20185c4d993149ee7cb43048d4429e6",
"score": "0.6245968",
"text": "def set_brand_by_phone\n brand_setting = BrandSetting.where(:setting => @our_phone )\n if brand_setting.blank?\n @brand = Brand.all.first\n else\n @brand = brand_setting.first.brand\n end\n end",
"title": ""
},
{
"docid": "c59bcff71065f7644a5bbe1ff50d8af1",
"score": "0.6226549",
"text": "def find_first(conditions)\n\t\t\t\t\tklass.first(conditions)\n\t\t\t\tend",
"title": ""
},
{
"docid": "c59bcff71065f7644a5bbe1ff50d8af1",
"score": "0.6226549",
"text": "def find_first(conditions)\n\t\t\t\t\tklass.first(conditions)\n\t\t\t\tend",
"title": ""
},
{
"docid": "1636848579c39e51360e00c33aabb2fa",
"score": "0.62143886",
"text": "def home_phone_number\n phone_record(\"Home\").phone_number\n end",
"title": ""
},
{
"docid": "c76d58f1aea942c5b3d2d7b6f6278af5",
"score": "0.6209994",
"text": "def get_phone_number\n \"Phone: #{phone_numbers.first}\"\n end",
"title": ""
},
{
"docid": "51f03cf929f54cbc7db7911690c21cad",
"score": "0.6201143",
"text": "def set_phone\n @phone = Phone.find(params[:id])\n end",
"title": ""
},
{
"docid": "51f03cf929f54cbc7db7911690c21cad",
"score": "0.6201143",
"text": "def set_phone\n @phone = Phone.find(params[:id])\n end",
"title": ""
},
{
"docid": "2b832279e3511a77c8a1542ccc62464c",
"score": "0.620038",
"text": "def get_first\n\n end",
"title": ""
},
{
"docid": "9ca78e1da2b657fc32152924aa6aab0e",
"score": "0.6184753",
"text": "def first\n find(:first)\n end",
"title": ""
},
{
"docid": "76bc32e5b5798847dcd11816bc38e1f2",
"score": "0.61807525",
"text": "def primary_contact(options={})\n primary = self.contacts.where(:is_primary=>true).first\n primary ||= (self.family.head.primary_contact if self.child && family.head.primary_contact)\n if !primary && is_married? && options[:no_substitution].nil?\n primary = spouse.contacts.where(:is_primary=>true).first\n end\n return primary\n end",
"title": ""
},
{
"docid": "b38168b9fa729de5f7a4c2f18916752a",
"score": "0.61476684",
"text": "def set_phone\n @phone = Fonelator::Phone.where(id: params[:id], user_id: fonelator_current_user.id).take\n end",
"title": ""
},
{
"docid": "55a64d34f4b59d8dad65df4d03907f26",
"score": "0.61421436",
"text": "def phone\n contact.phone\n end",
"title": ""
},
{
"docid": "950969bab8423434bf80b675f9e6fc1f",
"score": "0.6119261",
"text": "def set_person_phone\n @person_phone = PersonPhone.find(params[:id])\n end",
"title": ""
},
{
"docid": "d74f93fdc45fbe018238e80648180a1f",
"score": "0.61188006",
"text": "def set_phonenumber\n @phonenumber = Phonenumber.find(params[:id])\n end",
"title": ""
},
{
"docid": "1feb58d30f8809c34f3b45213d34f3f1",
"score": "0.6115316",
"text": "def mother; Participant.where(:p_id => 'M').first; end",
"title": ""
},
{
"docid": "6058f951094a3b02580cc97d84cac615",
"score": "0.6109683",
"text": "def phone\n return @phone\n end",
"title": ""
},
{
"docid": "6058f951094a3b02580cc97d84cac615",
"score": "0.6109683",
"text": "def phone\n return @phone\n end",
"title": ""
},
{
"docid": "6058f951094a3b02580cc97d84cac615",
"score": "0.6109683",
"text": "def phone\n return @phone\n end",
"title": ""
},
{
"docid": "6058f951094a3b02580cc97d84cac615",
"score": "0.6109683",
"text": "def phone\n return @phone\n end",
"title": ""
},
{
"docid": "d61857762581b0e76b953b8779544d4c",
"score": "0.6100268",
"text": "def phone\n object.details[\"Number_Phone1\"] ||\n object.details[\"Number_Phone2\"] ||\n object.details[\"Number_Phone3\"] \n end",
"title": ""
},
{
"docid": "bf850e19572536c55a4504dd9f973000",
"score": "0.60956734",
"text": "def first\n\t\t@first\n\tend",
"title": ""
},
{
"docid": "4c5ed951a5e07c7518a0965e581c78c8",
"score": "0.6093179",
"text": "def first!\n first || fail(RecordNotFound)\n end",
"title": ""
},
{
"docid": "ccc5040542415eb1b129e400941ce8bb",
"score": "0.60918105",
"text": "def first\n object_from_address(@base[:first])\n end",
"title": ""
},
{
"docid": "dbe0092b7c7793906a67c595b32e900f",
"score": "0.60884845",
"text": "def first\n relation = query(:first)\n relation ? relation.object : nil\n end",
"title": ""
},
{
"docid": "a5242dccabd4ba1bddb22f401280209b",
"score": "0.608125",
"text": "def phone\n PHONES.sample\n end",
"title": ""
},
{
"docid": "d39560df371e1b83df18ea6a57c15403",
"score": "0.6078018",
"text": "def gsm\n self.phones.any? ? self.phones.first.number : nil\n end",
"title": ""
},
{
"docid": "7b69c77aa3875ed9cc69bcb8da6532f1",
"score": "0.6073128",
"text": "def set_phone\n @phone = Phone.find(params[:id])\n @profile = @phone.try :contact_detail\n end",
"title": ""
},
{
"docid": "1bd5de7f2f202fda53e4e429de214c29",
"score": "0.607118",
"text": "def phone\n self[:phone] || nation.phone\n end",
"title": ""
},
{
"docid": "34cf19095916e0cf841b11964ae0dccf",
"score": "0.60684866",
"text": "def primary_contact\n User.find(self.contact) if self.contact.present?\n end",
"title": ""
},
{
"docid": "4ff0d3211865ecf7efcd5d00f73d0d40",
"score": "0.60580873",
"text": "def phone\n @phone ||= retrieve_contact_field(:phone)\n end",
"title": ""
},
{
"docid": "4a4a2c0ff0209b0861a308c74ed1cbd7",
"score": "0.60527426",
"text": "def set_phone\n @phone = Phone.find(params[:id])\n end",
"title": ""
},
{
"docid": "4a4a2c0ff0209b0861a308c74ed1cbd7",
"score": "0.60527426",
"text": "def set_phone\n @phone = Phone.find(params[:id])\n end",
"title": ""
},
{
"docid": "4a4a2c0ff0209b0861a308c74ed1cbd7",
"score": "0.60527426",
"text": "def set_phone\n @phone = Phone.find(params[:id])\n end",
"title": ""
},
{
"docid": "4a4a2c0ff0209b0861a308c74ed1cbd7",
"score": "0.60527426",
"text": "def set_phone\n @phone = Phone.find(params[:id])\n end",
"title": ""
},
{
"docid": "4a4a2c0ff0209b0861a308c74ed1cbd7",
"score": "0.60527426",
"text": "def set_phone\n @phone = Phone.find(params[:id])\n end",
"title": ""
},
{
"docid": "4a4a2c0ff0209b0861a308c74ed1cbd7",
"score": "0.60527426",
"text": "def set_phone\n @phone = Phone.find(params[:id])\n end",
"title": ""
},
{
"docid": "4a4a2c0ff0209b0861a308c74ed1cbd7",
"score": "0.60527426",
"text": "def set_phone\n @phone = Phone.find(params[:id])\n end",
"title": ""
},
{
"docid": "4a4a2c0ff0209b0861a308c74ed1cbd7",
"score": "0.60527426",
"text": "def set_phone\n @phone = Phone.find(params[:id])\n end",
"title": ""
},
{
"docid": "936105df5ba0793bfbd1c64831549007",
"score": "0.60516393",
"text": "def phone_for_form\n self.phone_numbers? ? self.phone_numbers.primary : PhoneNumber.new\n end",
"title": ""
},
{
"docid": "634da20baba5237c1bcc99d1a9d0714a",
"score": "0.60332596",
"text": "def set_phone\n @phone = Phone.find(params[:id])\n end",
"title": ""
},
{
"docid": "07848869640ec5f79c49c3ef8309a629",
"score": "0.6029623",
"text": "def first_property\n # if first_id\n Property.find(first_id)\n # else\n # Property.where(title: first_prop).first\n # end\n end",
"title": ""
},
{
"docid": "1d7c5aa953692884ae67b78acd45d8bb",
"score": "0.6024884",
"text": "def first!\n first or raise RecordNotFound\n end",
"title": ""
},
{
"docid": "25f6fe298bc46858b160ef0d1019d686",
"score": "0.60219544",
"text": "def find_first(criteria,*args,&evaluator)\n case criteria\n when Array\n criteria = criteria.first\n when self, Numeric, String\n # PASS-THROUGH\n when Model::Base\n criteria = criteria.id\n else\n raise ArgumentError, \"unsupported find_first criteria: #{criteria}:#{criteria.class}\"\n end \n find_by_identity(criteria,&evaluator)\n end",
"title": ""
},
{
"docid": "1fd0031ddc636e75087003e8e9c8325c",
"score": "0.6003988",
"text": "def person_detail\n PersonDetail.where(person_id: id).first || PersonDetail.new(person: self)\n end",
"title": ""
},
{
"docid": "1c1b62f2ff49c40d2fc4d3131bdabcc8",
"score": "0.5997405",
"text": "def set_head_phone\n @head_phone = HeadPhone.find(params[:id])\n end",
"title": ""
},
{
"docid": "c46acdce59fc24f228c37625773c2a6a",
"score": "0.5993012",
"text": "def find_first(query)\n find(query).first\n end",
"title": ""
},
{
"docid": "f5125195666de6f3c455b70d15d80e8a",
"score": "0.5973471",
"text": "def first_brother(opts={})\n brothers(opts).first \n end",
"title": ""
},
{
"docid": "548deac8997f98d9a36b7fc4e1f24ec6",
"score": "0.5971696",
"text": "def contact_phone\n contact.phone\n end",
"title": ""
},
{
"docid": "28c0b82c4f84cac5b717606472b6c321",
"score": "0.59655505",
"text": "def contact_phone\n return Contact.create(:name => self.phone, :contact_type_id => 2)\n end",
"title": ""
},
{
"docid": "41db8e7bf4a82903f3bded3d74c168ec",
"score": "0.59598994",
"text": "def first\n _build_criteria.first\n end",
"title": ""
},
{
"docid": "a8d876559226ccd8d9b927930de60523",
"score": "0.5950102",
"text": "def phone; end",
"title": ""
},
{
"docid": "78a3e1e8b9d0f4fdbeed2868de8050a5",
"score": "0.59426033",
"text": "def set_phone\n begin\n @phone = Phone.find(params[:id])\n rescue \n\n end\n end",
"title": ""
},
{
"docid": "47b5d2ed0592408030c5c155b9feb607",
"score": "0.59390056",
"text": "def find_phone_user\n user_with_phone = nil\n i = 1\n until user_with_phone\n user = client.get_person_by_id(i)\n puts \"Looking at user: #{user.vanId} with name: #{user.firstName} #{user.lastName}\"\n if user.errors&.any? || !user.phones.nil?\n user_with_phone = user\n break\n end\n i += 1\n end\n ap user_with_phone.to_h\n end",
"title": ""
},
{
"docid": "3a87daf9b976874fe99dfe226fcc6cf6",
"score": "0.59376067",
"text": "def first(*args)\n @association.first(*args)\n end",
"title": ""
},
{
"docid": "0ce7a2142f9b157f3d70947e8c39a28c",
"score": "0.5936709",
"text": "def get_primary_contact\n #Modified by Ketki 19/10/2010\n first = self.primary_contact_id\n unless first.nil?\n Contact.find_with_deleted(first)\n end\n end",
"title": ""
},
{
"docid": "fe6d771d912ec67259f9df64bb46681e",
"score": "0.59245926",
"text": "def find_first(conditions)\n klass.first :conditions => conditions_to_fields(conditions)\n end",
"title": ""
},
{
"docid": "db06443267b6a825b7256b5aa5377c98",
"score": "0.5922476",
"text": "def phone_number\n if self.phone.empty? then return self.phone end\n formatted_did = clean_did(self.phone)\n format_did(formatted_did)\n end",
"title": ""
},
{
"docid": "db06443267b6a825b7256b5aa5377c98",
"score": "0.5922476",
"text": "def phone_number\n if self.phone.empty? then return self.phone end\n formatted_did = clean_did(self.phone)\n format_did(formatted_did)\n end",
"title": ""
},
{
"docid": "789ddf09b086e400dc35fd5c7af3ff17",
"score": "0.59143865",
"text": "def show\n @street = Relation.where(:rid => 2750662).first\n end",
"title": ""
},
{
"docid": "56a3d738e9d7df6266a15e9ef2d4a4d8",
"score": "0.59136355",
"text": "def get_buyerphone(order)\n return order.bill_address.phone\n end",
"title": ""
},
{
"docid": "0a28523ced7f9e1fac18957ae5379eab",
"score": "0.59050125",
"text": "def find_first(conditions)\n if conditions.keys.first == :id\n klass.get(conditions.values.first)\n else\n klass.send(\"by_#{conditions.keys.first}\", {:key => conditions.values.first, :limit => 1}).first\n end\n end",
"title": ""
},
{
"docid": "a99d97739b41dc9aaa70513acba08e80",
"score": "0.5880497",
"text": "def set_phoning\n @phoning = Phoning.find(params[:id])\n end",
"title": ""
},
{
"docid": "9c0d6b9e3dcd82629919316c2e3e136a",
"score": "0.5875137",
"text": "def set_headphone\n @headphone = Headphone.find(params[:id])\n end",
"title": ""
},
{
"docid": "d89e422cab05b6b5eebcc2208e4c472d",
"score": "0.5865671",
"text": "def set_phone\n @phone = current_link_instance.phones.find(params[:id])\n end",
"title": ""
},
{
"docid": "45ff6f2eb88d0f042210366760a61f2f",
"score": "0.58610976",
"text": "def find_first(conditions = nil, orderings = nil)\n find_all(conditions, orderings, 1).first\n end",
"title": ""
},
{
"docid": "715573154fa6682a241efc341435af72",
"score": "0.5855617",
"text": "def first\n @first\n end",
"title": ""
},
{
"docid": "58a601d8116c176f9da0228980d9ad00",
"score": "0.5852023",
"text": "def primary_persona\n self.personas.asc(:rank).first\n end",
"title": ""
},
{
"docid": "95c1f04965ce377a3f3fed112ed0cde1",
"score": "0.584901",
"text": "def first!\n first || raise(OccamsRecord::NotFound.new(model.name, scope.where_values_hash))\n end",
"title": ""
},
{
"docid": "c0332e54dbe3a66ab9182c3fc85e599a",
"score": "0.5845689",
"text": "def work_phone_number\n phone_record(\"Work\").phone_number\n end",
"title": ""
},
{
"docid": "db8f7b4e4914f31dccd9b6ed541839fa",
"score": "0.58366436",
"text": "def get_phone_by_id(id)\n require_relative 'phone'\n Phone.new(@api, @api.do_request(\"GET\", get_base_api_path() + \"/phones/#{id}\"))\n end",
"title": ""
},
{
"docid": "db8f7b4e4914f31dccd9b6ed541839fa",
"score": "0.58366436",
"text": "def get_phone_by_id(id)\n require_relative 'phone'\n Phone.new(@api, @api.do_request(\"GET\", get_base_api_path() + \"/phones/#{id}\"))\n end",
"title": ""
},
{
"docid": "db8f7b4e4914f31dccd9b6ed541839fa",
"score": "0.58366436",
"text": "def get_phone_by_id(id)\n require_relative 'phone'\n Phone.new(@api, @api.do_request(\"GET\", get_base_api_path() + \"/phones/#{id}\"))\n end",
"title": ""
},
{
"docid": "ce696d558da48f34334f3dc18ba587d4",
"score": "0.58097947",
"text": "def primary_contact\n self\n end",
"title": ""
},
{
"docid": "eb28c28e9e3bc22a281d5ef21a36e213",
"score": "0.5808592",
"text": "def first()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "a1f6838db2a25e462f59e9a951269519",
"score": "0.5793832",
"text": "def find_first(conditions = nil, orderings = nil)\n sql = \"SELECT * FROM #{table_name} \"\n add_conditions!(sql, conditions)\n sql << \"ORDER BY #{orderings} \" unless orderings.nil?\n sql << \"LIMIT 1\"\n record = connection.select_one(sql, \"#{name} Load First\")\n instantiate(record) unless record.nil?\n end",
"title": ""
},
{
"docid": "5664a830c2553638a722b47d005f3519",
"score": "0.5789866",
"text": "def get_farmer\n @_farmer ||= Farmer.where(phone_number: get_phone_number).first\n end",
"title": ""
},
{
"docid": "3a803fe0cef088a49c750958eaf84220",
"score": "0.57861507",
"text": "def first\n find.limit(1).first\n end",
"title": ""
},
{
"docid": "f2d454643b09b2253d62d284a30a7446",
"score": "0.5785154",
"text": "def contact_phone_number\n if location && !location.phone.blank?\n location.phone\n else\n company.contact_phone_number\n end\n end",
"title": ""
},
{
"docid": "afea0a987f6ff371b83018133fdcd7c8",
"score": "0.57812583",
"text": "def primary\n customer.InvoiceAdressNo == id\n end",
"title": ""
},
{
"docid": "4913d6357c6f3ed58887ae289657c5d0",
"score": "0.5778186",
"text": "def billing_phone\n @attributes[:billing_phone]\n end",
"title": ""
},
{
"docid": "059360038429fbbe604b7cbb0778f533",
"score": "0.57771856",
"text": "def first(*args)\n find(:first, *args)\n end",
"title": ""
},
{
"docid": "059360038429fbbe604b7cbb0778f533",
"score": "0.57771856",
"text": "def first(*args)\n find(:first, *args)\n end",
"title": ""
},
{
"docid": "059360038429fbbe604b7cbb0778f533",
"score": "0.57771856",
"text": "def first(*args)\n find(:first, *args)\n end",
"title": ""
},
{
"docid": "059360038429fbbe604b7cbb0778f533",
"score": "0.57771856",
"text": "def first(*args)\n find(:first, *args)\n end",
"title": ""
},
{
"docid": "26c6829e9926b016a3e97bdc4be77278",
"score": "0.57749647",
"text": "def set_ab_phone\n @ab_phone = AbPhone.find(params[:id])\n end",
"title": ""
},
{
"docid": "30bd9e47fb221c99c07c240bce221eba",
"score": "0.5772255",
"text": "def has_one?; end",
"title": ""
},
{
"docid": "849ccbb117b289e6374a7a244a6f9b59",
"score": "0.5771891",
"text": "def first\n object_from_address(@base.first)\n end",
"title": ""
}
] |
d74f50a9070f2302cd6b4c1e9c33ea77
|
Renders the enum section.
|
[
{
"docid": "6aa15876e4857edd8e8da7b056cf60bb",
"score": "0.6467181",
"text": "def enum\n erb(:enum)\nend",
"title": ""
}
] |
[
{
"docid": "eba6296996274dfd713e785a47724354",
"score": "0.7086042",
"text": "def render_enum(width)\n # TODO: Also refactor args here\n args_texts = self.descrs.empty? ? [\"\"] : descrs.map(&:text)\n args_texts.map { |args_text| render_single(width, args: [args_text]) }\n end",
"title": ""
},
{
"docid": "07d1438832b26069a882c2a09375301c",
"score": "0.67526555",
"text": "def render_enums\n # get likely enum attributes\n enums = model_attributes.select{ |attr| field_is_enum?(attr) }\n\n # for each enum, create a constant, an enum field, and validation\n enums.map{ |attr|\n <<-code\n #{attr.name.pluralize.upcase} = { active: 'Active', inactive: 'Inactive' }\n enum #{attr.name}: #{attr.name.pluralize.upcase}.keys\n validates :#{attr.name}, presence: true\n\n code\n }.join\n end",
"title": ""
},
{
"docid": "e745501e2d1a107803db14001e173121",
"score": "0.6574092",
"text": "def render_unprocessed_enum_values(union)\n return unless union.discriminant_type\n\n union.discriminant_type.members.each do |member|\n next if union.case_processed?(member.name)\n\n @generated.puts \"#{name(union)}Arm#{member.name.underscore.camelize}:\"\n @generated.indent do\n @generated.puts 'type: object'\n @generated.puts 'properties:'\n @generated.indent do\n @generated.puts(\"#{name(union.discriminant).downcase}:\")\n @generated.indent do\n @generated.puts 'type: string'\n @generated.puts \"enum: [#{member.name.underscore.upcase}]\"\n render_documentation_if_needed(member)\n end\n end\n end\n end\n end",
"title": ""
},
{
"docid": "bb6a021f7d10cea2de3ce0d01ee25e1d",
"score": "0.59596497",
"text": "def render_menu\n output = ''\n @choices.each_with_index do |choice, index|\n num = (index + 1).to_s + @enum + Symbols::SPACE\n selected = Symbols::SPACE * 2 + num + choice.name\n output << if index + 1 == @active\n @prompt.decorate(\"#{selected}\", @active_color)\n else\n selected\n end\n output << \"\\n\"\n end\n output\n end",
"title": ""
},
{
"docid": "6108aa38c9efbe3e9e6eb050e49195ff",
"score": "0.59122986",
"text": "def select_enum(title, method, values, selected)\n buf = []\n buf << div_class('label', label(title))\n buf << div_class('radio_group', enum_radio_group(method, values, selected))\n div_id('select_enum', buf.join(\"\\n\"))\n end",
"title": ""
},
{
"docid": "c4d8bae49da15dcd3fb5928470cd8873",
"score": "0.5847519",
"text": "def print_enum_values values\n return if values.nil?\n return if values.empty?\n\n puts \"\\n**Values**\\n\"\n puts \"Name | Description\\n\"\n puts \"-|-\\n\"\n values.each do |v|\n puts \"#{v['name']} | #{print_description(v['description'])}\\n\"\n end\n end",
"title": ""
},
{
"docid": "d547f35392c98b57df71de2d4d877fc3",
"score": "0.57418793",
"text": "def build_status_section\n indent 20 do\n text \"<b>Status:</b> #{ClaimStatus.definition(@eob.claim_status_code) if [email protected]_status_code.blank? }\", :inline_format => true\n text \"<b>Indicator:</b> #{ClaimFilingIndicator.definition(@eob.claim_indicator_code) if [email protected]_indicator_code.blank? }\", :inline_format => true\n end\n end",
"title": ""
},
{
"docid": "4e7ff6c9db9335ea41010567f55b0f36",
"score": "0.5730872",
"text": "def parse_enum(node)\n enum_match = node.attribute(\"name\").to_s\n enum_val = node.attribute(\"value\").to_s\n\n # Make sure the first letter is always uppercase, for RubyMotion\n enum_match = \"%s%s\" % [enum_match[0,1].upcase, enum_match[1..-1]]\n\n enum_display = \"%s (%s)\" % [enum_match, enum_val]\n\n # Add the element\n @fragment << create_dict(enum_display, nil, enum_match)\n end",
"title": ""
},
{
"docid": "b911d36d1affa3a370748c24c34f4980",
"score": "0.5726254",
"text": "def render_type(type)\n\t\tif type.to_f == 0 then \n\t\t\traw(\"<kbd>Rent</kbd>\") \n\t\t\t#raw(\"<span class='label label-default'>Rent</span>\") \n\t\telsif type.to_f == 1\n\t\t\traw(\"<span class='label label-success'>Shared Apt.</span>\") \n\t\telsif type.to_f == 2\n\t\t\traw(\"<span class='label label-warning'>Sublease</span>\") \n\t\tend\t\t\t\t\t\t\n\tend",
"title": ""
},
{
"docid": "cd2851d7f7d95c473c735b630752a69f",
"score": "0.569563",
"text": "def parse_enum( node, fragment )\n enum_match = node.attribute( \"name\" ).to_s\n enum_val = node.attribute( \"value\" ).to_s\n\n # Make sure the first letter is always uppercase, for RubyMotion\n enum_match = \"%s%s\" % [ enum_match[0,1].upcase, enum_match[1..-1] ]\n\n enum_display = \"%s (%s)\" % [ enum_match, enum_val ]\n\n # Add the element\n fragment << create_dict( enum_display, nil, enum_match )\n \n return fragment\n end",
"title": ""
},
{
"docid": "661f4b9a4f9db35fa3476e4446f527e4",
"score": "0.56223774",
"text": "def partial_enum view_name, enum, locals = {}, &block\n result = []\n did_any = EnumExtension.enumerate_over(enum) do |item, index, first, alt, last|\n result << partial(view_name, item, {:is_first => first, :index => index, :is_last => last, :is_alt => alt, :list => enum}.merge(locals), &block)\n end\n did_any ? result.join(\"\") : nil\n end",
"title": ""
},
{
"docid": "b0cd555e01401052d5fc3312d20ebcf8",
"score": "0.5573963",
"text": "def draw_column_enum(rec, col_or_sym, enum)\n Edgarj::EnumCache.instance.label(rec, get_column_name(col_or_sym), enum)\n end",
"title": ""
},
{
"docid": "f115176632ef31dffd8acfc524347561",
"score": "0.5498718",
"text": "def header_render\n html.tag(TAGS.fetch(header_level), header_value, id: header_id,\n class: @pairs.fetch(\"class\", \"\")).to_s\n end",
"title": ""
},
{
"docid": "840d015edc820d5b04a0530b0b9e16cc",
"score": "0.54952216",
"text": "def to_enum_radio_tag(options = {})\n add_default_name_and_id(options)\n val = ''\n if !object.nil? then\n val = value(object)\n end\n val = options.delete(:value) || val\n \n if options[:values] then\n values = options.delete(:values)\n default_values_text = options.delete(:default_text) || values\n else\n values = enum_values\n values_text = options.delete(:text)\n default_values_text = enum_text_values\n end\n \n if !val.blank? then\n val = (val.class == String) ? val.to_sym : val.to_i\n end\n \n tag_text = ''\n values = values.map {|k, v|\n default_text = default_values_text.slice!(0)\n text = (values_text.slice(0)) ? values_text.slice!(0) : default_text\n opts = {}\n opts['checked'] = 'checked' if v and v == val\n #opts['id'] = \"#{opts['id']}_#{enum}\"\n tag_text << '<div id=\"'+v+'_container\">'\n tag_text << \"<label>\"\n tag_text << \"#{text.to_s.humanize}: \" if options[:reverse_label] == false\n tag_text << to_radio_button_tag(v, opts)\n tag_text << \" #{text.to_s.humanize}\" if options[:reverse_label] == true\n tag_text << \"</label>\"\n tag_text << '</div>'\n }\n \n return tag_text\n end",
"title": ""
},
{
"docid": "bdb1fc5342abbce086a370e8721623a6",
"score": "0.5470228",
"text": "def visit_enum(binding_type)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "6de910008caaa087c7d1f5cfe3e6d21f",
"score": "0.5447893",
"text": "def enum(out, name, items)\n # out.puts \"\\ntype #{name.ljust(PAD)} #{type}\"\n out.puts \"\\nconst (\"\n for item in items do\n out.puts item\n end\n out.puts \")\\n\"\nend",
"title": ""
},
{
"docid": "e7d8fe287b25a77d7bb6c5a77e845ebd",
"score": "0.54432666",
"text": "def show\n # options = options_for_enum(@response, :status)\n # puts 'OPTION ', options\n end",
"title": ""
},
{
"docid": "407741241956336b5b3e33e11be49018",
"score": "0.5420817",
"text": "def activity_menu\n puts \"Choose activity type:\".green.underline\n puts <<-EOS\n <1> Hike\n <2> Run\n <3> Bike\nEOS\nend",
"title": ""
},
{
"docid": "e462d2df2c8002edbd792952c755b9ed",
"score": "0.540862",
"text": "def render_game_state\n res = \"GAME STATE as #{player.faction}\"\n Menu.new(res).display\n end",
"title": ""
},
{
"docid": "e0289d09f278478c1753a4a69951161e",
"score": "0.53981364",
"text": "def to_enum_radio_tag(options = {})\r\n # Remove when we no longer support 1.1.\r\n begin\r\n v = value(object)\r\n rescue ArgumentError\r\n v = value\r\n end\r\n add_default_name_and_id(options)\r\n values = enum_values\r\n raise ArgumentError, \"No values for enum select tag\" unless values\r\n tag_text = ''\r\n template = options.dup\r\n template.delete('checked')\r\n values.each do |enum|\r\n opts = template.dup\r\n opts['checked'] = 'checked' if v and v == enum\r\n opts['id'] = \"#{opts['id']}_#{enum}\"\r\n tag_text << \"<label>#{enum}: \"\r\n tag_text << to_radio_button_tag(enum, opts)\r\n tag_text << \"</label>\"\r\n end\r\n tag_text\r\n end",
"title": ""
},
{
"docid": "f81b7b1f1af622340628af14f6450210",
"score": "0.5396629",
"text": "def draw_armor_type\n name = Vocab::EQ_TYPE\n value = $data_system.armor_types[@item.atype_id]\n draw_detail(value, name)\n end",
"title": ""
},
{
"docid": "ed82fddd7e403262d6d09d2a82883211",
"score": "0.5377891",
"text": "def auto_generate_desc\n return __desc if _enum.blank?\n\n if @enum_info.present?\n @enum_info.each_with_index do |(info, value), index|\n __desc.concat \"<br/>#{index + 1}/ #{info}: #{value}\"\n end\n else\n _enum.each_with_index do |value, index|\n __desc.concat \"<br/>#{index + 1}/ #{value}\"\n end\n end\n __desc\n end",
"title": ""
},
{
"docid": "a9e0b8a2dc73b63d174836beb7a43284",
"score": "0.5377313",
"text": "def type\n :enum\n end",
"title": ""
},
{
"docid": "5c0be4d9fa6ee16ec7efb04e2bd984f9",
"score": "0.5377266",
"text": "def to_s; \"Enum #{@name}(#{@map.keys.join(', ')}, ver=#{self.ver})\" end",
"title": ""
},
{
"docid": "f47b919fd64981f952f0595365632767",
"score": "0.53763705",
"text": "def render\n outputs.labels << [10, 30, state.tick_count]\n render_alert\n render_room\n render_highlights\n end",
"title": ""
},
{
"docid": "5daaaf5a247e2f7db7715a6063cf78f9",
"score": "0.53285515",
"text": "def build\n @enum_module = Module.new\n\n plural\n stringify\n all_values\n\n klass.include enum_module\n klass.extend enum_module::ClassMethods\n end",
"title": ""
},
{
"docid": "0360d9b03315f4007e68630eb73fc501",
"score": "0.53274035",
"text": "def render\n renderer.render('section', self)\n end",
"title": ""
},
{
"docid": "a88626e33ee305777086e66dd86e8330",
"score": "0.52844185",
"text": "def render\n outputs.primitives << [\n { w: 1280, h: 720, r: 0, g: 0, b: 0}.solid,\n { x: 640, y: 460, text: 'You have died.', r: 255, g: 255, b: 255, size_enum: 5, alignment_enum: align(:center) }.label,\n { x: 640, y: 400, text: state.death_message, r: 255, g: 255, b: 255, size_enum: 5, alignment_enum: align(:center) }.label,\n { x: 640, y: 340, text: \"You made $#{state.money}, and survived #{state.time_of_death.fdiv(3600).to_sf} minutes.\", r: 255, g: 255, b: 255, size_enum: 5, alignment_enum: align(:center) }.label\n ]\n end",
"title": ""
},
{
"docid": "5c5a68391567679aa74895e35a30034a",
"score": "0.52840865",
"text": "def render\n Asciidoctor.debug \"Now rendering section for #{self}\"\n renderer.render('section', self)\n end",
"title": ""
},
{
"docid": "1bcd5c1460dd1a9e31757482e8e25257",
"score": "0.52805674",
"text": "def draw_equip\n change_color(system_color)\n draw_text(0, 0, 120, line_height, Vocab::etype(@etype_id))\n end",
"title": ""
},
{
"docid": "7bbbdb94b657ac588c64a05d25bce18a",
"score": "0.52172",
"text": "def render_menu\n output = []\n\n sync_paginators if @paging_changed\n paginator.paginate(choices, @active, @per_page) do |choice, index|\n num = enumerate? ? (index + 1).to_s + @enum + \" \" : \"\"\n message = if index + 1 == @active && !choice.disabled?\n selected = \"#{@symbols[:marker]} #{num}#{choice.name}\"\n @prompt.decorate(selected.to_s, @active_color)\n elsif choice.disabled?\n @prompt.decorate(@symbols[:cross], :red) +\n \" #{num}#{choice.name} #{choice.disabled}\"\n else\n \" #{num}#{choice.name}\"\n end\n end_index = paginated? ? paginator.end_index : choices.size - 1\n newline = (index == end_index) ? \"\" : \"\\n\"\n output << (message + newline)\n end\n\n output.join\n end",
"title": ""
},
{
"docid": "baa8c83d2b596a063a43a172565c81b4",
"score": "0.5205235",
"text": "def draw_enum(f, col_or_sym, enum=nil, options={})\n col_name = get_column_name(col_or_sym)\n enum = model.const_get(col_name.to_s.camelize) if !enum\n sorted_elements = enum.constants.sort{|a,b|\n enum.const_get(a) <=> enum.const_get(b)}\n options_for_select = options.dup\n choice_1st = options_for_select.delete(:choice_1st)\n class_4_human_const = options_for_select.delete(:class) || f.object.class\n f.select(col_name,\n (choice_1st ? [choice_1st] : []) +\n sorted_elements.map{|member|\n [class_4_human_const.human_const_name(enum, member),\n enum.const_get(member)]},\n options_for_select)\n end",
"title": ""
},
{
"docid": "b00b1d1aea56b4af9cea074570649641",
"score": "0.5193648",
"text": "def to_human\n @enum.key(to_i) || \"<unknown:#{@value}>\"\n end",
"title": ""
},
{
"docid": "bbc5f935cffddb6918c0fbcadfe37700",
"score": "0.51920587",
"text": "def enumeration\n [@enum, @chron, @year].compact.join(' - ')\n end",
"title": ""
},
{
"docid": "2deb3cf44b7307f36de430951ed50cfa",
"score": "0.51644385",
"text": "def render\n return \"\" if items.empty?\n\n case mode\n when :inline\n list_inline_mode\n when :columns_across\n list_columns_across_mode\n when :columns_down\n list_columns_down_mode\n when :uneven_columns_across\n list_uneven_columns_mode\n when :uneven_columns_down\n list_uneven_columns_down_mode\n else\n list_default_mode\n end\n end",
"title": ""
},
{
"docid": "3022320e8e8e3a2fc52a913b063a3d17",
"score": "0.51511997",
"text": "def enum(value)\n @enum = value\n end",
"title": ""
},
{
"docid": "3022320e8e8e3a2fc52a913b063a3d17",
"score": "0.51511997",
"text": "def enum(value)\n @enum = value\n end",
"title": ""
},
{
"docid": "a3240c1cefa3dd7f03b70589fa12734c",
"score": "0.5141206",
"text": "def get_enum \n return @payload.get_path(\"enum\"){[]}\n end",
"title": ""
},
{
"docid": "3bf0423e6f7355649db7a4e11d9304b8",
"score": "0.509477",
"text": "def stringify\n attr = attribute\n\n # TODO: Rewrite these as string\n enum_module.module_eval do\n # def status_text() status.text('status', self) end\n define_method(\"#{attr}_text\") { send(attr)&.text(attr, self) }\n end\n end",
"title": ""
},
{
"docid": "c40153698814db1706457e433c8073e7",
"score": "0.5091627",
"text": "def to_enum_radio_tag(options = {})\n # Remove when we no longer support 1.1.\n begin\n v = value(object)\n rescue ArgumentError\n v = value\n end\n add_default_name_and_id(options)\n # 得到二维数组enum options\n enum_options = enum_options_from(options) || enum_options_from_model\n raise ArgumentError, \"Can't find enum options\" unless enum_options\n # 根据options指定的exclude过滤\n enum_options.reject!{|_t,value| options[:exclude].member?(value) } if options[:exclude]\n # 根据options指定的only过滤\n enum_options.reject!{|_t,value| !options[:only].member?(value) } if options[:only]\n tag_text = []\n template = options.dup\n template.delete('checked')\n \n enum_options.each do |text, enum|\n opts = template.dup\n opts['checked'] = 'checked' if v and v.to_s == enum.to_s\n opts['id'] = \"#{opts['id']}_#{enum}\"\n output = \"<label class='enum' for=#{opts['id']}>#{text}: </label>\"\n output << to_radio_button_tag(enum, opts)\n tag_text << output\n end\n tag_text.join(\"<span style='display:inline;padding:0 10px'> </span>\")\n end",
"title": ""
},
{
"docid": "6f2bdf88da66c4e515a530f51c13c388",
"score": "0.5091062",
"text": "def enum_types; end",
"title": ""
},
{
"docid": "66223e884a953a16b1f8afeb4af81c01",
"score": "0.50794446",
"text": "def draw()\n @ucIcon.draw()\n @cLabel.draw()\n @cValue.draw()\n end",
"title": ""
},
{
"docid": "66223e884a953a16b1f8afeb4af81c01",
"score": "0.50794446",
"text": "def draw()\n @ucIcon.draw()\n @cLabel.draw()\n @cValue.draw()\n end",
"title": ""
},
{
"docid": "fa47a0600b6b1c19cec8d0a6c86349f1",
"score": "0.50655633",
"text": "def t_enum(enum_attr, enum_value = nil)\n enum_value ||= public_send(enum_attr)\n I18n.t(\n \"activerecord.attributes.#{model_name.i18n_key}.#{enum_attr.to_s.pluralize}.#{enum_value}\"\n )\n end",
"title": ""
},
{
"docid": "c00c5f24fa35d97e94412f278028e5e2",
"score": "0.50610214",
"text": "def enums\n\t\t\t\t\t\treturn @enums\n\t\t\t\t\tend",
"title": ""
},
{
"docid": "5094e72c23e7bce51a7b240f43ea053c",
"score": "0.5056949",
"text": "def update!(**args)\n @new_enum_value_display_name = args[:new_enum_value_display_name] if args.key?(:new_enum_value_display_name)\n end",
"title": ""
},
{
"docid": "5094e72c23e7bce51a7b240f43ea053c",
"score": "0.5056949",
"text": "def update!(**args)\n @new_enum_value_display_name = args[:new_enum_value_display_name] if args.key?(:new_enum_value_display_name)\n end",
"title": ""
},
{
"docid": "8834b8edbc59a6bf041846af0395560d",
"score": "0.5031937",
"text": "def render(type)\n type = type.to_s\n border_char = self[type]\n line = render_line(border_char,\n self[\"#{type}_left\"] || border_char,\n self[\"#{type}_right\"] || border_char,\n self[\"#{type}_mid\"])\n\n return line unless color?\n\n set_color(@dsl.style, line)\n end",
"title": ""
},
{
"docid": "cc2f52954a4b955230a33bbf56c32b23",
"score": "0.5031539",
"text": "def display\n return \"#{@type} (#{@value})\"\n end",
"title": ""
},
{
"docid": "99bf62a1327f700455eff6193a7fac28",
"score": "0.50306225",
"text": "def i18n_scope\n [ :enums, name ]\n end",
"title": ""
},
{
"docid": "3cc46c497b3b8f8590ea0db465c70d91",
"score": "0.50201845",
"text": "def visit(widget, level = 0)\n indent = ' ' * level\n\n puts \"#{indent}#{widget.name}\"\n\n if widget.type == :window || widget.type == :section\n widget.children.each { |child| visit(child, level + 1) }\n return\n end\n\n indent << ' '\n\n puts \"#{indent}label: #{widget.label}\"\n puts \"#{indent}type: #{widget.type}\"\n puts \"#{indent}value: #{widget.value}\"\n\n case widget.type\n when :range\n range = widget.range\n step = (range.size > 1) ? range[1] - range[0] : 1.0\n puts \"#{indent}options: #{range.first}..#{range.last}:step(#{step})\"\n when :radio, :menu\n puts \"#{indent}options: #{widget.choices.inspect}\"\n end\nend",
"title": ""
},
{
"docid": "725ca45aa516389e2df1ae774419cd6b",
"score": "0.50177443",
"text": "def to_enum_select_tag(options = {})\n add_default_name_and_id(options)\n val = ''\n if !object.nil? then\n val = value(object)\n end\n val = options.delete(:value) || val\n \n if !val.blank? then\n val = (val.class == String) ? val.to_sym : val.to_i\n end\n \n if options[:values] then\n values = options.delete(:values)\n default_values_text = options.delete(:default_text) || values\n else\n values = enum_values\n dependencies = enum_dependencies(val)\n values_text = options.delete(:text)\n default_values_text = enum_text_values\n\n new_values = []\n values.each do |k, v|\n if (dependencies.nil? || dependencies.include?(k) || k == val) then\n default_text = default_values_text.slice!(0)\n text = (values_text.slice(0)) ? values_text.slice!(0) : default_text\n if v.class == String then\n # text enum\n new_values.push([text.to_s.humanize, k])\n elsif v.class == Fixnum then\n # int enum\n new_values.push([text.to_s.humanize, v])\n end\n else\n default_values_text.slice!(0)\n values_text.slice!(0)\n end\n end\n values = new_values\n=begin \n values = values.map {|k, v|\n if (dependencies.nil? || dependencies.include?(k)) then\n default_text = default_values_text.slice!(0)\n text = (values_text.slice(0)) ? values_text.slice!(0) : default_text\n if v.class == String then\n # text enum\n k = [text.to_s.humanize, k]\n elsif v.class == Fixnum then\n # int enum\n k = [text.to_s.humanize, v]\n end\n else\n values.delete(k)\n end\n }\n end\n=end \n end\n \n select_tag(nil, options_for_select(values, val), options)\n end",
"title": ""
},
{
"docid": "cc0406121f181964e07ffd780f11e2eb",
"score": "0.5016021",
"text": "def emit_enum!( enum )\n module_name = ruby_model_fqn( enum )\n\n puts \"Dumping enum #{enum}\".green\n\n path = module_name[ models_namespace.size .. -1 ].split(\"::\").select(&:present?).compact.map { |part| part.underscore }.join(\"/\")\n path = \"models/\" + path + \".rb\"\n\n ensure_all_modules_are_present!( module_name )\n\n write_file( path ) do |file|\n file << \"module #{module_name}\\n\"\n\n enum.constants.each do |const_name| \n file << \" #{const_name} = #{enum.const_get(const_name).inspect}\\n\"\n end\n\n file << \"end\\n\"\n end\n end",
"title": ""
},
{
"docid": "6ae27101df9007c0df4aa141b3c25201",
"score": "0.49847707",
"text": "def render\n markup = ''\n\n return markup if !values.present? && !options[:include_empty]\n markup << %(<tr><th>#{label}</th>\\n<td><ul class='tabular'>)\n attributes = microdata_object_attributes(field).merge(class: \"attribute #{field}\")\n Array(values).each do |value|\n markup << \"<li#{html_attributes(attributes)}>#{attribute_value_to_html(value.to_s)}</li>\"\n end\n markup << %(</ul></td></tr>)\n markup.html_safe\n end",
"title": ""
},
{
"docid": "a3e82f759d6ceb0a02e55098aafc9819",
"score": "0.49803638",
"text": "def render_definition\n render_rb(:definition)\n end",
"title": ""
},
{
"docid": "b0c0602dde9f6cdd89d310236af0a82a",
"score": "0.49488994",
"text": "def render_header\n if @done\n selected_item = choices[@active - 1].name\n @prompt.decorate(selected_item.to_s, @active_color)\n elsif (@first_render && (help_start? || help_always?)) ||\n (help_always? && [email protected]?)\n @prompt.decorate(help, @help_color)\n elsif filterable? && @filter.any?\n @prompt.decorate(filter_help, @help_color)\n end\n end",
"title": ""
},
{
"docid": "74e72c4b0198b09468cbd545c1cb04f4",
"score": "0.4948682",
"text": "def render\n return '' if values.blank? && !options[:include_empty]\n\n markup = %(<tr><th>#{label}</th>\\n<td><ul class='tabular'>)\n\n attributes = microdata_object_attributes(field).merge(class: \"attribute attribute-#{field}\")\n\n values_array = Array(values)\n values_array = values_array.sort if options[:sort]\n\n markup += values_array.map do |value|\n \"<li#{html_attributes(attributes)}>#{attribute_value_to_html(value.to_s)}</li>\"\n end.join\n\n markup += %(</ul></td></tr>)\n\n markup.html_safe\n end",
"title": ""
},
{
"docid": "0b8c0ef86ed61cd4a06930baada49334",
"score": "0.4947617",
"text": "def render\n markup = ''\n\n return markup if values.blank? && !options[:include_empty]\n markup << %(<tr><th>#{label}</th>\\n<td><ul class='tabular'>)\n attributes = microdata_object_attributes(field) \\\n .merge(class: \"attribute #{field}\")\n Array(values).each do |value|\n markup << \"<li#{html_attributes(attributes)}>\" \\\n \"#{attribute_value_to_html(value.to_s)}</li>\"\n end\n markup << %(</ul>)\n markup << simple_format(RightsStatementService.definition(values.first))\n @rights_note.each do |note|\n markup << %(<p>#{note}</p>) if note.present?\n end\n markup << simple_format(I18n.t('rights.boilerplate'))\n markup << %(</td></tr>)\n markup.html_safe\n end",
"title": ""
},
{
"docid": "7f44ea8e738b29c7b663b0690d40ef58",
"score": "0.49438354",
"text": "def to_enum_select_tag(options = {})\r\n # Remove when we no longer support 1.1.\r\n begin\r\n v = value(object)\r\n rescue ArgumentError\r\n v = value\r\n end\r\n add_default_name_and_id(options)\r\n tag_text = \"<select\"\r\n tag_text << tag_options(options)\r\n tag_text << \">\"\r\n values = enum_values\r\n raise ArgumentError, \"No values for enum select tag\" unless values\r\n if options[:include_blank]\r\n tag_text << \"<option value=\\\"\\\"></option>\\n\"\r\n end\r\n values.each do |enum|\r\n tag_text << \"<option value=\\\"#{enum}\\\"\"\r\n tag_text << ' selected=\"selected\"' if v and v == enum\r\n tag_text << \">#{enum}</option>\"\r\n end\r\n tag_text << \"</select>\"\r\n end",
"title": ""
},
{
"docid": "64ef899deb0c5830e35c6cd15f35c782",
"score": "0.4940204",
"text": "def size\n @enums.size\n end",
"title": ""
},
{
"docid": "e7d70507d52a5030e4309209ca041bb6",
"score": "0.49361947",
"text": "def display_choices\n puts <<-END\n What do you want to do?\n Options: #{yield}\n END\n end",
"title": ""
},
{
"docid": "6e84adb3711bdbf84923e64ee61b24e0",
"score": "0.49354213",
"text": "def enum hash\n key = hash.keys.first\n (self.enums ||= {}).merge! hash\n define_attribute_methods if !attribute_methods_generated?\n class_eval %{\n def #{key}\n missing_attribute('#{key}', caller) unless @attributes.has_key?('#{key}')\n self.class.enums[:#{key}][@attributes['#{key}']]\n end\n def #{key}=(val)\n write_attribute('#{key}', Fixnum === val ? val : self.class.enums[:#{key}].index val.to_s\n end\n }\n end",
"title": ""
},
{
"docid": "c8342eba5482f04f502718533eca66af",
"score": "0.49194977",
"text": "def enum_value()\n\t\treturn self.client.sys.registry.enum_value(self.hkey)\n\tend",
"title": ""
},
{
"docid": "943c6f37674ecf30cb539b77ef865581",
"score": "0.4917341",
"text": "def parse_enum(_node)\n enum_name = _node.attribute( \"name\" ).to_s\n enum_value = _node.attribute( \"value\" ).to_s\n\n # Make sure the first letter is always uppercase, for RubyMotion\n contents = \"%s%s\" % [enum_name[0, 1].upcase, enum_name[1..-1]]\n trigger = \"%s (%s)\" % [enum_name, enum_value]\n\n return [create_completion(trigger, contents)]\n end",
"title": ""
},
{
"docid": "85a2149234aa3175c290bcb188003435",
"score": "0.49157324",
"text": "def enum; end",
"title": ""
},
{
"docid": "85a2149234aa3175c290bcb188003435",
"score": "0.49157324",
"text": "def enum; end",
"title": ""
},
{
"docid": "85a2149234aa3175c290bcb188003435",
"score": "0.49157324",
"text": "def enum; end",
"title": ""
},
{
"docid": "7c6de710352e5e9ee1a89e7b2f1db734",
"score": "0.49082726",
"text": "def enum_status\n statuses[@enum_status]\n end",
"title": ""
},
{
"docid": "2df8225172803f427893ddf0d407bd72",
"score": "0.49063405",
"text": "def initialize(typ,size,&access)\n # Sets the size.\n @size = size\n # Sets the type.\n @type = typ\n # Sets the accesser.\n @access = access\n # Compute the index width (default: safe 32 bits).\n width = @size.respond_to?(:width) ? @size.width : \n @size.respond_to?(:type) ? size.type.width : 32\n # puts \"width=#{width}\"\n # Create the index and the iteration result.\n idx = nil\n result = nil\n HDLRuby::High.cur_system.open do\n idx = [width].inner({\n HDLRuby.uniq_name(\"enum_idx\") => 0 })\n result = typ.inner(HDLRuby.uniq_name(\"enum_res\"))\n end\n @index = idx\n @result = result\n end",
"title": ""
},
{
"docid": "39813e0c4aea473d36b39ec35404dac8",
"score": "0.4903483",
"text": "def render_header\n return if @render_header\n @render_header = 1\n puts Cabar.yaml_header\n end",
"title": ""
},
{
"docid": "c9e7154e24f2c71f05cc80cd88abc072",
"score": "0.49007598",
"text": "def draw_level\n case QuestData::LEVEL_ICON\n when Array then QuestData::LEVEL_ICON.empty? ? draw_level_text : draw_level_array\n when 0 then draw_level_text\n else\n draw_level_stacked\n end\n end",
"title": ""
},
{
"docid": "f8ed40419be4447d632c999034a02960",
"score": "0.48990235",
"text": "def draw()\n @ucActStates.draw()\n @cCharImage.draw()\n @cCharName.draw()\n @ucCharLvl.draw()\n @cHpStatGauge.draw()\n @ucHpStat.draw()\n @cMpStatGauge.draw()\n @ucMpStat.draw()\n @cExpGauge.draw()\n @ucExp.draw()\n end",
"title": ""
},
{
"docid": "2a00a750f132ff8c1056cd9687fe7d6d",
"score": "0.48977983",
"text": "def draw()\n @cLabel.draw()\n @cValue.draw()\n end",
"title": ""
},
{
"docid": "e1b6f0832f47b970d86ee6bbe0069165",
"score": "0.48920882",
"text": "def enum_values\n return if $enums.empty?\n\n filename = File.join \"#{$app_root}/app/models\", \"#{$name}.rb\"\n File.open(filename, \"r\") {|file| @lines = file.readlines; }\n\n $enums.each_with_index do |enum, index|\n @lines.each do |line|\n# if line.include?('enum') && line.include? \"#{enum}:\"\n if line.match('enum' && \"#{enum}:\")\n $enums_qty[index] = line.count(',') + 1 # Number of commas + 1\n end\n end\n end\n\n # If no enum statements found in the Model file (NOT NEEEDE now)\n if $enums_qty.empty?\n (0...$enums.count).each do |i|\n $enums_qty[i] = ENUM_DDL_THRESHOLD # All enum attributes to be listed as DDLs\n end\n end\n end",
"title": ""
},
{
"docid": "40af17f6b8ae0ad0fb6212aaf53adc14",
"score": "0.48886633",
"text": "def draw_type_detail\n name = Vocab::EQ_TYPE\n type = Vocab::etype(@item.etype_id)\n draw_detail(type, name)\n end",
"title": ""
},
{
"docid": "d2f79aebfa358ea7ba230dbc517cfc2d",
"score": "0.4887166",
"text": "def render\n return '' if values.blank? && !options[:include_empty]\n puralized_label =\n markup = %(<tr><th>#{label}</th>\\n<td><ul class='tabular'>\\n)\n attributes = microdata_object_attributes(field).merge(class: \"attribute attribute-#{field}\")\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"field=#{field}\",\n \"values=#{values}\",\n \"options=#{options}\",\n \"attributes=#{attributes}\",\n \"\" ] if creator_orcid_attribute_renderer_debug_verbose\n attributes.delete(:itemscope) # remove :itemscope\n attributes.delete(:itemtype) # remove :itemtype\n if values.count <= 5\n markup += Array(values).map do |value|\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"value=#{value}\",\n \"\" ] if creator_orcid_attribute_renderer_debug_verbose\n %(<li#{html_attributes(attributes)}>#{attribute_value_to_html(value.to_s)}</span></li>)\n end.join(\"\\n\")\n else\n markup += %(<li#{html_attributes(attributes)}>#{creator_orcids_compact}</li>)\n end\n markup += %(\\n</ul></td></tr>)\n markup.html_safe\n end",
"title": ""
},
{
"docid": "8b0e54c5e4851e9bec13aa9c5326365e",
"score": "0.4883444",
"text": "def draw_item_subtype\n change_color(system_color)\n draw_text(NAME_X, 0, contents.width - NAME_X, line_height, @subtype, Bitmap::ALIGN_RIGHT)\n change_color(normal_color)\n end",
"title": ""
},
{
"docid": "834d24da67863ded8ca68262f7e3f8df",
"score": "0.48822647",
"text": "def render_state_label(service)\n\t\trender :partial=>\"common/state\",:locals=>{:service=>service}\n\tend",
"title": ""
},
{
"docid": "df0ee802b4e702c72b9502f98cb051b1",
"score": "0.48820195",
"text": "def enums(stream)\n return unless @connection.respond_to?(:enums)\n\n statements = @connection.enums.map do |name, values|\n \" create_enum #{name.inspect}, #{values.inspect}\"\n end\n\n return if statements.empty?\n\n stream.puts statements.join(\"\\n\")\n stream.puts\n end",
"title": ""
},
{
"docid": "8fbbfe6d3a0296909bd242ecd3b73311",
"score": "0.4872101",
"text": "def render\n @choices.component_map do |c|\n id = \"#{@name}-#{c}\" \n input({type: \"radio\", id: id, name: @name, value: c}) +\n (@labelled ? (_label({for: id}) {@block ? @block.call(c) : c}) : nil)\n end\n end",
"title": ""
},
{
"docid": "31c2a82034acf9ab590a868f20443b24",
"score": "0.48716488",
"text": "def render_label(_view, _depth)\n ''\n end",
"title": ""
},
{
"docid": "c52e0fd3edf9026cbb82b16d7d9cde9d",
"score": "0.48628834",
"text": "def render\n output = \"<span \"\n output << \"#{render_active}>\"\n link = \"#{@name}\"\n output << @view.link_to(link, :controller => @path)\n output << \"</span>\"\n output\n end",
"title": ""
},
{
"docid": "83ab6018e1aafa9d192b222dc64dd9d0",
"score": "0.48497254",
"text": "def print_indented enum\n if enum\n enum.sort.each {|x|\n puts \" #{x}\"\n } if enum\n end\nend",
"title": ""
},
{
"docid": "8d979028c0e81fe388830cc240af1624",
"score": "0.48406065",
"text": "def render_menu(menu,invalid_input)\r\n system \"clear\"\r\n if invalid_input\r\n print \"Invalid Input: #{invalid_input}\\n\"\r\n print \"\\n\"\r\n end\r\n print \"Welcome to the #{menu[:name]} menu.\\n\"\r\n print \"\\n\"\r\n print \"Description: #{menu[:description]}\\n\"\r\n print \"\\n\"\r\n menu[:options].each_with_index do |option,i|\r\n print \"#{i}: #{option[:label]}\\n\"\r\n end\r\n print \"\\n\"\r\n print \"enter a number to make a selection\\n\"\r\n end",
"title": ""
},
{
"docid": "442028521a0f4af999fe7790d8f744cd",
"score": "0.48276615",
"text": "def render\n super\n outputs.primitives << { x: 500, y: 66, text: 'Take a Break', size_enum: 10, r: 250, g: 250, b: 250 }.label\n end",
"title": ""
},
{
"docid": "9637e73ca3a0f707d911702e3cb54b8e",
"score": "0.48249078",
"text": "def render_status\n (Resultline::STATUS.find_all{|disp, value| value == status}).map {|disp, value| disp}\n end",
"title": ""
},
{
"docid": "b1e5666aac871c8abdc06f4c22169678",
"score": "0.48191145",
"text": "def render_status_icon(section_title, valid)\n # Default classes\n classes = %w(eui-icon icon-green)\n\n # Add the class that will define the final appearance of the circle\n classes << if valid\n # Valid, displays a checkmark\n 'eui-check'\n else\n # Invalid/Empty, displays an empty circle\n 'eui-fa-circle-o'\n end\n\n # Generate the actual content tag to return to the view\n content_tag(:i, class: classes.join(' ')) do\n content_tag(:span, class: 'is-invisible') do\n if valid\n \"#{section_title} is valid\"\n else\n \"#{section_title} is incomplete\"\n end\n end\n end\n end",
"title": ""
},
{
"docid": "0c3993e896697c1d0487929373cffea5",
"score": "0.48153874",
"text": "def render\n # begin monkey\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"field=#{field}\",\n \"values=#{values}\",\n \"options=#{options}\",\n \"\" ] if attribute_renderer_debug_verbose\n # end monkey\n return '' if values.blank? && !options[:include_empty]\n markup = []\n markup << %(<span itemprop=\"#{options[:itemprop]}\">) if options[:itemprop].present?\n markup << %(<tr><th>#{label}</th>\\n<td><ul class='tabular'>)\n attributes = microdata_object_attributes(field).merge(class: \"attribute attribute-#{field}\")\n Array(values).each do |value|\n # begin monkey\n value_str = ::Deepblue::MetadataHelper.str_normalize_encoding value.to_s\n markup << \"<li#{html_attributes(attributes)}>#{attribute_value_to_html(value_str)}</li>\"\n # end monkey\n end\n markup << %(</ul></td></tr>)\n markup << %(</span>) if options[:itemprop].present?\n markup.join(\"\\n\").html_safe\n end",
"title": ""
},
{
"docid": "cc153f417dfda784bfc41a8336d4f1d9",
"score": "0.48029068",
"text": "def each(&block)\n if block_given?\n @sections.each(&block)\n else\n @sections.to_enum\n end\n end",
"title": ""
},
{
"docid": "1ea30f4f48e505b88c8af349a2904087",
"score": "0.47971126",
"text": "def render\n parse!\n format(format_string, to_h)\n end",
"title": ""
},
{
"docid": "a2d47a58126e4123180ae679c7a63e12",
"score": "0.479262",
"text": "def render_value\n value\n end",
"title": ""
},
{
"docid": "c188358f8816aba21e08d14b9834bd0a",
"score": "0.4792213",
"text": "def draw()\n @ucActStates.draw()\n @cHpStatGauge.draw()\n @ucHpStat.draw()\n @cMpStatGauge.draw()\n @ucMpStat.draw()\n @ucAtkStat.draw()\n @ucDefStat.draw()\n @ucSpiStat.draw()\n @ucAgiStat.draw()\n @ucEvaStat.draw()\n @ucHitStat.draw()\n @ucCriStat.draw()\n end",
"title": ""
},
{
"docid": "c188358f8816aba21e08d14b9834bd0a",
"score": "0.4792213",
"text": "def draw()\n @ucActStates.draw()\n @cHpStatGauge.draw()\n @ucHpStat.draw()\n @cMpStatGauge.draw()\n @ucMpStat.draw()\n @ucAtkStat.draw()\n @ucDefStat.draw()\n @ucSpiStat.draw()\n @ucAgiStat.draw()\n @ucEvaStat.draw()\n @ucHitStat.draw()\n @ucCriStat.draw()\n end",
"title": ""
},
{
"docid": "4247db292ac4f9a9b9413e5691f16867",
"score": "0.4791857",
"text": "def inspect\n RuneRb::GLOBAL[:COLOR].blue(\"[ITEM:] #{RuneRb::GLOBAL[:COLOR].cyan.bold(@definition[:name])} || [COUNT:] #{RuneRb::GLOBAL[:COLOR].cyan.bold(@size)} || [DESC:] #{RuneRb::GLOBAL[:COLOR].green(@definition[:desc])}\")\n end",
"title": ""
},
{
"docid": "62a0e9b8cc639670464d7aefc0c4731d",
"score": "0.47895804",
"text": "def draw()\n @cEquipKind.draw()\n @ucIcon.draw()\n @cEquipName.draw()\n end",
"title": ""
},
{
"docid": "07184689664cb931d2f7bfddeb8557b7",
"score": "0.47850338",
"text": "def display ( )\n puts 'Parser states: ' + @states.size.to_s\n\n @states.each do |st|\n\tputs\n\tputs '** state: ' + st.statename\n\tputs 'branches: '\n\tst.branches.each do |br|\n\t puts ' ' + @states[br].statename\n\tend\n end\n end",
"title": ""
},
{
"docid": "6a9113f2a3b2e02dc3373b628e70837d",
"score": "0.47817475",
"text": "def raw\n orig_command = \"enum #{ph_nbr}\"\n end",
"title": ""
},
{
"docid": "b3997761268724236ac41017b28b7d7c",
"score": "0.47744757",
"text": "def enumeration()\n #This is a stub, used for indexing\n end",
"title": ""
},
{
"docid": "a86fba63e4b9f0c62f5f3e9d7ba43487",
"score": "0.47703725",
"text": "def render_answer\n @choices[@active - 1].value\n end",
"title": ""
},
{
"docid": "0555219de98f75d72e47d12115759da3",
"score": "0.47616702",
"text": "def render\n return \"[#{colour},K]\" if self.class == King\n return \"[#{colour},Q]\" if self.class == Queen\n return \"[#{colour},p]\" if self.class == Pawn\n return \"[#{colour},b]\" if self.class == Bishop\n return \"[#{colour},k]\" if self.class == Knight\n return \"[#{colour},r]\" if self.class == Rook\n end",
"title": ""
}
] |
0ebf584bd001cf1b3a94a5d9fea36795
|
Parse event date with utc offset
|
[
{
"docid": "3f45299d7f286c9fa27f0e69521bb984",
"score": "0.7133712",
"text": "def event_date(event)\n Time.at((event['time'] + event['utc_offset'] ) / 1000).utc.to_datetime\nend",
"title": ""
}
] |
[
{
"docid": "91e898480f177b605e018032a249d37c",
"score": "0.64908534",
"text": "def utc_offset; end",
"title": ""
},
{
"docid": "91e898480f177b605e018032a249d37c",
"score": "0.64908534",
"text": "def utc_offset; end",
"title": ""
},
{
"docid": "91e898480f177b605e018032a249d37c",
"score": "0.64908534",
"text": "def utc_offset; end",
"title": ""
},
{
"docid": "91e898480f177b605e018032a249d37c",
"score": "0.64908534",
"text": "def utc_offset; end",
"title": ""
},
{
"docid": "91e898480f177b605e018032a249d37c",
"score": "0.64908534",
"text": "def utc_offset; end",
"title": ""
},
{
"docid": "91e898480f177b605e018032a249d37c",
"score": "0.64908534",
"text": "def utc_offset; end",
"title": ""
},
{
"docid": "91e898480f177b605e018032a249d37c",
"score": "0.64908534",
"text": "def utc_offset; end",
"title": ""
},
{
"docid": "91e898480f177b605e018032a249d37c",
"score": "0.64908534",
"text": "def utc_offset; end",
"title": ""
},
{
"docid": "91e898480f177b605e018032a249d37c",
"score": "0.64908534",
"text": "def utc_offset; end",
"title": ""
},
{
"docid": "91e898480f177b605e018032a249d37c",
"score": "0.64908534",
"text": "def utc_offset; end",
"title": ""
},
{
"docid": "e502207c5a766051793a0f224cf8b14f",
"score": "0.63133746",
"text": "def utc_parse value\n Time.strtotime(value).utc\n end",
"title": ""
},
{
"docid": "03ef342210a99441d710cc82d41c075a",
"score": "0.6297772",
"text": "def utc_offset\n (offset * 86400).to_i\n end",
"title": ""
},
{
"docid": "03ef342210a99441d710cc82d41c075a",
"score": "0.6297772",
"text": "def utc_offset\n (offset * 86400).to_i\n end",
"title": ""
},
{
"docid": "8c3ec13bc4a64b34bfe71f8693f09b03",
"score": "0.62459666",
"text": "def parse_date(date); end",
"title": ""
},
{
"docid": "1e053c06c5a5e4ccf735a1b35132c908",
"score": "0.6238804",
"text": "def utc_offset\n end",
"title": ""
},
{
"docid": "e5124c320784831feecd362e8cc52396",
"score": "0.6194105",
"text": "def formatted_premis_event_date_time(unformatted_date)\n DateTime.parse(unformatted_date.to_s).utc.strftime(\"%Y-%m-%dT%H:%M:%SZ\")\n rescue ArgumentError => e\n nil\n end",
"title": ""
},
{
"docid": "4fb310cc05a33244bcc9186749857553",
"score": "0.61753666",
"text": "def convert_from_utc(timestamp)\n # we know Capistrano release timestamps are UTC, but Ruby doesn't, so make it explicit\n utc_time = timestamp << \"UTC\"\n datetime = DateTime.parse(utc_time)\n datetime.new_offset(local_datetime_zone_offset)\n end",
"title": ""
},
{
"docid": "4fb310cc05a33244bcc9186749857553",
"score": "0.61753666",
"text": "def convert_from_utc(timestamp)\n # we know Capistrano release timestamps are UTC, but Ruby doesn't, so make it explicit\n utc_time = timestamp << \"UTC\"\n datetime = DateTime.parse(utc_time)\n datetime.new_offset(local_datetime_zone_offset)\n end",
"title": ""
},
{
"docid": "918840eb4ff6575eda870caa964a3860",
"score": "0.6152904",
"text": "def parse_timestamp(entry)\n Time.parse(entry[\"date\"]).getutc unless entry[\"date\"].blank?\n end",
"title": ""
},
{
"docid": "20f65216b6d518ebb09c3b1ecea5dd37",
"score": "0.6110264",
"text": "def parse_offset(offset)\n offset = Time.parse(offset)\n offset.hour*60*60 + offset.min*60 + offset.sec\n end",
"title": ""
},
{
"docid": "89e74a14c799cf8fed90129a0b9fed2a",
"score": "0.6066291",
"text": "def get_datetime_with_offset(opts)\n begin\n parsed = BawWorkers::Validation.normalise_datetime(opts[:datetime_with_offset])\n rescue StandardError => e\n @logger.error(@class_name) { e.message }\n raise e\n end\n\n parsed\n end",
"title": ""
},
{
"docid": "fad147e929b0640dab62578a06ba2d62",
"score": "0.59698945",
"text": "def fix_dates(event)\n if event['request_time']\n event['request_time'] = event['request_time'].iso8601\n end\n if event['click_time']\n event['click_time'] = event['click_time'].iso8601\n end\n end",
"title": ""
},
{
"docid": "c73129d27a3cb6fe53824331e30dadea",
"score": "0.5949699",
"text": "def to_utc(contents)\n date_time_pattern = /\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/\n contents.gsub(date_time_pattern) do |match|\n DateTime.parse(match).new_offset(0).to_s\n end\nend",
"title": ""
},
{
"docid": "da88d978e76e3d846d964df577a8da4f",
"score": "0.5938328",
"text": "def parse_utc_time(time_string)\n time = Time.parse(time_string)\n utc_offset = Time.zone_offset(time.to_s.split(' ')[-1])\n\n time.utc + utc_offset\n end",
"title": ""
},
{
"docid": "f525b53e8ca730291f5076d745afbb2a",
"score": "0.59203863",
"text": "def utc(day, input)\n @time_zone.parse(date_for(day) + \" \" + input)\n end",
"title": ""
},
{
"docid": "f85399adad856c7aef804d8884703b54",
"score": "0.59150577",
"text": "def parse_utc_date(str)\n date_without_comparator = str.match(/(?![<=>]{1,2}\\s+)[^\\s].*/).to_s\n (Chronic.parse(date_without_comparator).try(:utc) || Time.now.utc).to_date\n end",
"title": ""
},
{
"docid": "445847832fcf916f697e847f0922be09",
"score": "0.58629566",
"text": "def parse_datetime(string); end",
"title": ""
},
{
"docid": "c267b22fd9f681c8e59e4177bd16a942",
"score": "0.58346057",
"text": "def parse_star_date_taken_with_v1_format(datetime_string)\n eastern_offset = Time.now.in_time_zone('Eastern Time (US & Canada)').formatted_offset\n DateTime.strptime(\"#{datetime_string} #{eastern_offset}\", '%m/%d/%Y %H:%M:%S %Z')\n end",
"title": ""
},
{
"docid": "8509ec1f389cb6fad80ee35bb2ad1bf9",
"score": "0.58226484",
"text": "def parse_date_string(date_string)\n ::Time.zone.parse(date_string)\n end",
"title": ""
},
{
"docid": "b1828887b00f4869c6863f460b28429a",
"score": "0.5820678",
"text": "def utc\n new_offset(0)\n end",
"title": ""
},
{
"docid": "3d68a0ad1c6f0d2699d9b67b921501f8",
"score": "0.5796315",
"text": "def parse_date(string); end",
"title": ""
},
{
"docid": "8c3e8fe2c38fd29c1dbd1839d2cc18df",
"score": "0.57820296",
"text": "def utc_offset\n @offset.utc_offset\n end",
"title": ""
},
{
"docid": "8c3e8fe2c38fd29c1dbd1839d2cc18df",
"score": "0.57820296",
"text": "def utc_offset\n @offset.utc_offset\n end",
"title": ""
},
{
"docid": "8c3e8fe2c38fd29c1dbd1839d2cc18df",
"score": "0.57820296",
"text": "def utc_offset\n @offset.utc_offset\n end",
"title": ""
},
{
"docid": "6f79b031e7b41682259cee4753ad00cc",
"score": "0.5772291",
"text": "def parse_date; nil; end",
"title": ""
},
{
"docid": "0a5cab7df4711eaddddac39649257787",
"score": "0.5764317",
"text": "def parse_star_date_taken_with_v2_format(text)\n text_without_microseconds = text.slice(0, text.size - 4)\n eastern_offset = Time.now.in_time_zone('Eastern Time (US & Canada)').formatted_offset\n DateTime.strptime(\"#{text_without_microseconds} #{eastern_offset}\", '%Y-%m-%d %H:%M:%S %Z')\n end",
"title": ""
},
{
"docid": "1135baaed465163756eb89001dadd9ac",
"score": "0.5749239",
"text": "def time_to_utc(str)\n return DateTime.parse(\"2017-05-15 #{str}\") unless str.nil?\nend",
"title": ""
},
{
"docid": "89c2fbe0ba56ec15e94fc0ff4b74fc3d",
"score": "0.5745384",
"text": "def parse_date_s(date_s)\n date = \"#{date_s} -0400\"\n datetime = DateTime.strptime(date, \"%m/%d/%Y %H:%M %z\")\n datetime\n end",
"title": ""
},
{
"docid": "33dbfba07b33c5e665eb52a4746bd673",
"score": "0.57410157",
"text": "def received_at\n # U.K. Format: 27/09/2006 22:30:54\n return if params['transaction_date'].blank?\n time = params['transaction_date'].scan(/\\d+/)\n Time.utc(time[2], time[1], time[0], time[3], time[4], time[5])\n end",
"title": ""
},
{
"docid": "fed8a96bce56e0321f025ab6afd6bd2d",
"score": "0.57315207",
"text": "def decode_datetime(string); end",
"title": ""
},
{
"docid": "c0b535fc4555d081da160ea683210737",
"score": "0.5729987",
"text": "def parse_offset(offset)\n raise \"Invalid time: #{offset}\" if offset !~ /^(-)?(?:([0-9]+)(?::([0-9]+)(?::([0-9]+))?)?)?$/\n\n negative = !$1.nil?\n hour = $2.nil? ? 0 : $2.to_i\n minute = $3.nil? ? 0 : $3.to_i\n second = $4.nil? ? 0 : $4.to_i\n\n seconds = hour\n seconds = seconds * 60\n seconds = seconds + minute\n seconds = seconds * 60\n seconds = seconds + second\n seconds = -seconds if negative\n seconds\n end",
"title": ""
},
{
"docid": "8a52ccd54826b05931ceb4205a5e4ede",
"score": "0.5712279",
"text": "def utc_offset\n @utc_offset\n end",
"title": ""
},
{
"docid": "a9af0596fa6a35ddfdd834b85b879ddb",
"score": "0.5696265",
"text": "def local(time, utc_offset = LOCAL_TIME_ZONE_OFFSET)\n TimeInZone.parse(time, utc_offset)\nend",
"title": ""
},
{
"docid": "eadb9652b11d63493911b8b4718539f3",
"score": "0.5660771",
"text": "def to_utc(utc_offset, std_offset)\n absolute = @day.to_absolute(@year, @month)\n @time.to_utc(utc_offset, std_offset, absolute.year, absolute.month, absolute.day)\n end",
"title": ""
},
{
"docid": "f40eee0458bd496c97ebd99db7ec0f98",
"score": "0.56316286",
"text": "def to_date_from_utc\n begin\n return DateTime.parse(self).to_time.to_i-Time.now.utc_offset\n rescue ArgumentError\n return 0\n end\n end",
"title": ""
},
{
"docid": "d0df387fc1c5805c07b12801bae422fa",
"score": "0.56145775",
"text": "def local_to_utc(time) = parse_utc(tzinfo.local_to_utc(time, &:last))",
"title": ""
},
{
"docid": "04d63c6b3f7934bd740c4bf1d285fe92",
"score": "0.56117827",
"text": "def parse_date(date)\n $api.parse_date(date)\n end",
"title": ""
},
{
"docid": "52689d65cf820f538bf2a69a5d12fc91",
"score": "0.56072915",
"text": "def parse_date(val); end",
"title": ""
},
{
"docid": "b2b0ff6e736576103a281b4a170154f3",
"score": "0.55956256",
"text": "def to_utc(local); end",
"title": ""
},
{
"docid": "b2b0ff6e736576103a281b4a170154f3",
"score": "0.55956256",
"text": "def to_utc(local); end",
"title": ""
},
{
"docid": "daf7807f2dd6071a34842276daa046a7",
"score": "0.5594083",
"text": "def normalize_ts(strval)\r\n normalval = nil\r\n strval_w_tz = \"#{strval} #{tz_offset('America/Los_Angeles')}\"\r\n input_format = \"%m/%d/%y %l:%M:%S %p %z\"\r\n \r\n dt_pacific = DateTime.strptime(strval_w_tz, input_format) rescue nil\r\n if( dt_pacific == nil )\r\n puts strval_w_tz\r\n raise UnparseableError.new(\"Unknown timestamp value: #{strval}\")\r\n end\r\n\r\n dt_eastern = dt_pacific.to_time.utc.localtime(\"#{tz_offset('America/New_York')}:00\")\r\n normalval = dt_eastern.iso8601\r\n return normalval\r\nend",
"title": ""
},
{
"docid": "6d6eedc54de0dc3919e053418a6f4311",
"score": "0.55912817",
"text": "def utc\n if offset == 0\n self\n else\n advance(:seconds => -offset, :offset => 0)\n end\n end",
"title": ""
},
{
"docid": "f500bf8d036318515f64499fa0d8a4db",
"score": "0.5565001",
"text": "def parse_event_times\n Time.zone = self.time_zone if self.time_zone\n events.each do |e|\n e.start = Time.zone.parse(e.start) if e.start\n e.end = Time.zone.parse(e.end) if e.end\n logger.debug(\"ERROR: Empty start (#{e.start}) or end (#{e.end}) for event #{e.inspect} \") if !e.start || !e.end\n end\n end",
"title": ""
},
{
"docid": "2118aea6ca9555c5c294d31e37d1d842",
"score": "0.5562589",
"text": "def parse_event(line)\n parsed = line.match(EVENT_REGEX)\n Event.new(DateTime.parse(parsed[1]), parsed[2])\nend",
"title": ""
},
{
"docid": "da25a6805337cf0bf4eb57e87263fd89",
"score": "0.5562146",
"text": "def created_at_with_event_timezone\n self.created_at + self.event.event_timezone_offset.to_i.seconds\n end",
"title": ""
},
{
"docid": "c2bb1b9ae97e450e976a21d63b0c9350",
"score": "0.5561695",
"text": "def created_at_with_event_timezone\n # self.created_at.in_time_zone(self.event_timezone)\n self.created_at + self.event.timezone_offset.to_i.seconds\n end",
"title": ""
},
{
"docid": "ad347272ae26e9abd265270051ffb26a",
"score": "0.5558101",
"text": "def parse_time(data)\n return DateTime.strptime(data, \"%F %T %z\").to_time.utc\nend",
"title": ""
},
{
"docid": "ad347272ae26e9abd265270051ffb26a",
"score": "0.5558101",
"text": "def parse_time(data)\n return DateTime.strptime(data, \"%F %T %z\").to_time.utc\nend",
"title": ""
},
{
"docid": "c8e5633959a4fb3dbb2926c4d3a33a83",
"score": "0.5557945",
"text": "def offset_utc\n tz = ActiveSupport::TimeZone.new('Madrid')\n tz.utc_offset / 3600\n end",
"title": ""
},
{
"docid": "a9c22b611930f79acbf40d620794c788",
"score": "0.55525374",
"text": "def utc_offset\n return self.timezone.secondsFromGMT\n end",
"title": ""
},
{
"docid": "a9c22b611930f79acbf40d620794c788",
"score": "0.55525374",
"text": "def utc_offset\n return self.timezone.secondsFromGMT\n end",
"title": ""
},
{
"docid": "a9c22b611930f79acbf40d620794c788",
"score": "0.55525374",
"text": "def utc_offset\n return self.timezone.secondsFromGMT\n end",
"title": ""
},
{
"docid": "226eae72451e1d8a8fb5e6727d00f0de",
"score": "0.5539521",
"text": "def build_utc_offset(str)\n if str.nil?\n nil\n else\n sign = str[0]\n hours = str[1..2].to_i\n minutes = str[3..4].to_i\n UtcOffset.new(sign: sign, hours: hours, minutes: minutes)\n end\n end",
"title": ""
},
{
"docid": "987da82c078c0ab19d8104319613c198",
"score": "0.55388933",
"text": "def parse_response_date(date_string)\n date_millis_string = date_string[/Date\\((\\d+)\\)/, 1]\n Time.zone.at(date_millis_string.to_f / 1000.0)\n end",
"title": ""
},
{
"docid": "7528922b8bd8ee333435917e9ddb0230",
"score": "0.55193865",
"text": "def utc_offset\n `this.__value__.getTimezoneOffset() * -60`\n end",
"title": ""
},
{
"docid": "0bfb48890e13b992d32481e96defd1a7",
"score": "0.55166227",
"text": "def parse_date(str)\n str.gsub!('ET', 'EDT')\n DateTime.strptime(str, '%B %d, %I:%M %p %Z')\n end",
"title": ""
},
{
"docid": "3e7d6cc862011162efdfe6feb9fdd4de",
"score": "0.5514924",
"text": "def build_date(date)\n tz_pattern = /(?:\\[([+-]?\\d{1,4}):\\S{3}\\])?\\z/\n\n # Timezone offset handling\n date.sub!(tz_pattern, '')\n offset = Regexp.last_match(1)\n\n if offset\n # Offset padding\n _, hours, mins = *offset.match(/\\A([+-]?\\d{1,2})(\\d{0,2})?\\z/)\n offset = format('%+03d%02d', hours.to_i, mins.to_i)\n else\n offset = '+0000'\n end\n\n date << \" #{offset}\"\n\n Time.parse(date)\n end",
"title": ""
},
{
"docid": "a0e6400ba434dd9f81f1d70c4a22deea",
"score": "0.55083054",
"text": "def decode_date(string); end",
"title": ""
},
{
"docid": "94d91caef6f8c5e176068177106c1eca",
"score": "0.5504881",
"text": "def apply_utc_offset( time )\n return time if utc_offset.nil?\n\n time = time.dup\n if utc_offset == 0\n time.utc\n else\n time.localtime(utc_offset)\n end\n time\n end",
"title": ""
},
{
"docid": "f6affd6af33f8a64e361e76fb7f6291f",
"score": "0.54993355",
"text": "def utc_total_offset; end",
"title": ""
},
{
"docid": "f6affd6af33f8a64e361e76fb7f6291f",
"score": "0.54993355",
"text": "def utc_total_offset; end",
"title": ""
},
{
"docid": "06e78f4f51eab99077ea9d49da5cf002",
"score": "0.5489109",
"text": "def utc_offset\n @utc_offset == :utc ? 0 : @utc_offset\n end",
"title": ""
},
{
"docid": "6cbe8a6c7c1a772be1fad3e397654bbc",
"score": "0.54797745",
"text": "def parse_time(date, time, timezone = \"America/Chicago\")\n ActiveSupport::TimeZone.new(timezone).parse(date.strftime(\"%Y-%m-%d\") + ' ' + time) \nend",
"title": ""
},
{
"docid": "63987c706971a63048e67b01f2342f2b",
"score": "0.54765016",
"text": "def to_utc(utc_offset, std_offset, year, month, day)\n result = if @hour > 24 || @hour == 24 && (@minute > 0 || @second > 0) || @sign != 1\n DateTime.new(year, month, day, 0, 0, 0) + Rational(@sign * (@second + (@minute + @hour * 60) * 60), 86400)\n else\n DateTime.new(year, month, day, @hour, @minute, @second)\n end\n\n offset = 0\n offset = offset + utc_offset if @ref == :standard || @ref == :wall_clock\n offset = offset + std_offset if @ref == :wall_clock\n result - Rational(offset, 86400)\n end",
"title": ""
},
{
"docid": "1bc242c9ad35fd8ae45c4de810131e9f",
"score": "0.54710716",
"text": "def date_of_event(event)\n # get the date out of\n # Mon DD HH:MM am/pm THE DESCRIPTION CITY STATE ZIP.\n d = event.split(\" \")\n DateTime.parse(d[0..3].join(\" \"))\n end",
"title": ""
},
{
"docid": "17ddd8a1b1641acf031049d01598426f",
"score": "0.5469891",
"text": "def tz_offset\n -5\n end",
"title": ""
},
{
"docid": "1d0a10ee20ecc41a6ab2492faac37409",
"score": "0.5450759",
"text": "def tz_offset_from_javascript\n self.tz.utc_offset / -60 if self.tz\n end",
"title": ""
},
{
"docid": "63d06af2101ae6bdd6a3a0a4ce123736",
"score": "0.543783",
"text": "def parse_date\n require 'date'\n require 'parsedate'\n elements = ParseDate.parsedate(self.to_s)\n DateTime.civil(elements[0], elements[1], elements[2], elements[3] || 0, elements[4] || 0, elements[5] || 0)\n end",
"title": ""
},
{
"docid": "afeb202a86326b8399bd7a2aca429bb6",
"score": "0.5431938",
"text": "def date_time_with_zone(s)\n DateTime.parse(s)\n end",
"title": ""
},
{
"docid": "7527ef9135bfeae061879a477d8496ec",
"score": "0.5429046",
"text": "def getutc; end",
"title": ""
},
{
"docid": "7527ef9135bfeae061879a477d8496ec",
"score": "0.5429046",
"text": "def getutc; end",
"title": ""
},
{
"docid": "7527ef9135bfeae061879a477d8496ec",
"score": "0.5429046",
"text": "def getutc; end",
"title": ""
},
{
"docid": "7527ef9135bfeae061879a477d8496ec",
"score": "0.5429046",
"text": "def getutc; end",
"title": ""
},
{
"docid": "7527ef9135bfeae061879a477d8496ec",
"score": "0.5429046",
"text": "def getutc; end",
"title": ""
},
{
"docid": "7527ef9135bfeae061879a477d8496ec",
"score": "0.5429046",
"text": "def getutc; end",
"title": ""
},
{
"docid": "9860315f296e8207adc7528fb459c2c8",
"score": "0.54236597",
"text": "def utc; end",
"title": ""
},
{
"docid": "9860315f296e8207adc7528fb459c2c8",
"score": "0.54236597",
"text": "def utc; end",
"title": ""
},
{
"docid": "9860315f296e8207adc7528fb459c2c8",
"score": "0.54236597",
"text": "def utc; end",
"title": ""
},
{
"docid": "9860315f296e8207adc7528fb459c2c8",
"score": "0.54236597",
"text": "def utc; end",
"title": ""
},
{
"docid": "9860315f296e8207adc7528fb459c2c8",
"score": "0.54236597",
"text": "def utc; end",
"title": ""
},
{
"docid": "9860315f296e8207adc7528fb459c2c8",
"score": "0.54236597",
"text": "def utc; end",
"title": ""
},
{
"docid": "8055b68edd90c162c494f7d8a647cc19",
"score": "0.54196244",
"text": "def parse(time_string); end",
"title": ""
},
{
"docid": "1285eb897fb0919d08a3528574ada5c0",
"score": "0.54095906",
"text": "def utc_offset\n period.utc_total_offset\n end",
"title": ""
},
{
"docid": "0df6b39ffda6b49bd410c6da60177990",
"score": "0.5400001",
"text": "def reconstruct_start_time\n params[:event][\"start_time\"] = Time.zone.local(\n params[:event].delete(\"start_time(1i)\").to_i,\n params[:event].delete(\"start_time(2i)\").to_i,\n params[:event].delete(\"start_time(3i)\").to_i,\n params[:event].delete(\"start_time(4i)\").to_i,\n params[:event].delete(\"start_time(5i)\").to_i\n )\n end",
"title": ""
},
{
"docid": "51fb8df69a7598139588080ff7cd1353",
"score": "0.5385165",
"text": "def parse(event_from_ics)\n # Set all fields based on docs\n @location = event_from_ics.location\n @start_time = event_from_ics.dtstart.hour * 100 + event_from_ics.dtstart.minute\n @end_time = event_from_ics.dtend.hour * 100 + event_from_ics.dtend.minute\n @summary = event_from_ics.summary\n\n # TODO: Stop storing the timings as hhMM as int but as objects\n end",
"title": ""
},
{
"docid": "17ca4d81de01c21fcb0ad80aee0f0f89",
"score": "0.53780824",
"text": "def utc\n json = get_configuration\n DateTime.parse(json['utc'])\n end",
"title": ""
},
{
"docid": "1d3702c814676dbf0ff147397754699b",
"score": "0.5372307",
"text": "def timestamp_parse(timestamp)\n timestamp\n end",
"title": ""
},
{
"docid": "53c0b12589d13d121d082a89de191b7a",
"score": "0.5360676",
"text": "def convert_input_datetime_no_offset(v, input_timezone)\n case input_timezone\n when :utc, nil\n v # DateTime assumes UTC if no offset is given\n when :local\n offset = local_offset_for_datetime(v)\n v.new_offset(offset) - offset\n else\n convert_input_datetime_other(v, input_timezone)\n end\n end",
"title": ""
},
{
"docid": "d69b45e65ecb9f816796d06f4d6f7475",
"score": "0.5356054",
"text": "def dateparse\n DateTime.parse(self.date)\n end",
"title": ""
},
{
"docid": "98c5539def3cb995ef2b1cf880bf8dda",
"score": "0.5355869",
"text": "def to_timei; (to_i + utc_offset) % 86400 end",
"title": ""
}
] |
8ce4070b1261f456bab4ccb6f8c68cd0
|
Notify the appropriate group when something is shared
|
[
{
"docid": "1b45f03c642b230613b144b2d5e2f0d1",
"score": "0.528041",
"text": "def share_notification(share, user)\n @recipient = user\n @share = share\n @user = @share.user\n @item = @share.owner\n @paper = @item.get_paper\n @item_name = @item.longname\n @item_summary = @item.latest_assertion\n @short_sharetext = @share.text.split.first(6) * ' '\n if @share.text.length > @short_sharetext.length\n @short_sharetext << '...' \n end\n @maillog = Maillog.create!(:purpose => 'share_notification', :user => @recipient, :about => share)\n @url = paper_path(@paper, :only_path => false )\n @m_url = paper_path(@paper, :only_path => false ) + '/m/' + @maillog.id.to_s\n mail(:to => to(@recipient), :subject => @user.name + \" has shared something on J.lab: \" + @short_sharetext)\n end",
"title": ""
}
] |
[
{
"docid": "c3b3da5ed518c4667a2d1933ab1929a5",
"score": "0.6146221",
"text": "def notify_my_share(share)\n return if (share.visible_to==Share::VISIBLE_TO_SELF)\n\n if share.visible_to\n # share to people in visible to list\n receivers = share.visible_to\n else\n # share to all people follows me\n receivers = followed_by\n end\n\n receivers.each do |receiver_id|\n # send notification\n Notification.add(share._id, self._id, receiver_id, Notification::TYPE_SHARE)\n end\n end",
"title": ""
},
{
"docid": "1fa9217236c824e30d59a2f7274eb089",
"score": "0.61166406",
"text": "def notify_user\n group = self.group\n admin = self.group.admin\n if group && admin && self.user_id != self.admin.id\n self.user.devices.each { |x| x.fire_notification!(\"#{admin.username} added you to the group #{group.name}\", :added_to_group, { group_id: group.id, group: group.as_json }) }\n end\n end",
"title": ""
},
{
"docid": "332a54e49b32ef39a4960d47941f8875",
"score": "0.5903947",
"text": "def join_group\n self.join_group_button\n self.wait_until { notification_element.exists? }\n end",
"title": ""
},
{
"docid": "8338e8df157d1b57c22881edb8997fec",
"score": "0.581938",
"text": "def notify_and_share_admins\n mentioned_admins.each do |mentioned|\n # Here, Send an email\n entry = self.library_entries.create(sender_id: self.admin.id, receiver_id: mentioned.id, admin_library_id: mentioned.library.id, shared: true)\n if entry.valid?\n Notification.create(recipient: mentioned, actor: self.admin, action: \"shared\", notifiable: self)\n end\n end\n end",
"title": ""
},
{
"docid": "ee92daa7e0e74390e64e4994522c4b5c",
"score": "0.580916",
"text": "def broadcast\n # add to stream of author\n share(author, author)\n # add to streams of author's followers\n author.followers.each do |follower|\n share(author,follower)\n end\n \n if group\n # add to stream of group\n share(author,group)\n # add to streams of group's members\n group.members.each do |member|\n share(group,member)\n end\n end\n end",
"title": ""
},
{
"docid": "99ff7c68d563932be5b87d89e26cbdfe",
"score": "0.5766941",
"text": "def handle_join(client, group_name)\n\t\tresp = \"Group \" + group_name + \" doesn't exist\"\n\t\tgroup = get_group_by_name(group_name)\n\t\tif group\n\t\t\thandle_users(client, group_name)\n\t\t\tgroup.add_client(client)\n\t\t\tresp = \"Joined group \" + group_name\n\t\t\tnotification_string = client.name.to_s + \" joined \" + group_name\n\t\t\tgroup.post(client, notification_string, notification_string)\n\t\tend\n\t\tclient.send(\"Server\", [resp])\n\tend",
"title": ""
},
{
"docid": "db7d88bf1655a53b16c3f8ccf5e3468f",
"score": "0.575399",
"text": "def send_notification\n\t\tSingleCellMailer.share_notification(self.study.user, self).deliver_now\n\tend",
"title": ""
},
{
"docid": "56b8fbc1c0b9e09a7cbd6a32f08cb22c",
"score": "0.57130617",
"text": "def request_to_join_group\n self.request_to_join_group_button\n self.wait_until { notification_element.exists? }\n end",
"title": ""
},
{
"docid": "c399585bec31fca9b15ef93a0b593ff3",
"score": "0.57064277",
"text": "def notify\n sender = self.member\n receiver = self.find_receiver_from_sender_chat(sender)\n\n MemberMailerWorker.perform_async(member_id: receiver.id.to_s, workspace_id: self.workspace.id.to_s, status_event_id: self.id.to_s, perform: :send_status_event)\n TeamMailerWorker.perform_async(workspace_id: self.workspace.id.to_s, status_event_id: self.id.to_s, perform: :send_status_event)\n end",
"title": ""
},
{
"docid": "a9c55e8a220358301a5cc1c11b8e72f0",
"score": "0.57047296",
"text": "def notify; end",
"title": ""
},
{
"docid": "a9c55e8a220358301a5cc1c11b8e72f0",
"score": "0.5704499",
"text": "def notify; end",
"title": ""
},
{
"docid": "2a3f273c471b67384593a77d76436701",
"score": "0.5676821",
"text": "def notify_and_share_admins\n mentioned_admins.each do |mentioned|\n # Here put email \n entry = self.library_entries.create(sender_id: self.admin.id, receiver_id: mentioned.id, admin_library_id: mentioned.library.id, shared: true)\n if entry.valid?\n Notification.create(recipient: mentioned, actor: self.admin, action: \"shared\", notifiable: self)\n end\n end\n end",
"title": ""
},
{
"docid": "372bc2b78f3b1b28050d18d595ed8cef",
"score": "0.56582266",
"text": "def notify\n end",
"title": ""
},
{
"docid": "bac5a10b51f82c58c0f458ca8a310614",
"score": "0.56459415",
"text": "def notify_subgroups!\n ps =\n participants\n .joins(:person)\n .where.not(subgroup: nil)\n\n ps.each(&:send_subgroup_notification)\n end",
"title": ""
},
{
"docid": "3f3b7a52a53cc6e7febad8fa1f646f0d",
"score": "0.56410897",
"text": "def sync_group_name\n super\n end",
"title": ""
},
{
"docid": "7bd3707662598d39dd7c891479f84831",
"score": "0.5618536",
"text": "def notify_peers_we_joined\n peers.each do |other|\n Spawnling.new do\n begin\n res = Net::HTTP.post_form(other.contact_point_uri, joined: shared_contact_url)\n assert res.is_a? Net::HTTPSuccess\n rescue\n other.destroy!\n end\n end\n end\n end",
"title": ""
},
{
"docid": "ab486cf04109b1e4ab6a1f63c68dfaae",
"score": "0.55946594",
"text": "def notify!(mid, *args, **hargs)\n notify(mid, *args, **hargs, sync: true)\n end",
"title": ""
},
{
"docid": "d77e07b141e9b0aaef515443641af7a4",
"score": "0.5589616",
"text": "def notify\n end",
"title": ""
},
{
"docid": "7a2104940de57de712f3c5b4f34cb890",
"score": "0.55750155",
"text": "def notify_user_match\n\n end",
"title": ""
},
{
"docid": "264976126f566f930fad4096a696cd24",
"score": "0.55651194",
"text": "def global_caregiver_broadcast (msg)\n mapped_to = DB['groups'].find({ 'CaregiverID' => {'$exists' => true} })\n mapped_to.each do |r|\n send_SMS_to(r['CaregiverID'], msg)\n puts \"Texting\" + r['CaregiverID']\n puts \"With msg: \" + msg\n end\n end",
"title": ""
},
{
"docid": "f7cfb4576ee630924e52b2f750f4b8f7",
"score": "0.5549768",
"text": "def configure_membership(*args)\n new_membership = [args[0]].flatten\n\n new_membership.each do |new_m|\n unless @membership.include?(new_m)\n OmfCommon.comm.subscribe(new_m) do |t|\n if t.error?\n warn \"Group #{new_m} disappeared\"\n #EM.next_tick do\n # @membership.delete(m)\n #end\n else\n self.synchronize do\n @membership << new_m\n @membership_topics[new_m] = t\n self.inform(:status, { membership: @membership }, t)\n end\n\n t.on_message(nil, @uid) do |imsg|\n process_omf_message(imsg, t)\n end\n end\n end\n end\n end\n @membership\n end",
"title": ""
},
{
"docid": "1d2c48709890064d642901e1f14acba3",
"score": "0.55479753",
"text": "def notify!; end",
"title": ""
},
{
"docid": "e44a3d13fc0f1921d8ab589cc5955c69",
"score": "0.55456966",
"text": "def notify_group( pid, status )\n\t\tself.log.debug \"Notifying group of reaped child %d: %p\" % [ pid, status ]\n\t\treturn unless self.running?\n\n\t\tgroup = self.task_pids[ pid ]\n\t\tgroup.on_child_exit( pid, status )\n\tend",
"title": ""
},
{
"docid": "e7848ff1f3efe0a2604cea9bcd3a6e3c",
"score": "0.5542492",
"text": "def update_broadcast_group_ids_and_smpp_alert_group_ids\n unless self.get_related_topics.empty?\n begin\n updated_group_ids = []\n if (self.group.need_review && self.is_pending?) || self.is_scheduled_post?\n updated_group_ids = self.get_remaining_group_ids\n else\n updated_group_ids = self.get_updated_broadcast_group_ids\n end\n self.get_related_topics.each do |topic|\n unless updated_group_ids.empty?\n topic.to_update_broadcast_group_ids(updated_group_ids)\n end\n end\n rescue => e\n ::Rails.logger.error \"Error with updating broadcast groups : #{e}\"\n end\n end\n end",
"title": ""
},
{
"docid": "3253042dead58be36c904653acf1a489",
"score": "0.5531435",
"text": "def perform(group, groups)\n\n puts \"Iniciando mescla de grupos\"\n\n user = group.user\n\n groups.each do |g|\n\n if user.groups.exists?(g)\n group_copy = user.groups.find g\n group.contacts << group_copy.contacts\n end\n\n end\n\n Pusher[group.user_id.to_s].trigger('merge_groups_done', {:status => 'success', :message => \"Contatos de vários grupos foram copiados para o grupo #{group.name} com sucesso!\"})\n\n puts \"Mescla de grupos concluida!\"\n\n end",
"title": ""
},
{
"docid": "d9afef787642f8d061af9bd4a0220665",
"score": "0.5529318",
"text": "def call\n notify_mentioned_users\n notify_users_in_the_same_discussion\n notify_commentable_creator\n end",
"title": ""
},
{
"docid": "b4c0587432f5841b43afd3faab6fd9da",
"score": "0.5517858",
"text": "def notify\n {\n }\n end",
"title": ""
},
{
"docid": "b4c0587432f5841b43afd3faab6fd9da",
"score": "0.5517858",
"text": "def notify\n {\n }\n end",
"title": ""
},
{
"docid": "c984a73a577e3d8f2c2ae45443db0145",
"score": "0.5497426",
"text": "def notify?; end",
"title": ""
},
{
"docid": "c984a73a577e3d8f2c2ae45443db0145",
"score": "0.5497426",
"text": "def notify?; end",
"title": ""
},
{
"docid": "c984a73a577e3d8f2c2ae45443db0145",
"score": "0.5497426",
"text": "def notify?; end",
"title": ""
},
{
"docid": "c984a73a577e3d8f2c2ae45443db0145",
"score": "0.5497426",
"text": "def notify?; end",
"title": ""
},
{
"docid": "c984a73a577e3d8f2c2ae45443db0145",
"score": "0.5497426",
"text": "def notify?; end",
"title": ""
},
{
"docid": "c984a73a577e3d8f2c2ae45443db0145",
"score": "0.5497426",
"text": "def notify?; end",
"title": ""
},
{
"docid": "3981c93b89fe2d6b48d7141b27a43fd3",
"score": "0.5495956",
"text": "def notify_peers_we_left\n peers.each do |other|\n Spawnling.new do\n begin\n res = Net::HTTP.post_form(other.contact_point_uri, left: shared_contact_url)\n assert res.is_a? Net::HTTPSuccess\n rescue\n other.destroy!\n end\n end\n end\n end",
"title": ""
},
{
"docid": "ef925920506f05168624bd42a87d41e6",
"score": "0.54903877",
"text": "def shared_by=(value)\n @shared_by = value\n end",
"title": ""
},
{
"docid": "3029526af66bc8e5679bdc6817da5bfe",
"score": "0.5462221",
"text": "def notify_cache_for_me\n rows = [[group_id, user_id]]\n GroupMember.notify_cache(rows)\n end",
"title": ""
},
{
"docid": "5cb62ef980cdb012cce2b3bbb02c5be4",
"score": "0.54618067",
"text": "def send_subgroup_notification\n return unless attending && subgroup\n\n ParticipantMailer.subgroup_notification(person, activity, self).deliver_later\n end",
"title": ""
},
{
"docid": "db1ba5af3f8915368d3a2227fd7d115a",
"score": "0.54165137",
"text": "def perform(grouping_id)\n self.grouping = Grouping.find(grouping_id)\n\n grouping.with_lock do\n return unless needs_notifying?\n send_email\n mark_as_sent\n end\n end",
"title": ""
},
{
"docid": "a453b893dab6462f01dcc15d5c786254",
"score": "0.53721136",
"text": "def join_group( group )\r\n group.invited.delete( self )\r\n group.joined << self\r\n @group = group\r\n @group.joined.each_output \"{C0<N>{x 0<have,has> joined the group!\", [self]\r\n return true\r\n end",
"title": ""
},
{
"docid": "78e39d2cb38ece601fec630318220b30",
"score": "0.5371135",
"text": "def send_summary_to_group_and_master_group\n # group must be present\n # master group must be present\n # * group name should be xx_...\n # * master group with name xx_master must exist\n _master_group = group.master_group unless group.blank? \n UserMailer.deliver_order_summary( self, group.email ) if !group.blank?\n UserMailer.deliver_order_summary( self, _master_group.email ) if !_master_group.blank? && _master_group.valid?\n end",
"title": ""
},
{
"docid": "5f970c1a96c2f819ec7a960bf5e2d02b",
"score": "0.5366509",
"text": "def notify_users\n Service.same_district_of(self.user).where(category: self.category).where.not(user: self.user).each do |service|\n Mailer::UserMailerWorker.perform_in(3.seconds, :new_mission_posted, mission_id: self.id, user_id: service.user.id)\n end\n Mailer::UserMailerWorker.perform_in(3.seconds, :people_availble_to_help, mission_id: self.id)\n end",
"title": ""
},
{
"docid": "495dc07f589968c475d00666d0093c7e",
"score": "0.5365527",
"text": "def notify_request\n ::Notification.create!(\n from: user,\n user_id: target_id,\n seen: false,\n target: self,\n kind: :SHARED_LIST_RECEIVED\n )\n end",
"title": ""
},
{
"docid": "8c44c8e8fbcf8a2738a4d1d30811381b",
"score": "0.53645873",
"text": "def notify_users\n Mission.same_district_of(self.user).where(category: self.category).where.not(user: self.user).each do |service|\n Mailer::UserMailerWorker.perform_in(3.seconds, :new_service_posted, service_id: self.id, user_id: service.user.id)\n end\n Mailer::UserMailerWorker.perform_in(3.seconds, :people_who_need_help, service_id: self.id)\n end",
"title": ""
},
{
"docid": "7bc98d00f68d3ae04922344807501e68",
"score": "0.5350549",
"text": "def notify\n put(:notify)\n end",
"title": ""
},
{
"docid": "4ccc18aa001cea687c38f911ab350e80",
"score": "0.5346996",
"text": "def handle_groups(client)\n\t\tgroup_names = []\n\t\[email protected] do |group|\n\t\t\tgroup_names << group.name\n\t\tend\n\t\tclient.send(\"Server\", group_names)\n\tend",
"title": ""
},
{
"docid": "b8d0ccb8ea56451e7c5fb469e9db3296",
"score": "0.53278774",
"text": "def received(group)\n @group = group\n @url = \"https://shrouded-chamber-4178.herokuapp.com/\"\n mail to: \"[email protected]\", subject: \"New Group Request\" \n end",
"title": ""
},
{
"docid": "26ea540a68f635251e9ff4f6e0279616",
"score": "0.5321007",
"text": "def check_sharing_with_branded_group(new_groups)\n @groups_with_custom_layouts = nil\n new_shared_with_groups = nil\n\n # check if \"shared with\" groups has been changed in the update\n if action == \"create\" && params[:group_sharing]\n new_shared_with_groups = params[:group_sharing].keys\n elsif action == \"update\" && (@shared_with_groups_pre_update != @workflow.shared_with_networks)\n new_shared_with_groups = (@workflow.shared_with_networks - @shared_with_groups_pre_update).map { |n| n.ids }\n end\n\n if new_shared_with_groups && !params[:workflow][:skin]\n # check whether an added/removed group had styling options available\n group_ids = Conf.virtual_hosts.values.map {|v| v['group_id']} & new_shared_with_groups\n @groups_with_custom_layouts = Network.find(group_ids)\n end\n end",
"title": ""
},
{
"docid": "9200b73af564ca4fd6063649a05b7b20",
"score": "0.53164196",
"text": "def create\n @reading_list_share = ReadingListShare.new(params[:reading_list_share])\n @reading_list = @reading_list_share.reading_list\n if not ReadingListsHelper::has_access(@reading_list, current_user, ReadingListsHelper::OWNER)\n @paper_mgt_notification = 'User not authorized.'\n respond_to do |format|\n format.html { redirect_to @reading_list, notice: @paper_mgt_notification }\n format.js {}\n end\n return\n end\n\n group = Group.find(params[:reading_list_share][:group_id])\n if @reading_list_share.reading_list.has_group(group)\n respond_to do |format|\n format.html { redirect_to @reading_list_share.reading_list, notice: 'Group share already exists.' }\n format.json { render json: @reading_list_share, status: :created, location: @reading_list_share }\n end\n return\n end\n\n if @reading_list_share.reading_list.user != @reading_list_share.group.owner\n respond_to do |format|\n format.html { redirect_to @reading_list_share.reading_list, notice: 'Group and reading list must belong to the same user.' }\n format.json { render json: @reading_list_share, status: :created, location: @reading_list_share }\n end\n return\n end\n \n respond_to do |format|\n if @reading_list_share.save\n # notify group members \n deliver(current_user.first_name, @reading_list.name, group) \n format.html { redirect_to @reading_list_share.reading_list, notice: 'Reading list share was successfully created.' }\n format.json { render json: @reading_list_share, status: :created, location: @reading_list_share }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reading_list_share.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "999320e577ce968d248a04d0a9c6efc1",
"score": "0.53152144",
"text": "def do_notifications!(prior_version=nil, notify=false)\n # TODO: this will blow up if the group_category string is set on the\n # previous version, because it gets confused between the db string field\n # and the association. one more reason to drop the db column\n prior_version ||= self.versions.previous(self.current_version.number).try(:model)\n self.notify_of_update = notify || false\n broadcast_notifications(prior_version || dup)\n remove_assignment_updated_flag\n end",
"title": ""
},
{
"docid": "4200a04c958b4a0949add62bfc401832",
"score": "0.53144646",
"text": "def send_group_notification\n @group = @feedpost.parent\n\n return true if @feedpost.new_record? || params[:email] != \"email\" ||\n params[:feedpost][:post_type] != \"wall\" ||\n @group.class.name != \"Group\" ||\n (! has_permission?(\"email\"))\n\n emails = @group.watchers.collect{|w| w.user}.select{|u| u.email_notifications}.collect{|u| u.email}\n\n FeedpostMailer.group_notification(@feedpost,emails).deliver\n end",
"title": ""
},
{
"docid": "966e04af866afc6a819329fcbad258a4",
"score": "0.53048694",
"text": "def join\n @group.members.create(:user_id=>current_user.id)\n @invitable_members = @group.members - @group.members.where(user_id: current_user.id) \n @invitable_members.map(&:user).uniq.each do |user|\n reciver = User.find(user)\n notifications = reciver.notifications.unread \n Notification.create(recepient: user, user: current_user, body: \"#{current_user.screen_name } has join #{@group.topic}\", notificable: @group, :accept => true)\n PrivatePub.publish_to \"/profiles/new_#{user.id}\", \"jQuery('#all-notifications').html('#{notifications.count}'); jQuery('#all-notifications').addClass('push-notification');\"\n end \n if request.referrer.include?(\"followings\")\n @suggest=false\n else \n @suggested_groups, @suggest = suggested_groups\n end\n \n respond_to do |format|\n format.js\n format.html { redirect_to groups_url }\n end\n end",
"title": ""
},
{
"docid": "db3d5b2fda8983ae624eed2859200089",
"score": "0.5304225",
"text": "def auto_notify; end",
"title": ""
},
{
"docid": "4d508982c86d67f2394644c4f76a2a4e",
"score": "0.5280725",
"text": "def send_group_notification(gnoty, from_device_id = nil) \n return if !self.test_cert! \n unless gnoty.nil?\n self.send_gnoty(gnoty, nil, from_device_id) \n end\n end",
"title": ""
},
{
"docid": "e40072227878273ff73e035902ff207f",
"score": "0.5275249",
"text": "def given_to?(group)\n group.received?(self)\n end",
"title": ""
},
{
"docid": "2b32b660255c8c9c154a5b2272307385",
"score": "0.5262154",
"text": "def changed\n subscriber_ids = params[:subscriber_ids].split(\",\")\n subscriber_ids.each do |each|\n group = Group.find_by_id(each)\n group.refresh_from_spreedly if group\n end\n\n head(:ok)\n end",
"title": ""
},
{
"docid": "2d26a0458affae75f3939ffe4b033542",
"score": "0.52607125",
"text": "def send_changes(&block)\n\t\t\[email protected]_api '/groups/0/action', {scene: @id}.to_json, :groups, &block\n\t\tend",
"title": ""
},
{
"docid": "c94be499b8261014005b01f444a2e8b3",
"score": "0.5255312",
"text": "def shared=(value)\n @shared = value\n end",
"title": ""
},
{
"docid": "c94be499b8261014005b01f444a2e8b3",
"score": "0.5255312",
"text": "def shared=(value)\n @shared = value\n end",
"title": ""
},
{
"docid": "c94be499b8261014005b01f444a2e8b3",
"score": "0.5255312",
"text": "def shared=(value)\n @shared = value\n end",
"title": ""
},
{
"docid": "d25557a1b5725bacf830fa58ec0940d6",
"score": "0.5250814",
"text": "def groupinv_changed\n GroupinvMailer.groupinv_changed\n end",
"title": ""
},
{
"docid": "827c27acb6ed238bf9e248ab3bdf8646",
"score": "0.52441984",
"text": "def group(slave)\n slave.join(self)\n end",
"title": ""
},
{
"docid": "1d8051637c49a98ef858095be86cdc44",
"score": "0.52415997",
"text": "def invitation_to_share(shared_folder)\n @shared_folder = shared_folder #setting up an instance variable to be used in the email template\n mail( :to => @shared_folder.shared_email,\n :subject => \"#{@shared_folder.user.name} wants to share '#{@shared_folder.folder.name}' folder with you\" )\n end",
"title": ""
},
{
"docid": "e6063820fdc9359ff517685db4f9f3df",
"score": "0.52389336",
"text": "def notify\n case purpose\n when \"contest_winner_selected\"\n locale = notified.locale\n contest = self.contest\n category = contest.category\n ch = contest.owner\n MemberMailerWorker.perform_async(\n perform: :announcement_to_participants_after_winner_selected,\n member_locale: locale,\n ch_username: ch.username,\n ch_email: ch.email,\n ch_url: members_profile_url(locale, ch.username),\n designer_username: notified.username,\n designer_email: notified.email,\n designer_url: members_profile_url(locale, notified.username),\n contest_title: contest.title,\n contest_url: show_contest_url(locale, category.cname, contest.slug)\n )\n when \"ch_contest_ending_in_2_days\" \n locale = notified.locale\n contest = self.contest\n category = contest.category\n ch = contest.owner\n MemberMailerWorker.perform_async(\n perform: :ch_contest_ending_in_2_days,\n member_locale: locale,\n ch_username: ch.username,\n ch_email: ch.email,\n ch_url: members_profile_url(locale, ch.username),\n contest_title: contest.title,\n contest_url: show_contest_url(locale, category.cname, contest.slug),\n contest_id: contest.id.to_s\n )\n when \"ch_winner_pending_deadline_in_1_day\" \n locale = notified.locale\n contest = self.contest\n category = contest.category\n ch = contest.owner\n MemberMailerWorker.perform_async(\n perform: :ch_winner_pending_deadline_in_1_day,\n member_locale: locale,\n ch_username: ch.username,\n ch_email: ch.email,\n ch_url: members_profile_url(locale, ch.username),\n contest_title: contest.title,\n contest_url: show_contest_url(locale, category.cname, contest.slug),\n contest_id: contest.id.to_s\n )\n when \"ch_winner_pending_deadline_in_3_days\"\n locale = notified.locale\n contest = self.contest\n category = contest.category\n ch = contest.owner\n MemberMailerWorker.perform_async(\n perform: :ch_winner_pending_deadline_in_3_days,\n member_locale: locale,\n ch_username: ch.username,\n ch_email: ch.email,\n ch_url: members_profile_url(locale, ch.username),\n contest_title: contest.title,\n contest_url: show_contest_url(locale, category.cname, contest.slug),\n contest_id: contest.id.to_s\n )\n when \"designer_contest_ending_in_2_days\"\n locale = notified.locale\n contest = self.contest\n category = contest.category\n ch = contest.owner\n designer = notified\n MemberMailerWorker.perform_async(\n perform: :designer_contest_ending_in_2_days,\n member_locale: locale,\n ch_username: ch.username,\n ch_email: ch.email,\n ch_url: members_profile_url(locale, ch.username),\n contest_title: contest.title,\n contest_url: show_contest_url(locale, category.cname, contest.slug),\n contest_id: contest.id.to_s,\n designer_username: designer.username,\n designer_email: designer.email\n )\n when \"designer_contest_ending_in_24_hours\"\n locale = notified.locale\n contest = self.contest\n category = contest.category\n ch = contest.owner\n designer = notified\n MemberMailerWorker.perform_async(\n perform: :designer_contest_ending_in_24_hours,\n member_locale: locale,\n ch_username: ch.username,\n ch_email: ch.email,\n ch_url: members_profile_url(locale, ch.username),\n contest_title: contest.title,\n contest_url: show_contest_url(locale, category.cname, contest.slug),\n contest_id: contest.id.to_s,\n designer_username: designer.username,\n designer_email: designer.email\n )\n when \"designer_brief_updated\"\n locale = notified.locale\n contest = self.contest\n category = contest.category\n ch = contest.owner\n designer = notified\n MemberMailerWorker.perform_async(\n perform: :designer_brief_updated,\n member_locale: locale,\n contest_title: contest.title,\n contest_url: show_contest_url(locale, category.cname, contest.slug),\n contest_id: contest.id.to_s,\n designer_username: designer.username,\n designer_email: designer.email\n )\n when \"runner_up_approved\"\n locale = notified.locale\n contest = self.contest\n category = contest.category\n ch = contest.owner\n MemberMailerWorker.perform_async(\n perform: :runner_up_approved,\n member_locale: locale,\n ch_username: ch.username,\n ch_email: ch.email,\n ch_url: members_profile_url(locale, ch.username),\n contest_title: contest.title,\n contest_url: show_contest_url(locale, category.cname, contest.slug),\n contest_id: contest.id.to_s\n )\n end\n\n end",
"title": ""
},
{
"docid": "3225f082a32e415ba84bc0dd8e3d0e8f",
"score": "0.52253675",
"text": "def notify_appropriate_users\n if @assignment.user == @previous_owner\n @assignment.notify :owner, of: :changed_assignment, by: @current_user\n else\n @assignment.notify :owner, of: :new_assignment, by: @current_user\n @assignment.notify @previous_owner, of: :deleted_assignment,\n by: @current_user\n end\n end",
"title": ""
},
{
"docid": "852125ffbad30f38799ca9a69850a198",
"score": "0.52202755",
"text": "def handle_leave(client, group_name)\n\t\tgroup = get_group_by_name(group_name)\n\t\tresp = [\"Group \" + group_name +\n\t\t\t\" doesn't exist or you do not belong to that group.\"]\n\t\tif group and group.get_usernames.include? client.name.to_s\n\t\t\tgroup.clients.delete(client)\n\t\t\tresp = [\"Left group \" + group_name]\n\t\t\tnotification_string = client.name.to_s + \" left \" + group_name\n\t\t\tgroup.post(client, notification_string, notification_string)\n\t\tend\n\t\tclient.send(\"Server\", resp)\n\tend",
"title": ""
},
{
"docid": "e9c5520daa4205f1fc1bc38e300007ee",
"score": "0.5219312",
"text": "def broadcast\n @monitor.__send__(:mon_check_owner)\n @cond.broadcast\n end",
"title": ""
},
{
"docid": "1ed816d2eed7989dde522db3c2001945",
"score": "0.5218009",
"text": "def is_shared=(value)\n @is_shared = value\n end",
"title": ""
},
{
"docid": "1ed816d2eed7989dde522db3c2001945",
"score": "0.5218009",
"text": "def is_shared=(value)\n @is_shared = value\n end",
"title": ""
},
{
"docid": "949249ba5b850b013d19031c23bd7382",
"score": "0.52173084",
"text": "def deliver\n #prevent shares from being delivered twice\n return false unless self.sent_at.nil?\n\n # Create Email or post\n case service\n when 'email'\n emails = Group.flatten_emails(recipients) # flatten groups and emails into just emails\n emails.each do |recipient|\n Guest.register( recipient, 'share' ) #add recipient to guest list for beta period\n\n\n\n if album? && viewer_invite?\n ZZ::Async::Email.enqueue( :album_shared, self.user_id, recipient, self.subject_id, self.message )\n end\n\n if album? && contributor_invite?\n ZZ::Async::Email.enqueue( :contributor_added, self.subject_id, recipient, self.message )\n end\n\n\n if photo?\n ZZ::Async::Email.enqueue( :photo_shared, self.user_id, recipient, self.subject_id, self.message )\n end\n\n end\n when 'social'\n self.recipients.each do | service |\n user.send(\"identity_for_#{service}\").post_share( self )\n end\n end\n self.sent_at = Time.now\n\n # Create Share Activity\n if album?\n sa = ShareActivity.create( :user => self.user, :subject => self.subject, :share => self )\n self.subject.activities << sa\n elsif photo?\n sa = ShareActivity.create( :user => self.user, :subject => self.subject.album, :share => self )\n self.subject.album.activities << sa # Boil activities to the photo album\n elsif user?\n sa = ShareActivity.create( :user => self.user, :subject => self.subject, :share => self )\n self.subject.activities << sa\n end\n\n self.save\n true #return true\n end",
"title": ""
},
{
"docid": "548eae2e67db5827cb6b81e369913b1d",
"score": "0.52159345",
"text": "def transfer\n @group_to_transfer_to = Group.find params[:transfer_to] # TODO: add some security\n act_on_members do |gi|\n if gi.level == 'leader' && gi.group.leaders.count == 1\n @member_notices << \"Couldn't transfer #{gi.person.full_name}, since that would result in a leaderless group!\"\n elsif @group_to_transfer_to.people.detect{ |p| p == gi.person }\n @member_notices << \"#{gi.person.full_name} already in group #{@group_to_transfer_to.name}\"\n else\n gi.group = @group_to_transfer_to\n @member_notices << \"#{gi.person.full_name} transferred to #{@group_to_transfer_to.name}\"\n @levels_to_update << gi.level\n end\n end\n end",
"title": ""
},
{
"docid": "d4c14f60795574c656b8471aeeb2ec26",
"score": "0.5210161",
"text": "def notify\n if (can_notify?)\n update_attribute(:notified, true)\n station.owners.all.map do |owner|\n message = messages.create(\n level: event_type[:level],\n recipient: owner,\n body: event_type[:body] % station.attributes.symbolize_keys,\n mailer: StationMailer\n )\n message.send_mail!\n message\n end\n end\n end",
"title": ""
},
{
"docid": "13bc5fc4721cfb963c2ebd3bcb6ec7fa",
"score": "0.52038145",
"text": "def check_updated_permissions\n\t\tif self.permission_changed?\n\t\t\tSingleCellMailer.share_notification(self.study.user, self).deliver_now\n\t\tend\n\tend",
"title": ""
},
{
"docid": "efa4773893489e76cdcee5801233217c",
"score": "0.519909",
"text": "def shared_by\n return @shared_by\n end",
"title": ""
},
{
"docid": "b7b9a6a7515bbb52e8a0c654f9e023ac",
"score": "0.5190663",
"text": "def atest_ID_25874_user_follows_a_group_you_manage()\n login $user_1_email, $master_password\n read_all_updates\n groupName = create_any_new_group(\"Open Group\", \"News\")\n logout_common\n login $user_1_email, $master_password\n read_all_updates\n find_a_group(\"#{groupName}\")\n follow_a_group\n logout_common\n login $user_1_email, $master_password\n verify_updates\n end",
"title": ""
},
{
"docid": "c107ad4cbda0682d00ad285ba1bddca2",
"score": "0.5188854",
"text": "def notify_concierge(message)\n if message.author.concierge\n create_notification(message, message.author.concierge)\n end\n end",
"title": ""
},
{
"docid": "1de952b0799c19a8eab693dc2505d00d",
"score": "0.51826453",
"text": "def handle_post(client, message, subject, group_name)\n\t\tgroup = get_group_by_name(group_name)\n\t\tresp = [\"Group \" + group_name +\n\t\t\t\t\t \t\" doesn't exist or you do not belong to that group.\"]\n\t\tif group and group.get_usernames.include? client.name.to_s\n\t\t\tgroup.post(client, message, subject)\n\t\telse\n\t\t\tclient.send(\"Server\", resp)\n\t\tend\n\tend",
"title": ""
},
{
"docid": "453838f16547d97fea71a2d76b5a57ce",
"score": "0.5182526",
"text": "def notify\n {}\n end",
"title": ""
},
{
"docid": "453838f16547d97fea71a2d76b5a57ce",
"score": "0.5181848",
"text": "def notify\n {}\n end",
"title": ""
},
{
"docid": "453838f16547d97fea71a2d76b5a57ce",
"score": "0.5181848",
"text": "def notify\n {}\n end",
"title": ""
},
{
"docid": "453838f16547d97fea71a2d76b5a57ce",
"score": "0.5181848",
"text": "def notify\n {}\n end",
"title": ""
},
{
"docid": "453838f16547d97fea71a2d76b5a57ce",
"score": "0.5181848",
"text": "def notify\n {}\n end",
"title": ""
},
{
"docid": "453838f16547d97fea71a2d76b5a57ce",
"score": "0.5181848",
"text": "def notify\n {}\n end",
"title": ""
},
{
"docid": "453838f16547d97fea71a2d76b5a57ce",
"score": "0.5181848",
"text": "def notify\n {}\n end",
"title": ""
},
{
"docid": "3b7b28d3d08654d7ded380abfe1bf3ec",
"score": "0.51801556",
"text": "def sender_publishes_msg; sender.publish({ :ok => 1 }, {}) end",
"title": ""
},
{
"docid": "ba4a54071d91d7533c6d8fac829aa55b",
"score": "0.51790243",
"text": "def mentor_quit_notify(mentor)\n @mentor = mentor\n @group = mentor.group\n @coach = @group.admin\n mail to: @coach.email, subject: \"A mentor has chosen to leave your group.\"\n end",
"title": ""
},
{
"docid": "35579f7814074bea82010741b5f6bd01",
"score": "0.5172369",
"text": "def notify\n return {}\n end",
"title": ""
},
{
"docid": "3cee3eaae1bd887222218f2bdfd47a38",
"score": "0.51719534",
"text": "def sharing \n end",
"title": ""
},
{
"docid": "316c7248f8fe995eeb278f2bd814394f",
"score": "0.5169712",
"text": "def notify\n MemberMailerWorker.perform_async(member_id: self.employer.id.to_s, service_order_id: self.id.to_s, perform: :send_service_invoice_to_employer)\n TeamMailerWorker.perform_async(service_order_id: self.id.to_s, perform: :send_new_service_order)\n end",
"title": ""
},
{
"docid": "04c96ae424f2716c24bd8ef9e24a2f8a",
"score": "0.51692426",
"text": "def after_joining_group(callback)\n set_callback :join_group, :after, callback\n end",
"title": ""
},
{
"docid": "fc03399e5291c3109299e13aef7d261e",
"score": "0.51651615",
"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": "7e190f88bc18727ddb7877cadb79c4e8",
"score": "0.51635134",
"text": "def notifies\n end",
"title": ""
},
{
"docid": "7dc42f4ea29775e1ed68bc53eb56b286",
"score": "0.5162114",
"text": "def notify_clients(msg)\n synchronize do\n begin\n site_subs = @subscriptions[msg.site_id]\n subscription = site_subs[msg.channel] if site_subs\n\n return unless subscription\n\n subscription.each do |client_id|\n client = @clients[client_id]\n if client && client.allowed?(msg)\n begin\n client.synchronize do\n client << msg\n end\n rescue\n # pipe may be broken, move on\n end\n # turns out you can delete from a set while iterating\n remove_client(client) if client.closed?\n end\n end\n rescue => e\n @bus.logger.error \"notify clients crash #{e} : #{e.backtrace}\"\n end\n end\n end",
"title": ""
},
{
"docid": "c341164e94579d3b029edc56090a955b",
"score": "0.5158638",
"text": "def notify\n @notify\n end",
"title": ""
},
{
"docid": "73903bc6b5bf19df892008eb946f92ca",
"score": "0.51567435",
"text": "def notify\n #nop\n end",
"title": ""
},
{
"docid": "68a167741971f402204a409f929a1514",
"score": "0.51463026",
"text": "def notify\n @notify\n end",
"title": ""
},
{
"docid": "ac2ee0409bf514cb5b1aaf73a9ab145f",
"score": "0.51193506",
"text": "def notify\n case purpose\n when \"ch_comment_file_transfer\"\n locale = notified.locale\n ch = workspace.client\n contest = workspace.contest\n category = contest.category\n\n MemberMailerWorker.perform_async(\n perform: :ch_comment_file_transfer,\n member_locale: locale,\n ch_username: ch.username,\n ch_email: ch.email,\n ch_url: members_profile_url(locale, ch.username),\n designer_username: notified.username,\n designer_email: notified.email,\n designer_url: members_profile_url(locale, notified.username),\n comment_body: workspace.events.last.body,\n contest_title: contest.title,\n contest_url: show_contest_url(locale, category.cname, contest.slug),\n workspace_id: workspace.id.to_s\n )\n when \"designer_comment_file_transfer\"\n locale = notified.locale\n designer = workspace.designer\n contest = workspace.contest\n category = contest.category\n\n MemberMailerWorker.perform_async(\n perform: :designer_comment_file_transfer,\n member_locale: locale,\n ch_username: notified.username,\n ch_email: notified.email,\n ch_url: members_profile_url(locale, notified.username),\n designer_username: designer.username,\n designer_email: designer.email,\n designer_url: members_profile_url(locale, designer.username),\n comment_body: workspace.events.last.body,\n contest_title: contest.title,\n contest_url: show_contest_url(locale, category.cname, contest.slug),\n workspace_id: workspace.id.to_s\n )\n when \"designer_upload_file_master\"\n locale = notified.locale\n designer = workspace.designer\n contest = workspace.contest\n category = contest.category\n\n MemberMailerWorker.perform_async(\n perform: :designer_upload_file_master,\n member_locale: locale,\n ch_username: notified.username,\n ch_email: notified.email,\n ch_url: members_profile_url(locale, notified.username),\n designer_username: designer.username,\n designer_email: designer.email,\n designer_url: members_profile_url(locale, designer.username),\n comment_body: workspace.events.last.body,\n contest_title: contest.title,\n contest_url: show_contest_url(locale, category.cname, contest.slug),\n workspace_id: workspace.id.to_s\n )\n end\n end",
"title": ""
},
{
"docid": "c33af4517f1eb9a990afea491a0be244",
"score": "0.51082176",
"text": "def after_share_user\n ZZ::Async::DeliverShare.enqueue( self.id )\n end",
"title": ""
},
{
"docid": "c5ffb7a3997f7c70db4d761b2698747d",
"score": "0.51027143",
"text": "def test_shared_lives_on_merge\n Stone.play_at(@goban, 3, 2, WHITE)\n s1=Stone.play_at(@goban, 4, 2, WHITE)\n assert_equal(6, s1.group.lives)\n s2=Stone.play_at(@goban, 3, 4, WHITE)\n assert_equal(4, s2.group.lives)\n Stone.play_at(@goban, 4, 4, WHITE)\n assert_equal(6, s2.group.lives)\n s3=Stone.play_at(@goban, 4, 3, WHITE)\n assert_equal(10, s3.group.lives)\n Stone.undo(@goban)\n assert_equal(6, s1.group.lives)\n assert_equal(6, s2.group.lives)\n Stone.undo(@goban)\n assert_equal(4, s2.group.lives)\n # @goban.debug_display\n end",
"title": ""
},
{
"docid": "d82727e217802438953cf46a664d9195",
"score": "0.51025164",
"text": "def to_update_broadcast_group_ids(updated_group_ids)\n self.skip_callback = true\n self.scheduled_message.update_attribute(:group_ids, updated_group_ids) if self.is_scheduled_post?\n self.update_attribute(:broadcast_group_ids, updated_group_ids)\n if self.smpp_alert.present?\n self.smpp_alert.update_attribute(:group_ids, updated_group_ids)\n self.smpp_alert.scheduled_text.update_attribute(:group_ids, updated_group_ids) if self.smpp_alert.scheduled_text.present?\n end\n end",
"title": ""
}
] |
67cde22e54b159919113139da5d4b67d
|
This method is used to get progress of an process. It will find model name based on its id and return percentage of this input Args : +id+ > id of the input record Returns : 1 if failure if success Written: DuongDN Date: Aug 22, 2012 Modified: Date:
|
[
{
"docid": "dfe047c955138f820b80b3c1cdb2968a",
"score": "0.6494727",
"text": "def get_percent_of_input\n input_id = params[:id]\n begin\n input = Input.find(:first,:conditions => ['id = ? and status <> ?', input_id,Input::KILLED])\n value = input.percentage \n rescue \n value = -1\n end\n render :text => value\n end",
"title": ""
}
] |
[
{
"docid": "450ba8bfce7548cd423d2dfe52d5b03f",
"score": "0.7055463",
"text": "def task_progress (id) \n\t\t\txr=task_get_raw(\"task_id\"=>id,\"details\"=>0)\n\t\t\txr.elements.each('//get_tasks_response/task') do |task|\n\t\t\t\treturn task.elements[\"progress\"].text.to_i()\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "11eb5832ef9ddc705f525d96ce0326bf",
"score": "0.7029963",
"text": "def get_progress id\n call! :get_progress, id\n end",
"title": ""
},
{
"docid": "4a2305806be8d553ff0c743cb948f14a",
"score": "0.6373358",
"text": "def execute\n puts \"%s Progress: %0.2f\" % [@po.get_name, @po.get_progress]\n end",
"title": ""
},
{
"docid": "8ef30f443bbe1c9de446d91243f0e358",
"score": "0.6356127",
"text": "def progress(id)\n job = Shingoncoder::Backend::JobRegistry::Job.find(id)\n Response.new('body' => id, 'code' => 200)\n end",
"title": ""
},
{
"docid": "13e00839d9197506f414f1b2f3a9a572",
"score": "0.62893385",
"text": "def progress\n dump_round_vars 'Entering progress()'\n public_user(params[:id])\n\n results = Result.retrieve_my_progress(params[:id])\n\n @all_results = results['all']\n @year_results = results['year']\n @month_results = results['month']\n @week_results = results['week']\n @day_results = results['day']\n @hour_results = results['hour']\n end",
"title": ""
},
{
"docid": "8a520db975ba3d68b62821e14fd0707f",
"score": "0.6169012",
"text": "def progress\n cnt_statuses = Status.where(\"selection_order is not null\").count;\n cnt_status_progress = Status.where(\"selection_order is not null\").where(\"selection_order <= \" + self.status.selection_order.to_s).count\n return 100*(cnt_status_progress.to_f/cnt_statuses.to_f)\n end",
"title": ""
},
{
"docid": "c044ef188275d2dcf8a572ea0a867875",
"score": "0.616559",
"text": "def progress\n @data[:progress]\n end",
"title": ""
},
{
"docid": "31f8cf498b44938f3260b22dabac6df7",
"score": "0.6090292",
"text": "def percent_progress\n data[:percent_progress]\n end",
"title": ""
},
{
"docid": "31f8cf498b44938f3260b22dabac6df7",
"score": "0.6090292",
"text": "def percent_progress\n data[:percent_progress]\n end",
"title": ""
},
{
"docid": "31f8cf498b44938f3260b22dabac6df7",
"score": "0.6090292",
"text": "def percent_progress\n data[:percent_progress]\n end",
"title": ""
},
{
"docid": "830a341c459a0921fd60240529755f88",
"score": "0.6084218",
"text": "def progress\n if self.new_record?\n progress = 0\n self.goal.deps.each do |dep|\n dep = dep.status(user_id)\n progress += dep.value if dep.completed\n end\n else\n progress = self.value\n end\n\n progress\n end",
"title": ""
},
{
"docid": "f345ec4facf64745190969ef8631df35",
"score": "0.6071792",
"text": "def progress\n data[:progress]\n end",
"title": ""
},
{
"docid": "0330eb447d578b0ca58180cea223d88b",
"score": "0.60609126",
"text": "def progress\n @progress\n end",
"title": ""
},
{
"docid": "ffbcc971eb896ada0b4a8c1468377d35",
"score": "0.6007218",
"text": "def percent_progress\n return @percent_progress\n end",
"title": ""
},
{
"docid": "e646cb380415242ad2cde5d7ceb2904d",
"score": "0.5988917",
"text": "def set_progress\n @progress = Progress.find(params[:id])\n end",
"title": ""
},
{
"docid": "e646cb380415242ad2cde5d7ceb2904d",
"score": "0.5988917",
"text": "def set_progress\n @progress = Progress.find(params[:id])\n end",
"title": ""
},
{
"docid": "e646cb380415242ad2cde5d7ceb2904d",
"score": "0.5988917",
"text": "def set_progress\n @progress = Progress.find(params[:id])\n end",
"title": ""
},
{
"docid": "e820318d6746e794eee2090b532e5565",
"score": "0.59492874",
"text": "def percentage_progress\n progress = progress_for_all_activities.reject{ |k,v| v == :skipped }\n completed = progress.values.count {|state| state == :complete }\n return (completed.to_f / progress.values.length.to_f * 100).to_i \n end",
"title": ""
},
{
"docid": "8f6e7caeb6289a3ed3a2ab2dff9f960a",
"score": "0.5943108",
"text": "def get_progress(user)\n\t\tInteger(num_completed(user).fdiv(total_sentences) * 100)\n\tend",
"title": ""
},
{
"docid": "40b0fd9ac583c3563eca84bfd9791b50",
"score": "0.59406585",
"text": "def progress\n i = @fich ? @fich : ''\n if !@read[i].nil? && !@size[i].nil?\n return 100 if @size[i] <= 0\n return @read[i].to_f/@size[i]*100\n end\n return 0\n end",
"title": ""
},
{
"docid": "b19cf590dccced0d3da7949eef578c0e",
"score": "0.59390104",
"text": "def get_progress\n res = 0\n if not done()\n @mutex.synchronize do\n res = @progress\n end\n else\n res = 100\n end\n res\n end",
"title": ""
},
{
"docid": "b77446506e69571b4efb87e013fc7b3a",
"score": "0.5938403",
"text": "def progress\n\t\t@progress\n\tend",
"title": ""
},
{
"docid": "b1144b15a091f8ffd2f517d43eebe311",
"score": "0.59376276",
"text": "def show\n thr = ObjectSpace._id2ref(params[:id].to_i)\n @progress_status = thr[\"progress\"]\n \n render json: @progress_status\n end",
"title": ""
},
{
"docid": "a9bccf0e272fa6e01b9f69184f5c871c",
"score": "0.5918925",
"text": "def progress\n (100.0 * order.hash_done / @order.hash_to_do).round(0)\n end",
"title": ""
},
{
"docid": "3fa45263bf24ba1f2fc88e7e92eba7d8",
"score": "0.5908533",
"text": "def progress\n response[\"progress\"]\n end",
"title": ""
},
{
"docid": "0acc8c688f055550dedb705b7110e9bc",
"score": "0.5907322",
"text": "def transfer_status(transfer_id)\n begin\n f = File.open(\"/tmp/uploader_file-#{transfer_id}\", 'r')\n info = JSON.parse f.readline\n f.close\n \n if File.exist?(info['path'])\n current_size = File.size(info['path'])\n percent = (current_size.to_f/info['size'].to_f)*100\n elsif File.exist?(settings.upload_folder + '/' + filename_in_transfer(transfer_id))\n percent = 100\n else\n percent = 0\n end\n rescue Exception => e\n percent = 0\n end\n percent.to_i\n end",
"title": ""
},
{
"docid": "1952d73237c5441bdc42ba46da7683e1",
"score": "0.5895648",
"text": "def set_pm_progress\n @pm_progress = Pm::Progress.find(params[:id])\n end",
"title": ""
},
{
"docid": "55b3273cb28d20f08f7e8feae4d47337",
"score": "0.5886896",
"text": "def progress\n begin\n current_progress = (current_count.to_f / total_count.to_f * 100).to_i\n\n #Handle an incorrect total_count...\n current_progress = 100 if current_progress > 100\n rescue\n #what, are you diving by zero?\n current_progress = 0\n end\n\n current_progress\n end",
"title": ""
},
{
"docid": "6c1d61b4e7c0f79ef71e05be48c64875",
"score": "0.5881013",
"text": "def progress\n return @progress\n end",
"title": ""
},
{
"docid": "287cd0402308e854e47adc536d6d3244",
"score": "0.58799857",
"text": "def get_progress\n numerator =\n case unit\n when Target.units[:submissions]\n conference.program.events.where('created_at < ?', due_date).count\n when Target.units[:registrations]\n conference.registrations.where('created_at < ?', due_date).count\n when Target.units[:program_minutes]\n conference.current_program_minutes\n else\n 0\n end\n\n (100 * numerator / target_count).to_s\n end",
"title": ""
},
{
"docid": "ad22bd64dfe447e8cc2257f51600f630",
"score": "0.5862539",
"text": "def update_progress\n if @model && defined?(@model.remote_progress_proc) #only exec if this method is defined\n @model.remote_progress_proc(@file_channel)\n else\n Proc.new {}\n end\n end",
"title": ""
},
{
"docid": "4d3c054354fc71cbfe413e8628d69065",
"score": "0.5859031",
"text": "def run_progress\n if counts_set? && total_count > 0\n sum = output.values_at(:success_count, :cancelled_count, :failed_count).reduce(:+)\n sum.to_f / total_count\n else\n 0.1\n end\n end",
"title": ""
},
{
"docid": "be48136e61e8bd2f51961d47f43fac32",
"score": "0.5853257",
"text": "def progress\n Tasks.progress\n end",
"title": ""
},
{
"docid": "ea13d964a654a26dc1c6f52f0eec8f55",
"score": "0.5841775",
"text": "def calculate_progress\n self.material_total = 0\n self.material_done = 0\n self.action_total = 0\n self.action_done = 0\n self.material_study_progresses.each do |material|\n if material.parent_id.nil?\n self.material_total += 1\n if material.status.eql?ProgressType::DONE\n self.material_done += 1\n end\n end\n end\n\n self.action_total = self.action_study_progresses.size()\n self.action_study_progresses.each do |action|\n if action.status.eql?ProgressType::DONE\n self.action_done += 1\n end\n end\n end",
"title": ""
},
{
"docid": "58be06d9cb6fea3c7cefb850628a65c6",
"score": "0.5834454",
"text": "def job_progress(args = { })\n identifier = args[:identifier]\n query = { 'identifier' => identifier }\n do_get('ActionGetJobProgress', :query => query)\n end",
"title": ""
},
{
"docid": "17a6b0d9810438d5fa87024bb094173e",
"score": "0.5824413",
"text": "def percentage\n return 100 if status_name == :done\n return 0 if status_name == :new\n\n status_hash.pct_complete\n end",
"title": ""
},
{
"docid": "c243f965bbc64228caab95d5f61da8eb",
"score": "0.58157337",
"text": "def get_progress_percentage\n progress = 1\n self.paid ? progress = progress + 33 : progress\n self.reconciled ? progress = progress + 33 : progress\n self.documented ? progress = progress + 33 : progress\n\n return progress\n end",
"title": ""
},
{
"docid": "71fbb5b6e0983631682a81a6c5a68c75",
"score": "0.5814485",
"text": "def progress\n self.valid?\n errors_count = self.errors.count\n progress = ( (ActiveListing::FINISHED_COUNT - errors_count).to_f / ActiveListing::FINISHED_COUNT.to_f * 100 ).to_i\n if progress == 0\n progress = 3\n end\n return progress\n end",
"title": ""
},
{
"docid": "df5c32b6f4ad661d977278a46c30b735",
"score": "0.5806038",
"text": "def calculate_progress\n result = progress_status\n (100 * result.values.count(true) / result.values.compact.count).to_s\n end",
"title": ""
},
{
"docid": "215462335b766bf2b7ba7228b2304f98",
"score": "0.5804672",
"text": "def get_progress(total, value)\n \t (value.to_i * 100 / total.to_i) - 10\n end",
"title": ""
},
{
"docid": "8f5a35eda25e707dcd6084c2860717d8",
"score": "0.5791779",
"text": "def progress\n self.valid?\n errors_count = self.errors.count\n progress = (ValidProfile::FINISHED_COUNT - errors_count).to_f / ValidProfile::FINISHED_COUNT.to_f * 100\n return progress.to_i\n end",
"title": ""
},
{
"docid": "1e44ec91612b4af9607cb4a966a78471",
"score": "0.577465",
"text": "def progress\n self.valid?\n errors_count = self.errors.count\n progress = (ProfileProgress::FINISHED_COUNT - errors_count).to_f / ProfileProgress::FINISHED_COUNT.to_f * 100\n return progress.to_i\n end",
"title": ""
},
{
"docid": "419fae52e3adb231baf67f3e804e2519",
"score": "0.5772064",
"text": "def progress; @progress; end",
"title": ""
},
{
"docid": "419fae52e3adb231baf67f3e804e2519",
"score": "0.5772064",
"text": "def progress; @progress; end",
"title": ""
},
{
"docid": "784708592f2713acddbc14565c88edfe",
"score": "0.5745677",
"text": "def calculate_progress\n\n @workflow_steps_data_map.each do |workflow_id,kind_to_data_map|\n percentage_completed = 3 # loaders starting from 3%\n\n workflow_kind = @workflow_data_map[workflow_id][:kind]\n r = fetch_economy_setup_config(workflow_kind)\n return r unless r.success?\n\n display_text = ''\n display_name = ''\n all_steps = {}\n @step_config.each do |step|\n step_group_display_text = @group_config[step['group']]['display_text']\n step_group_name = @group_config[step['group']]['name']\n\n all_steps[step['group']] ||= {\n display_text: step_group_display_text,\n name: step_group_name,\n status: @workflow_data_map[workflow_id].status\n }\n\n if kind_to_data_map[step['kind']]\n if kind_to_data_map[step['kind']].status == GlobalConstant::WorkflowStep.processed_status\n percentage_completed = percentage_completed + step['weight']\n end\n\n display_text = step_group_display_text\n display_name = step_group_name\n end\n end\n\n @response_data[workflow_id] = {\n current_step: {\n display_text: display_text,\n name: display_name,\n percent_completion: percentage_completed,\n status: @workflow_data_map[workflow_id].status\n },\n all_steps: all_steps.values\n }\n end\n\n success\n end",
"title": ""
},
{
"docid": "20a430ec1188b449bfe0768a037da849",
"score": "0.57413083",
"text": "def task_progress(task_name)\n path = \"/projects/#{project.name}/instances/#{name}\"\n query = { instanceprogress: true, taskname: task_name }\n client.get(path, query: query).parsed_response['Progress']\n end",
"title": ""
},
{
"docid": "43419a1dc920ca032acd9ed0e9fe6265",
"score": "0.5737368",
"text": "def progress\n render :update do |page|\n @status = Mongrel::Uploads.check(params[:upload_id])\n page.upload_progress.update(@status[:size], @status[:received]) if @status\n end\n end",
"title": ""
},
{
"docid": "43419a1dc920ca032acd9ed0e9fe6265",
"score": "0.5737368",
"text": "def progress\n render :update do |page|\n @status = Mongrel::Uploads.check(params[:upload_id])\n page.upload_progress.update(@status[:size], @status[:received]) if @status\n end\n end",
"title": ""
},
{
"docid": "4aaa881f488b1d89a6493f6eaf260ff3",
"score": "0.57342285",
"text": "def getProgress( topicId )\n\n # parameter TypeCheck\n #BIMserverAPI::TypeCheck::Long( topicId )\n\n # BIMserver request\n request( { topicId: topicId } )\n end",
"title": ""
},
{
"docid": "66d9ab817ab3e733a48dcbc2cc4a5da6",
"score": "0.5710531",
"text": "def get_progress(task_name)\n res = ODPS.conn.get \"projects/#{ODPS.current_project}/instances/#{self.name}?instanceprogress&taskname=#{task_name}\"\n progress = []\n REXML::XPath.each(REXML::Document.new(res.body), '/Progress/Stage') do |element|\n stage = Stage.new.deserialize(element)\n stage.id = element.attribute['ID'].value\n progress << stage\n end\n self.progress = progress\n progress\n end",
"title": ""
},
{
"docid": "1db60ed0034d4ea0a30c5f3978145e80",
"score": "0.57031655",
"text": "def set_progression\n @progression = Progression.find(params[:id])\n end",
"title": ""
},
{
"docid": "1db60ed0034d4ea0a30c5f3978145e80",
"score": "0.57031655",
"text": "def set_progression\n @progression = Progression.find(params[:id])\n end",
"title": ""
},
{
"docid": "1db60ed0034d4ea0a30c5f3978145e80",
"score": "0.57031655",
"text": "def set_progression\n @progression = Progression.find(params[:id])\n end",
"title": ""
},
{
"docid": "32fce0335c7969785ee6f59bbdd4109a",
"score": "0.5701694",
"text": "def sync_progress\n response = block_count\n\n count = response[:count].to_i\n unchecked = response[:unchecked].to_i\n total = count + unchecked\n\n count.to_f * 100 / total.to_f\n end",
"title": ""
},
{
"docid": "eeda0eabdef77e7fba164712e3776b95",
"score": "0.5701247",
"text": "def get_progress\n account_params = ValidProfile.get_validation_params(self)\n valid_account = ValidProfile.new(account_params)\n valid_account.progress\n end",
"title": ""
},
{
"docid": "9c9262177274b07ef60dcda7725be09d",
"score": "0.5668734",
"text": "def progress\n # Capture batch state\n state = batch_state\n\n # Sum batch progress of current batch and all sub-batches\n state.to_h.reduce(BatchProgress.new(state)) do |memo, (child_id, child_status)|\n memo + (self.class.find(child_id)&.progress || BatchProgress.new(child_id => child_status))\n end\n end",
"title": ""
},
{
"docid": "e7caf35f7bcce898b31e8fdf67751b77",
"score": "0.56541824",
"text": "def progress\n (PROGRESS_FIELDS.reject{ |f| send(f).blank? }.count.to_f/\n PROGRESS_FIELDS.count.to_f*100).ceil\n end",
"title": ""
},
{
"docid": "23d79e5ea41cbf157234729670c42372",
"score": "0.56507283",
"text": "def update_progress\n\n set_task\n @task.completed_flag = params[:completed] == \"1\"\n @task.percentage_completed = params[:progress].to_i\n @task.save(validate: false)\n\n update = Update.new\n update.myuser = logged_in_user_helper\n update.task=@task\n update.completed_flag = @task.completed_flag\n update.percentage_completed = @task.percentage_completed\n update.comments = params[:comments]\n update.percentage_time_passed = (Time.now - @task.start_date) / (@task.end_date - @task.start_date)*100\n\n update.save(validate: false)\n redirect_to root_path\n\n end",
"title": ""
},
{
"docid": "90578eec8671abc4f3e3048c753056d6",
"score": "0.56320804",
"text": "def display_progress\n return 100 if source.successful? || source.progress > 100\n return 8 if source.progress > 0 and source.progress < 8\n source.progress\n end",
"title": ""
},
{
"docid": "90578eec8671abc4f3e3048c753056d6",
"score": "0.56320804",
"text": "def display_progress\n return 100 if source.successful? || source.progress > 100\n return 8 if source.progress > 0 and source.progress < 8\n source.progress\n end",
"title": ""
},
{
"docid": "882c60191a98d0378698d60ac7b37742",
"score": "0.56196535",
"text": "def set_progress_status\n @progress_status = ProgressStatus.find(params[:id])\n end",
"title": ""
},
{
"docid": "c97953e59db6c8f32957f2326d2a4cca",
"score": "0.5569477",
"text": "def describe_progress\n num_queries = @queries.size\n num_matched = @queries.count { |query| query.done? }\n \".. Matched #{num_matched}/#{num_queries} with #{progress_hash.to_s}\"\n end",
"title": ""
},
{
"docid": "3cc0d57d55ea71e6bdc94f4e7f759560",
"score": "0.551946",
"text": "def percent_progress\n ((@last_measure.value.to_i - @baseline.to_i).to_f /\n (@target.to_i - @baseline.to_i).to_f * 100)\n end",
"title": ""
},
{
"docid": "bcc9b8430a72f478b116b276ebed3b0e",
"score": "0.55038196",
"text": "def progress_bar(task_object,user_object)\n task_this = task_object.position-1\n task_count = task_object.episode.tasks.length\n #logger.info(task_this.inspect)\n #logger.info(task_count.inspect)\n task_percentage = ((task_this.to_f/task_count.to_f)*100).round\n return task_percentage\n end",
"title": ""
},
{
"docid": "23687e5f04d856dedf774c359b14d26d",
"score": "0.5501511",
"text": "def mint_progress\n get('progress', {})\n end",
"title": ""
},
{
"docid": "c5b8ee0a8cfea7de5ddce41f5cbc8151",
"score": "0.54845184",
"text": "def progress\n @iterator / total()\n end",
"title": ""
},
{
"docid": "47f3acb3909142818e79bd40d2bd4277",
"score": "0.54462636",
"text": "def progress(page)\n current_page = page.sequence_id\n total_pages = page.subject.pages.count\n progress = current_page / total_pages * 100\n return progress\n end",
"title": ""
},
{
"docid": "3abdc4b2aa9f514624640949de518df6",
"score": "0.5434875",
"text": "def progress(result)\n\n # Only allow progress if it is a procedure and the client set \"receive_progress\"\n if command.to_sym == :procedure and self.details[:receive_progress]\n\n # Get the request ID\n request = self.details[:request]\n\n # Send the data back to the\n self.session.yield request, result, { progress: true }, self.background\n end\n\n end",
"title": ""
},
{
"docid": "f0e63e72977eb509a44dd00df3824ccc",
"score": "0.5422165",
"text": "def requirement_progress\n puts \"****************** progress for #{self.fullname} ********************\"\n @progress_number=0\n #this method is used to make sure all of the necessary requirements for a person are met before reservations take place. \n #It probably should keep invoices from being paid for if the information is incorrect.\n # 10% basic name/gender/birthday info\n @progress_number = person_basics_complete? ? @progress_number + 10 : @progress_number\n # 10% one valid address\n @progress_number = person_has_valid_address? ? @progress_number + 10 : @progress_number \n # 10% at least one person organization\n @progress_number = person_has_organization? ? @progress_number + 10 : @progress_number \n # 10% at least one person email\n @progress_number = person_has_email? ? @progress_number + 10 : @progress_number\n # 10% at least one parent/guardian contact\n @progress_number = person_has_parent? ? @progress_number + 10 : @progress_number\n # 10% at least two emergency contact (in case parent can't be reached)\n @progress_number = person_has_emergency_contact? ? @progress_number + 10 : @progress_number\n # 10% at least one contact must have insurance information, this is the emergency room contact\n @progress_number = person_has_contact_with_insurance? ? @progress_number + 10 : @progress_number\n # 10% at least one email for each parent/guardian/emergency contact\n @progress_number = person_important_contacts_have_email? ? @progress_number + 10 : @progress_number\n # 10% at least 2 phone numbers on every contact\n @progress_number = person_contacts_have_phones? ? @progress_number + 10 : @progress_number\n # 10% at least Two pickup person\n @progress_number = person_has_pickup? ? @progress_number + 10 : @progress_number\n\n puts\"#{@progress_number}\"\n @progress_number\n end",
"title": ""
},
{
"docid": "581814321e4fdee123c01375a0b4b56d",
"score": "0.5417821",
"text": "def update\n @progress = @task.progresses.find(params[:id])\n\n respond_to do |format|\n if @progress.update_attributes(params[:progress])\n format.html { redirect_to task_progress_path(@task, @progress), notice: 'Progress was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @progress.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c6e665114742afc008e4fd15019a0a9b",
"score": "0.54120016",
"text": "def progress(status)\n end",
"title": ""
},
{
"docid": "b2aa0d5d6558c6b0502d57447e55d882",
"score": "0.54053354",
"text": "def check_job_progress\n job_id = request[\"job_id\"].to_i\n Ramaze::Log.debug \"update requested for #{job_id}\"\n \n # Look for job status updates for up to 60 seconds\n 60.times do\n progress = JOB_MANAGER.query_status(job_id)\n\n # Return progress info only if we have a new update to report on\n if progress.nil?\n Ramaze::Log.debug \"Waiting for data...\"\n sleep 1\n else\n Ramaze::Log.debug \"percent done: #{progress[:progress_percent].to_i}\"\n \n # report status as finished when the job is completed\n if progress[:job_finish]\n return {:progress_text => \"finished.\", :progress_status => \"finished\"}.to_json\n\n # otherwise report the percent done as the job status \n else\n return {:progress_text => progress[:progress_text].gsub(' ', ' '), \n :progress_status => progress[:progress_percent]}.to_json\n end\n end\n end\n\n Ramaze::Log.debug \"(timeout waiting for job updates)\"\n Ramaze::Log.warn \"Is the job processor running?\" \n {:progress_text => 'waiting...(is the job processor running??)', :progress_status => \"timeout\"}.to_json\n end",
"title": ""
},
{
"docid": "460614b99eb8f2e5ea7f2e36dd9a3388",
"score": "0.540448",
"text": "def get_progress\n elapsed_time = Time.now - @begin_scan_time\n nbr_bytes_scanned = nil\n @progress_mutex.synchronize do\n nbr_bytes_scanned = @nbr_bytes_scanned\n end\n total_time = (nbr_bytes_scanned == 0) ? 0 : (elapsed_time*@nbr_bytes_to_scan)/nbr_bytes_scanned\n return @nbr_bytes_to_scan, nbr_bytes_scanned + @nbr_bytes_partial_file_scanned, total_time, elapsed_time\n end",
"title": ""
},
{
"docid": "3c7e30af05ee048ddf05c19e0aeb3e1a",
"score": "0.53760934",
"text": "def progress\n progress_in_system = (100 * self.total_accepted_questions.to_f/Question.all.count).round(2)\n return progress_in_system\n end",
"title": ""
},
{
"docid": "f1835ae177eabd8949837f1156bfb498",
"score": "0.5372557",
"text": "def progress; end",
"title": ""
},
{
"docid": "f1835ae177eabd8949837f1156bfb498",
"score": "0.5372557",
"text": "def progress; end",
"title": ""
},
{
"docid": "f1835ae177eabd8949837f1156bfb498",
"score": "0.5372557",
"text": "def progress; end",
"title": ""
},
{
"docid": "f1835ae177eabd8949837f1156bfb498",
"score": "0.5372557",
"text": "def progress; end",
"title": ""
},
{
"docid": "f1835ae177eabd8949837f1156bfb498",
"score": "0.5372557",
"text": "def progress; end",
"title": ""
},
{
"docid": "f1835ae177eabd8949837f1156bfb498",
"score": "0.5372557",
"text": "def progress; end",
"title": ""
},
{
"docid": "f1835ae177eabd8949837f1156bfb498",
"score": "0.5372557",
"text": "def progress; end",
"title": ""
},
{
"docid": "5088fad7a36e8f4e9839fa1c2373883b",
"score": "0.53721005",
"text": "def progress\n [@num_output, @num_input]\n end",
"title": ""
},
{
"docid": "51ec23dd90daec63f2c97094ada62c1c",
"score": "0.53546095",
"text": "def progress_text\n return \"\" unless @track_id\n \"#{format_seconds(@seconds)} / #{format_seconds(@length)}\"\n end",
"title": ""
},
{
"docid": "234319ed513a27eecd1a0162387bf0fa",
"score": "0.53344595",
"text": "def display_progress\n return 100 if successful? || progress > 100\n return 8 if progress > 0 and progress < 8\n progress\n end",
"title": ""
},
{
"docid": "921ed2e7797f3164794d2186b3f853ab",
"score": "0.533017",
"text": "def progress\n return self.score % 10 * 10\n end",
"title": ""
},
{
"docid": "1b9444bd129c8228c5636c368cbffd00",
"score": "0.5323213",
"text": "def progress_params\n params.require(:progress).permit(:project_id, :curriculum_id, :lesson, :process, :progress_type_id, :status)\n end",
"title": ""
},
{
"docid": "6f075bb57b2e3ab3747f89143e3ddee2",
"score": "0.5321233",
"text": "def progress_description\n response[\"progressDescription\"]\n end",
"title": ""
},
{
"docid": "43a49a03c91d905db0ded03fa892613b",
"score": "0.53143936",
"text": "def progress\n task_progress = get_nodes(\"Progress\").first\n return task_progress.content unless task_progress.nil?\n nil\n end",
"title": ""
},
{
"docid": "40ee6221e8aab8eecf3374592d0ce067",
"score": "0.53125775",
"text": "def update_progress\n if request.post?\n @task.progress = params[:progress]\n remark = params[:remark]\n if !remark.present?\n @task.errors.add('remark', \"not be blank\")\n end\n \n if @task.errors.empty?\n @task.save\n @task.log(\"gns_project.log.task.update_progress\", current_user, remark)\n \n render json: {\n status: 'success',\n message: 'Task progress has been updated.',\n }\n end\n end\n end",
"title": ""
},
{
"docid": "4df9353bd747a4591553016778ea8ae5",
"score": "0.53111774",
"text": "def success_percentage\n\t\tif all_calls.any?\n\t\t\tsuccess_calls = all_calls.where(:call_status_id => 1).count\n\t\t\t#total_calls = Call.all.count\n\t\t\t@percentage = ((success_calls.to_f / all_calls.count.to_f)*100).floor\n\t\telse\n\t\t\t@percentage = 0\n\t\tend\n\tend",
"title": ""
},
{
"docid": "918b54426f1b5855c5deb197e0a1be97",
"score": "0.5303905",
"text": "def getPIDMetrics(iPID)\n rCPUPercent = nil\n rMemPercent = nil\n rVS = nil\n\n # From top\n lTopOutput = `top -n1 -p#{iPID} -b | tail -2 | head -1`.strip\n lMatch = lTopOutput.match(/^\\d+\\s+\\S+\\s+\\d+\\s+\\d+\\s+\\S+\\s+(\\S+)\\s+\\d+\\s+\\S+\\s+(\\S+)\\s+(\\S+)\\s+\\S+\\s+.+$/)\n if (lMatch == nil)\n report \"Unable to decode top output for PID #{iPID}: \\\"#{lTopOutput}\\\"\"\n else\n # Convert RES column to integer\n rRESValue = quantity2Int(lMatch[1])\n rCPUPercent, rMemPercent = lMatch[2..3].map { |iStrValue| iStrValue.to_f }\n end\n # From proc/<PID>/stat\n lStatOutput = `cat /proc/#{iPID}/stat`.strip\n lMatch = lStatOutput.match(/^\\d+\\s+\\(.+\\)\\s+\\S+\\s+\\S+\\s+\\S+\\s+\\S+\\s+\\S+\\s+\\S+\\s+\\S+\\s+\\S+\\s+\\S+\\s+\\S+\\s+\\S+\\s+\\S+\\s+\\S+\\s+\\S+\\s+\\S+\\s+\\S+\\s+\\S+\\s+\\S+\\s+\\S+\\s+\\S+\\s+(\\S+)\\s+/)\n if (lMatch == nil)\n report \"Unable to decode stat output for PID #{iPID}: \\\"#{lStatOutput}\\\"\"\n else\n rVS = lMatch[1].to_i\n end\n\n return rCPUPercent, rMemPercent, rVS, rRESValue\n end",
"title": ""
},
{
"docid": "d93649b3d61d86c21a42212f3f95ce52",
"score": "0.53025174",
"text": "def percent_progress=(value)\n @percent_progress = value\n end",
"title": ""
},
{
"docid": "49e1645e88917f80b125d7de8423d5b3",
"score": "0.5293146",
"text": "def processing_percentage\n @processing_percentage || 0\n end",
"title": ""
},
{
"docid": "49e1645e88917f80b125d7de8423d5b3",
"score": "0.5293146",
"text": "def processing_percentage\n @processing_percentage || 0\n end",
"title": ""
},
{
"docid": "ee797721fbbe7b889065c9938175ab40",
"score": "0.5285004",
"text": "def progress\n (total_days - estimated_days_left).to_f / total_days # => percentage completed\n end",
"title": ""
},
{
"docid": "d58ac5a5ddf1d3b2c4b37d102317f3ac",
"score": "0.5278013",
"text": "def increment_progress\n @progress += 1\n update_progress\n end",
"title": ""
},
{
"docid": "53d3696552e24aa5e85e43c39dfd12fc",
"score": "0.52689636",
"text": "def progress\n total_count = get_tasks.size\n dones_count = dones.size\n percent = total_count == 0 ? 0 : percentage(dones_count, total_count)\n prefix = \"#{dones_count}/#{total_count}|\"\n done_bar = '=' * (percent / 10)\n rest_bar = ' ' * (10 - (percent / 10))\n progress_bar = \"#{done_bar}>#{rest_bar}\"\n sufix = \"|#{percent}%\"\n \"#{prefix}#{progress_bar}#{sufix}\"\n end",
"title": ""
},
{
"docid": "a33064e6342fd26a031fb9c65370f128",
"score": "0.52533",
"text": "def progress\n total_count = get_tasks.size\n dones_count = get_dones.size\n percent = total_count == 0 ? 0 : (dones_count.to_f / total_count.to_f * 100).round\n prefix = \"#{dones_count}/#{total_count}|\"\n done_bar = '=' * (percent / 10)\n rest_bar = ' ' * (10 - (percent / 10))\n progress_bar = \"#{done_bar}>#{rest_bar}\"\n sufix = \"|#{percent}%\"\n \"#{prefix}#{progress_bar}#{sufix}\"\n end",
"title": ""
},
{
"docid": "f98911fd6939983256b3258866bf6477",
"score": "0.5239797",
"text": "def set_physical_save_progression\n @physical_save_progression = PhysicalSaveProgression.find(params[:id])\n end",
"title": ""
},
{
"docid": "4544d72b164b2ddc1ff4ddf0e744c90a",
"score": "0.5233612",
"text": "def total_progress\n nil\n end",
"title": ""
}
] |
e2270f99c84a4e617e23b236d4251424
|
PUT /address_types/1 PUT /address_types/1.xml
|
[
{
"docid": "bcf662a488221570998e6b7385827664",
"score": "0.6913181",
"text": "def update\n @address_type = AddressType.find(params[:id])\n\n respond_to do |format|\n if @address_type.update_attributes(params[:address_type])\n format.html { redirect_to(@address_type, :notice => 'AddressType was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @address_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "98904cad1edeb04dc0e7db0f34d0d84c",
"score": "0.64624953",
"text": "def set_address_type\n\n end",
"title": ""
},
{
"docid": "9e906386d76fa132693d4fb1eddb0243",
"score": "0.6281556",
"text": "def set_address type, key, params={}\n opts = {:single_quoted => false}\n params = {\n :query => {\n \"ClientToken\" => self.token,\n \"AddressType\" => Type::String.safe_value(type, opts),\n \"VoterKey\" => Type::String.safe_value(key, opts),\n \"AddressLine1\" => Type::String.safe_value(params[:address_1], opts),\n \"AddressLine2\" => Type::String.safe_value(params[:address_2], opts),\n \"AddressCity\" => Type::String.safe_value(params[:city], opts),\n \"AddressState\" => Type::String.safe_value(params[:state], opts),\n \"AddressZip5\" => Type::String.safe_value(params[:zip5], opts),\n \"AddressZip4\" => Type::String.safe_value(params[:zip4], opts)\n }\n }\n\n put 'set_address.php', params\n end",
"title": ""
},
{
"docid": "2808f09062604070de4f8134f498f3eb",
"score": "0.601521",
"text": "def create\n @address = Address.new(params[:address])\n @address.type = params[:address][:address_type] unless params[:address][:address_type].blank?\n \n respond_to do |format|\n if @address.save\n flash[:notice] = 'Address was successfully created.'\n format.html { redirect_to( address_path(@address.id) ) }\n format.xml { render :xml => @address, :status => :created, :location => @address }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @address.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c58085dd442e93bfdbc2ddbdd34c5ee4",
"score": "0.6013055",
"text": "def update\n respond_to do |format|\n instance = get_instance\n set_meta instance\n if instance.update(type_params)\n # Redirect to index\n format.html { redirect_to redirect_address(@type), notice: \"#{type_label} was successfully updated.\" }\n else\n flash[:alert] = \"#{type_label} has not been saved.\"\n format.html { render sti_template(@type, :edit) }\n end\n end\n end",
"title": ""
},
{
"docid": "7b268eef3fe248fa1aa824ba5cab65e4",
"score": "0.59920436",
"text": "def update\n @addresstype = Addresstype.find(params[:id])\n\n respond_to do |format|\n if @addresstype.update_attributes(params[:addresstype])\n format.html { redirect_to @addresstype, notice: 'Addresstype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @addresstype.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2a883e27d7c2ac9dc7142cf4483f6815",
"score": "0.59020394",
"text": "def _update(type, current_name, metadata={})\n type = type.to_s.camelize\n request :update do |soap|\n soap.body = {\n :metadata => {\n :current_name => current_name,\n :metadata => prepare(metadata),\n :attributes! => { :metadata => { 'xsi:type' => \"ins0:#{type}\" } }\n }\n }\n end\n end",
"title": ""
},
{
"docid": "43cda545089a1cbb37c07caadd4eac30",
"score": "0.58806103",
"text": "def update\n\t @address_type_list = AddressTypeList.find(params[:id])\n respond_to do |format|\n if @address_type_list.update(address_type_list_params)\n format.html { redirect_to @address_type_list, notice: 'Address type list was successfully updated.' }\n format.json { render :show, status: :ok, location: @address_type_list }\n else\n format.html { render :edit }\n format.json { render json: @address_type_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e428028651876792168ca7fe1d33301d",
"score": "0.58657753",
"text": "def set_address_type_list\n @address_type_list = AddressTypeList.find(params[:id])\n end",
"title": ""
},
{
"docid": "9b433a11b3842a41e62f7f8cdf23932c",
"score": "0.58004344",
"text": "def destroy\n @address_type = AddressType.find(params[:id])\n @address_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(address_types_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "147d8d1dd07912533b06322eb23e89ea",
"score": "0.57787895",
"text": "def create\n @address_type = AddressType.new(params[:address_type])\n\n respond_to do |format|\n if @address_type.save\n format.html { redirect_to(@address_type, :notice => 'AddressType was successfully created.') }\n format.xml { render :xml => @address_type, :status => :created, :location => @address_type }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @address_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d27df4f49ae698b432835f96d5cdec1c",
"score": "0.5737748",
"text": "def update\n @outgoing_type = OutgoingType.find(params[:id])\n\n respond_to do |format|\n if @outgoing_type.update_attributes(params[:outgoing_type])\n format.html { redirect_to(outgoing_types_path, :notice => 'Outgoing type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @outgoing_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e631b376ae2ccb776680432bf94b01cc",
"score": "0.5707611",
"text": "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"title": ""
},
{
"docid": "c2c0b673628fdc28b181d18c0afd2d5b",
"score": "0.57037216",
"text": "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"title": ""
},
{
"docid": "3b62ab748c1cde3b36abeaadca530788",
"score": "0.5661508",
"text": "def update\n @type.update(type_params)\n end",
"title": ""
},
{
"docid": "5f4424de47f23703002aba09845f0a4b",
"score": "0.55876565",
"text": "def update_object_xml(object_type, id, xml)\n @client.update_business_object_by_public_id({\n :busObNameOrId => object_type,\n :busObPublicId => id,\n :updateXml => xml\n })\n return last_error\n end",
"title": ""
},
{
"docid": "a7ed8dbe6263fcaf5d3a0532f1abbc55",
"score": "0.5535521",
"text": "def update\n\n respond_to do |format|\n if @order_type.update_attributes(params[:order_type])\n format.html { redirect_to(@order_type, :notice => 'Order type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @order_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "af19af4e9102448249c4f2a7ac52b221",
"score": "0.5527821",
"text": "def update\n @address = @addressable.addresses.find_by_id(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to current_user, notice: 'address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b9da418e017ae7806c24bfa614968265",
"score": "0.5505523",
"text": "def update\n\n respond_to do |format|\n if @email_type.update_attributes(params[:email_type])\n format.html { redirect_to(@email_type, :notice => 'Email type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @email_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c90e84f6c93394f9aedd0718d8ee6b85",
"score": "0.54644114",
"text": "def _update type, id, body\n @elasticsupport.client.update index: _index_for(type), type: type.to_s, id: id, body: body\n end",
"title": ""
},
{
"docid": "47c9cd737c75b45c7b0b0363ae33e572",
"score": "0.544492",
"text": "def update\n standard_update(OrganizationType, params[:id], organization_type_params)\n end",
"title": ""
},
{
"docid": "1a6c10c11afbffb05a109e860997f241",
"score": "0.5444589",
"text": "def update\n @town_type = TownType.find(params[:id])\n\n respond_to do |format|\n if @town_type.update_attributes(params[:town_type])\n format.html { redirect_to(@town_type, :notice => 'Town type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @town_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "eb79450d6025c37ae80568b479a4947f",
"score": "0.54419863",
"text": "def update\n @address = current_user.addresses.find(params[:id])\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to \"/#{current_user.name}\", notice: 'Address was successfully updated.' }\n format.json { head :no_content }\n else\n @address.phones.build\n @address.faxs.build\n @address.emails.build\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "38743a8ba508967f32080e0c223016ed",
"score": "0.5434887",
"text": "def update\n @uri_type = UriType.find(params[:id])\n\n respond_to do |format|\n if @uri_type.update_attributes(params[:uri_type])\n flash[:notice] = 'UriType was successfully updated.'\n format.html { redirect_to(@uri_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @uri_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d3ba64ea51ec6223a15334efb66ee9c9",
"score": "0.5434115",
"text": "def update\n if @address.update(address_params)\n render json: @address\n else\n render json: @address.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "6e1883174f55d7631b1b4a9bff3d190b",
"score": "0.5392182",
"text": "def update_address(id, params)\n put(\"addresses/#{id}\", address: params, change_case: false)\n end",
"title": ""
},
{
"docid": "dbb1ea7c10d555a8cf52e73f8d52783a",
"score": "0.53800356",
"text": "def update\n respond_to do |format|\n if @address.update(address_params)\n format.html { redirect_to admin_path(current_user), notice: 'Address was successfully updated.' }\n format.json { render :show, status: :ok, location: @address }\n else\n format.html { render admin_path(current_user), error: 'Issue.' }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "78e679cd8b38711d065726971dfd5750",
"score": "0.5376306",
"text": "def edit_address(order_or_user, address_id, expect_success, values, type=nil)\n visit_edit_address(order_or_user, address_id)\n fill_in_address(values, type)\n click_button Spree.t('actions.update')\n\n if expect_success\n expect_address_collection_path(order_or_user)\n expect(page).to have_content(Spree.t(:successfully_updated, resource: Spree::Address.model_name.human))\n else\n expect(page).to have_no_content(Spree.t(:successfully_updated, resource: Spree::Address.model_name.human))\n expect(path_with_query).to eq(spree.admin_address_path(address_id, user_id: @user_id, order_id: @order_id))\n end\n end",
"title": ""
},
{
"docid": "6da60cb113013d6d03e347abfdd97210",
"score": "0.5373694",
"text": "def update\n @address = Address.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to @address, :notice => 'Address was successfully updated.' }\n format.json { render :json => @address }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @address.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b2e024d03eca447e16b6e7c8a2a72e87",
"score": "0.5367912",
"text": "def update\n respond_to do |format|\n if @address.update(address_params)\n format.html { redirect_to @address, notice: \"Address was successfully updated.\" }\n format.json { render :show, status: :ok, location: @address }\n else\n format.html { render :edit }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3b2487fb721d08c011bc3461c265b1dd",
"score": "0.53670573",
"text": "def update\n @address = Address.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to @address, notice: 'Address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3b2487fb721d08c011bc3461c265b1dd",
"score": "0.53670573",
"text": "def update\n @address = Address.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to @address, notice: 'Address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3b2487fb721d08c011bc3461c265b1dd",
"score": "0.53670573",
"text": "def update\n @address = Address.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to @address, notice: 'Address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3b2487fb721d08c011bc3461c265b1dd",
"score": "0.53670573",
"text": "def update\n @address = Address.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to @address, notice: 'Address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7a86ac3e02ac5c074ea473e4290bc30f",
"score": "0.53633314",
"text": "def update\n respond_to do |format|\n if @address.update(address_params)\n format.html { redirect_to @address, notice: 'Address was successfully updated.' }\n format.json { render :show, status: :ok, location: @address }\n else\n format.html { render :edit }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "71063a220df28f464dd293dda99dfab5",
"score": "0.53590125",
"text": "def update\n @os_type = OsType.find(params[:id])\n\n respond_to do |format|\n if @os_type.update_attributes(params[:os_type])\n format.html { redirect_to @os_type, notice: 'Os type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @os_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "86dc632792c657781c38c021123372ce",
"score": "0.53542084",
"text": "def update\n @user_address = UserAddress.find(params[:id])\n\n respond_to do |format|\n if @user_address.update_attributes(params[:user_address])\n format.html { redirect_to(@user_address, :notice => 'User address was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_address.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5fc537305398ef4bd5ea414b9f6f5702",
"score": "0.53537357",
"text": "def put(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_put(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"title": ""
},
{
"docid": "64b440897535e97c7293bc65680b55f4",
"score": "0.5332224",
"text": "def update\n @model_type = ModelType.find(params[:id])\n\n respond_to do |format|\n if @model_type.update_attributes(params[:model_type])\n format.html { redirect_to(@model_type, :notice => 'Model type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @model_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "122e4fb71a19aa193432ce9dfe59257a",
"score": "0.5331959",
"text": "def update\n\n logger.info \"Updating address for #{@type} ID: #{@model_object.id}\"\n\n @model_object.validate_address = true\n\n @model_object.update(model_params)\n\n if @model_object.valid?\n\n logger.info \"Finished updating address for #{@type} ID: \" \\\n \"#{@model_object.id}\"\n\n if @type == 'organisation'\n redirect_to organisation_mission_path(params['id'])\n elsif @type == 'project'\n redirect_to funding_application_gp_project_description_path(@model_object.funding_application.id)\n elsif @type == 'user'\n\n # Caters to a situation where original applicants have no person assigned to the user.\n check_and_set_person_address(@model_object) if @model_object.person.present?\n\n redirect_to :authenticated_root\n\n end\n\n else\n\n logger.info 'Validation failed when attempting to update address for ' \\\n \"#{@type} ID: #{@model_object.id}\"\n\n log_errors(@model_object)\n\n render :show\n\n end\n\n end",
"title": ""
},
{
"docid": "625e8ec336c4c386038688af5ff918f5",
"score": "0.53148395",
"text": "def update\n @fault_type = FaultType.find(params[:id])\n\n respond_to do |format|\n if @fault_type.update_attributes(params[:fault_type])\n format.html { redirect_to(@fault_type, :notice => 'FaultType was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @fault_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7e34f5da2fd22fbe39cbd28bc4dd495a",
"score": "0.5314681",
"text": "def update\n # @address = Address.find(params[:id])\n @address = Address.find_by_permalink!(params[:id])\n \n respond_to do |format|\n if @address.update_attributes(params[:address])\n \n flash[:notice] = 'Address was successfully updated.'\n format.html { redirect_to(@address) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @address.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cdc011454d62c8bc184bb79310ad8652",
"score": "0.5305934",
"text": "def update\n @phone_number_type = PhoneNumberType.find(params[:id])\n\n respond_to do |format|\n if @phone_number_type.update_attributes(params[:phone_number_type])\n flash[:notice] = 'PhoneNumberType was successfully updated.'\n format.html { redirect_to(@phone_number_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @phone_number_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e9733ad28d78261e37e427823b98545c",
"score": "0.5254994",
"text": "def show\n @address_type = AddressType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @address_type }\n end\n end",
"title": ""
},
{
"docid": "134e4bf20db312f4c3340f1b886cb35f",
"score": "0.52517486",
"text": "def update\n @customer = Customer.find(params[:id])\n @customer_types = CustomerType.find(params[:customer_type_id])\n @customer_types.customer_type= params[:customer_type]\n @customer_types.customer_type_name= params[:customer_type_name]\n @customer_types.zip_number= params[:zip_number]\n @customer_types.prefecture_cd= params[:prefecture_cd]\n @customer_types.city= params[:city]\n @customer_types.oaza= params[:oaza]\n @customer_types.town= params[:town]\n @customer_types.building_name= params[:building_name]\n @customer_types.customer_type_memo= params[:customer_type_memo]\n\n @customer.customer_types << @customer_types\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e8b6fa6ccaf8e79ccdaf158ffd7e3fae",
"score": "0.5242065",
"text": "def update\n @address_book = AddressBook.find(params[:id])\n\n respond_to do |format|\n if @address_book.update_attributes(params[:address_book])\n flash[:notice] = :address_book_updated.l\n format.html { redirect_to(address_books_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @address_book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9db249d671930cf6e5c5ae464dea4436",
"score": "0.5229203",
"text": "def create\n @address_type_list = @address.AddressTypeList.build(address_type_list_params)\n\n respond_to do |format|\n if @address_type_list.save\n format.html { redirect_to @address_type_list, notice: 'Address type list was successfully created.' }\n format.json { render :show, status: :created, location: @address_type_list }\n else\n format.html { render :new }\n format.json { render json: @address_type_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ffa7e095ddcab0873e8c245faf29766f",
"score": "0.5223162",
"text": "def update\n @taddress = Taddress.find(params[:id])\n \n respond_to do |format|\n if @taddress.update_attributes(params[:taddress])\n format.html { redirect_to @taddress, notice: 'Taddress was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taddress.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ecb9ad82ee67e214c958cfb2523de304",
"score": "0.5218647",
"text": "def update\n @association_type = AssociationType.find(params[:id])\n\n respond_to do |format|\n if @association_type.update_attributes(params[:association_type])\n flash[:notice] = 'AssociationType was successfully updated.'\n format.html { redirect_to(@association_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @association_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fd5773b9f6ee9f685177d5a561552e50",
"score": "0.5215367",
"text": "def update\n user = User.find(params[:id])\n if user.address.update(address_params)\n render status: :ok\n else\n render status: :unprocessable_entity #was :bad_request\n end\n end",
"title": ""
},
{
"docid": "4171af9a8373c0984dd0eaf526300c09",
"score": "0.5212709",
"text": "def update\n respond_to do |format|\n if @ag_address.update(ag_address_params)\n format.html { redirect_to @ag_address, notice: 'Address was successfully updated.' }\n format.json { render :show, status: :ok, location: @ag_address }\n else\n format.html { render :edit }\n format.json { render json: @ag_address.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b3a816642c1dd9d70e748809498db804",
"score": "0.5205161",
"text": "def update\n respond_to do |format|\n if @address.update(address_params)\n format.html { redirect_to home_path, notice: 'Address was successfully updated.' }\n format.json { render :show, status: :ok, location: @address }\n else\n format.html { render :edit }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "35e85e7b1ea368fca9f4be9dd1de27e2",
"score": "0.5201416",
"text": "def update\n respond_to do |format|\n if @os_type.update(os_type_params)\n format.html { redirect_to @os_type, notice: 'Os type was successfully updated.' }\n format.json { render :show, status: :ok, location: @os_type }\n else\n format.html { render :edit }\n format.json { render json: @os_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "34573d0edd9fa30c1a6f6c9971824a25",
"score": "0.5191209",
"text": "def update\n @order_type = OrderType.find(params[:id])\n\n respond_to do |format|\n if @order_type.update_attributes(params[:order_type])\n format.html { redirect_to([:admin, @order_type], :notice => 'OrderType atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @order_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c01430a11c226fe04bcbe8d1712a1eec",
"score": "0.5188728",
"text": "def address_type_list_params\n params.require(:address_type_list).permit(:uuid, :name)\n end",
"title": ""
},
{
"docid": "e60ae9953e70fa9d4027ee87ba4092c6",
"score": "0.51843923",
"text": "def update\n @item_type = ItemType.find(params[:id])\n\n respond_to do |format|\n if @item_type.update_attributes(params[:item_type])\n format.html { render :action => 'edit', :notice => 'Item type was successfully updated.' }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "586ae9fad4a08e275f83e788917d751a",
"score": "0.51831555",
"text": "def update\n @attr_type = AttrType.find(params[:id])\n\n respond_to do |format|\n if @attr_type.update_attributes(params[:attr_type])\n flash[:notice] = 'AttrType was successfully updated.'\n format.html { redirect_to(@attr_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @attr_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "324e531cf238b03a3dd8237a5c7c7a20",
"score": "0.5182864",
"text": "def update_contacts(params)\n params[:types] = index_array(params[:types])\n\n params[:contact_set] = params.delete :contacts\n params[:key] = 'attributes'\n\n run_command :update_contacts, :domain, params\n end",
"title": ""
},
{
"docid": "f56bd03a07e55dd5e6339cab59254f6b",
"score": "0.5161032",
"text": "def update\n @customers_address = CustomersAddress.find(params[:id])\n\n respond_to do |format|\n if @customers_address.update_attributes(params[:customers_address])\n format.html { redirect_to @customers_address, notice: 'Customers address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customers_address.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "20fd06b461ac53f83f9e74cc0f894741",
"score": "0.51582944",
"text": "def update\n redirect_url = os_types_url\n\n if params[:cancel_button]\n redirect_to redirect_url\n else\n @os_type = OsType.find(params[:id])\n\n respond_to do |format|\n if @os_type.update_attributes(params[:os_type])\n flash[:notice] = 'OsType was successfully updated.'\n format.html { redirect_to redirect_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @os_type.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"title": ""
},
{
"docid": "4a442d9a53fcc74c34cfbf9a5bcaf559",
"score": "0.51566696",
"text": "def update \t\n record = AssetType.find(params[:id])\n record.update_attributes(params[:record])\n \n respond_to do |format|\n format.html\n format.json {\n render json: {}\n }\n end\n end",
"title": ""
},
{
"docid": "85490f4b890fd80110af36ca47b18989",
"score": "0.5153253",
"text": "def update\n @address = Address.find(params[:id])\n @address.update_attributes(params[:address])\n @addresses = Address.paginate(:page => params[:page], :per_page => 30).order('updated_at DESC')\n end",
"title": ""
},
{
"docid": "25dfd6406aa91a23e5c23d8b45e3354c",
"score": "0.5152234",
"text": "def update\n @incidenttype = Incidenttype.find(params[:id])\n\n respond_to do |format|\n if @incidenttype.update_attributes(params[:incidenttype])\n flash[:notice] = 'Incidenttype was successfully updated.'\n format.html { redirect_to(@incidenttype) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @incidenttype.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "204c409b4c7bc681af5ada7fa23b935d",
"score": "0.5147131",
"text": "def update\n @user_address = UserAddress.find(params[:id])\n\n respond_to do |format|\n if @user_address.update_attributes(params[:user_address])\n format.html { redirect_to @user_address, notice: 'User address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_address.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ee80bbebe5e8aaadf1e4fd9e0076e4bd",
"score": "0.51418895",
"text": "def new\n @address_type = AddressType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @address_type }\n end\n end",
"title": ""
},
{
"docid": "2308bc15dc14f81b08965fdaaee58dca",
"score": "0.5140957",
"text": "def update\n @event_type = EventType.find(params[:id])\n\n respond_to do |format|\n if @event_type.update_attributes(event_type_params)\n format.html { redirect_to(@event_type, notice: 'Event type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @event_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "de80d8b5553ebdce276c926c475c115e",
"score": "0.5140706",
"text": "def update\n respond_to do |format|\n if @address.update(address_params)\n format.html { redirect_to root_path, notice: 'Address was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"title": ""
},
{
"docid": "c54c2c4fe1f48e04012d1f90e3f2a41d",
"score": "0.51379585",
"text": "def update(address, new_address, options={})\n params = {:address => new_address}\n Mailgun.submit :put, list_url(address), params.merge(options)\n end",
"title": ""
},
{
"docid": "9e6d50fedec4453363e6694759952318",
"score": "0.5134666",
"text": "def update\n respond_to do |format|\n if @address.update(address_params)\n format.html { redirect_to edit_company_path(@company), notice: 'Address was successfully updated.' }\n format.json { render :show, status: :ok, location: @address }\n else\n format.html { render :edit }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bdacf16a809c7a6b249b3c4fe37623e1",
"score": "0.5130555",
"text": "def destroy\n @addresstype = Addresstype.find(params[:id])\n @addresstype.destroy\n\n respond_to do |format|\n format.html { redirect_to addresstypes_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "069bee523a2dcbcc73a7709c635886c3",
"score": "0.51253694",
"text": "def define_address_type\n if @address_type.nil?\n data_file = if !@address_type_data_file.nil?\n @address_type_data_file\n else\n \"#{::File.expand_path(::File.join(\"..\", \"data_files\"), __FILE__)}/address_type.yml\"\n end\n address_types = Psych.load_file(data_file)\n @address_type = address_types.sample unless address_types.nil?\n end\n @address_type = '' unless @set_blank == false\n end",
"title": ""
},
{
"docid": "5dc846fd89a425502970f0121d1cb300",
"score": "0.51252425",
"text": "def update\n @employee_type = EmployeeType.find(params[:id])\n\n respond_to do |format|\n if @employee_type.update_attributes(params[:employee_type])\n format.html { redirect_to(@employee_type, :notice => 'Employee type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @employee_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "216d434bfe6d2a8e78439556fa0cc09a",
"score": "0.5123449",
"text": "def update\n @accounttype = Accounttype.find(params[:id])\n\n respond_to do |format|\n if @accounttype.update_attributes(params[:accounttype])\n format.html { redirect_to(@accounttype, :notice => 'Accounttype was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @accounttype.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9810d7facc1b033b14536a155b033f64",
"score": "0.51187885",
"text": "def address_params\n params.require(:address).permit(:address, :coverage_type_id)\n end",
"title": ""
},
{
"docid": "5ec50f20e97876768eb743a1f6782311",
"score": "0.51172686",
"text": "def update\n @sponsor_type = SponsorType.find(params[:id])\n\n respond_to do |format|\n if @sponsor_type.update_attributes(params[:sponsor_type])\n format.html { redirect_to([@event, @sponsor_type], :notice => 'Sponsor type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sponsor_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4525c732b7036d0f63e5ec9593ec1615",
"score": "0.51156193",
"text": "def sell_payment_types_update (payment_type_id, email, params={})\r\n url = api_url \"/sell/payment_types/#{payment_type_id}\"\r\n load = MultiJson.dump email: email\r\n req = request_params(params)\r\n\r\n feed_or_retry do\r\n RestClient.put url, load, req \r\n end \r\n end",
"title": ""
},
{
"docid": "9b1e7d33426fe3ffc05b07e793e23516",
"score": "0.5111475",
"text": "def update(name, type, options = {})\n Utils.stringify_keys!(options)\n path = \"/projects/#{project.name}/resources/#{name}\"\n\n headers = build_create_base_headers(name, type, options)\n body = build_create_base_body(options)\n\n !!client.put(path, headers: headers, body: body)\n end",
"title": ""
},
{
"docid": "3e4408be7acf323fa5df9834e02fca54",
"score": "0.51074773",
"text": "def update\n respond_to do |format|\n if @electronic_address.update(electronic_address_params)\n format.html { redirect_to @electronic_address, notice: 'Electronic address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @electronic_address.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1ea4c8bc03d68b98539b265f4edc0884",
"score": "0.51011974",
"text": "def update\n respond_to do |format|\n if @entity_type.update_attributes(params[:entity_type])\n format.html { redirect_to(entity_types_path, :notice => \"Entity Type was successfully updated. #{undo_link}\") }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"title": ""
},
{
"docid": "c503bd0d36651aa026b4d78ecc21d676",
"score": "0.5100233",
"text": "def update\n respond_to do |format|\n if @contact_type.update(contact_type_params)\n format.html { redirect_to @contact_type, notice: 'Contact type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contact_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7adde121ba0612c19f328b474498f0a4",
"score": "0.5097443",
"text": "def update\n @recipe_type = RecipeType.find(params[:id])\n\n respond_to do |format|\n if @recipe_type.update_attributes(params[:recipe_type])\n flash[:notice] = 'RecipeType was successfully updated.'\n format.html { redirect_to(@recipe_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @recipe_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1c6220955df2eb7b195c6df20e907171",
"score": "0.5097239",
"text": "def update\n if @contact.address.update(address_params)\n render json: @contact.address\n else\n render json: @contact.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "14b8a08a699d40d029919e5fcc6df64a",
"score": "0.50924754",
"text": "def update\n @book_type = BookType.find(params[:id])\n\n respond_to do |format|\n if @book_type.update_attributes(params[:book_type])\n format.html { redirect_to(@book_type, :notice => 'Book type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "96a3973f1677ba59069602c75c9ef861",
"score": "0.5089504",
"text": "def update\n @organization = Organization.find(params[:id])\n unless params[:address].nil?\n if @organization.address\n @organization.address.update_attributes(params[:address])\n end\n end\n #if @address\n #updated_attributes = {name: org['name'], website: org['website'], org_type: org['org_type'], address_id: @address.id}\n #else\n #updated_attributes = {name: org['name'], website: org['website'], org_type: org['org_type'], address_id: nil}\n #end\n\n respond_to do |format|\n if @organization.update_attributes(params[:organization])# and @address.update_attributes(params[:address])\n format.html { redirect_to @organization, notice: 'Organization was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @organization.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6a7af38993db8b620065cab07c930f11",
"score": "0.5088524",
"text": "def update\n @book_type = BookType.find(params[:id])\n\n respond_to do |format|\n if @book_type.update_attributes(params[:book_type])\n format.html { redirect_to(@book_type, :notice => 'BookType was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "10e1af018fcb2a1924b41e3dc49ea1e8",
"score": "0.50869274",
"text": "def update\n respond_to do |format|\n if @address.update(address_params)\n format.html { redirect_to @address, notice: 'Form was updated successfully!' }\n format.json { render :show, status: :ok, location: @address }\n else\n format.html { render :edit }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5941434ee5601b843e41f1d68c0b789d",
"score": "0.50862724",
"text": "def edit_address(edited_address)\n address = Address.find(edited_address.uid)\n address.attributes = edited_address.attributes\n address.save!\n end",
"title": ""
},
{
"docid": "c515c4263206a79992f0c039251fd368",
"score": "0.5084172",
"text": "def update\n @store_type = StoreType.find(params[:id])\n\n respond_to do |format|\n if @store_type.update_attributes(params[:store_type])\n flash[:notice] = 'Store Type was successfully updated.'\n format.html { redirect_to(store_types_path) }\n format.xml { head :ok }\n else\n @store_types = StoreType.active\n format.html { render :action => \"index\" }\n format.xml { render :xml => @store_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5aca4c6fced93c97b4e80e8f331c2c15",
"score": "0.5082091",
"text": "def update\n @address = current_user.addresses.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to user_address_path(current_user, @address), notice: 'Address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "14a776ea4f831e284b27c253146572e0",
"score": "0.50689584",
"text": "def update\n @ss_type = SsType.find(params[:id])\n\n respond_to do |format|\n if @ss_type.update_attributes(params[:ss_type])\n format.html { redirect_to(@ss_type, :notice => 'Ss type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ss_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d8a8a861a90ea6db541948546746e7b5",
"score": "0.5064765",
"text": "def update\n @lookup_type = Irm::LookupType.find(params[:id])\n\n respond_to do |format|\n if @lookup_type.update_attributes(params[:irm_lookup_type])\n format.html { redirect_to({:action=>\"index\"},:notice => (t :successfully_updated))}\n format.xml { head :ok }\n else\n format.html { render \"edit\" }\n format.xml { render :xml => @lookup_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "dad837e07a930d61aee78bfad0b808b5",
"score": "0.50646",
"text": "def update\n respond_to do |format|\n if @address_book.update(address_book_params)\n format.html { redirect_to @address_book, notice: 'Address book was successfully updated.' }\n format.json { render :show, status: :ok, location: @address_book }\n else\n format.html { render :edit }\n format.json { render json: @address_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "dad837e07a930d61aee78bfad0b808b5",
"score": "0.50646",
"text": "def update\n respond_to do |format|\n if @address_book.update(address_book_params)\n format.html { redirect_to @address_book, notice: 'Address book was successfully updated.' }\n format.json { render :show, status: :ok, location: @address_book }\n else\n format.html { render :edit }\n format.json { render json: @address_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b62fc4f5377672af00753b748645017d",
"score": "0.50640017",
"text": "def update\n @ip_type = IpType.find(params[:id])\n\n respond_to do |format|\n if @ip_type.update_attributes(params[:ip_type])\n format.html { redirect_to @ip_type, :notice => 'Ip type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @ip_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b5fa1a277ee72cff37f334450fa83716",
"score": "0.50530386",
"text": "def update\n authorize @address\n\n respond_to do |format|\n if @address.update(@pars)\n flash[:success] = \"Address was successfully updated. #{@pars.inspect}\"\n format.html { redirect_to addresses_path }\n format.json { render json: {locale: I18n.locale,\n user_id: @user_id,\n recyclable: @address.recyclable} }\n else\n flash[:danger] = \"There was a problem updating the address.\"\n format.html { render action: 'edit' }\n format.json { render json: @address.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c8a70538fdebe59d9c641d90d435c08a",
"score": "0.5052027",
"text": "def update\n @sales_type = SalesType.find(params[:id])\n\n respond_to do |format|\n if @sales_type.update_attributes(params[:sales_type])\n format.html { redirect_to(sales_types_path, :notice => 'Sales type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sales_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1f32253721f180e246d89a8ae4eb62aa",
"score": "0.50454044",
"text": "def update\n respond_to do |format|\n if @route_type.update(route_type_params)\n format.html { redirect_to @route_type, notice: 'Route type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @route_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e5935674df84eaeb0e8bec2b633708e4",
"score": "0.5038689",
"text": "def update\n @observation_type = ObservationType.find(params[:id])\n\n respond_to do |format|\n if @observation_type.update_attributes(params[:observation_type])\n format.html { redirect_to @observation_type, notice: 'Observation type was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @observation_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "63e694946a6836e29d7480d2ac0ceaa3",
"score": "0.5038492",
"text": "def update\n @rtype = Rtype.find(params[:id])\n\n respond_to do |format|\n if @rtype.update_attributes(params[:rtype])\n flash[:notice] = 'Rtype was successfully updated.'\n format.html { redirect_to(@rtype) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rtype.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "225dc89cd03f4bd22b452a45f02313e1",
"score": "0.5038335",
"text": "def update\n @content_type = ContentType.get(params[:id])\n\n respond_to do |format|\n if @content_type.update_attributes(params[:content_type])\n flash[:notice] = 'ContentType was successfully updated.'\n format.html { redirect_to(@content_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @content_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ae5fb82effc733bee8eb354853d40308",
"score": "0.50382763",
"text": "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend",
"title": ""
}
] |
1282c4f2f1f2929a1b72c1a0a261ab04
|
=begin For example: minutes 3: for a 3 minute timer =end
|
[
{
"docid": "e7062a460aded4fc2385638cdaa1cbb2",
"score": "0.62869245",
"text": "def start_timer(minutes)\n # Don't change -- based metric, seconds\n length = 60.0\n # Number of minutes\n number_of_minutes = minutes\n passed = 0\n while (number_of_minutes > 0)\n timer(number_of_minutes,Time.now, length, passed)\n number_of_minutes -= 1\n passed += 1\n puts \"Total time left #{number_of_minutes} minutes\"\n sleep(2)\n end\n system('clear')\n puts(\"Timer done -- #{number_of_minutes} passed.\")\nend",
"title": ""
}
] |
[
{
"docid": "54a1eabcb55b97260f16885e47a0cd58",
"score": "0.68429124",
"text": "def beginning_of_minute; end",
"title": ""
},
{
"docid": "54a1eabcb55b97260f16885e47a0cd58",
"score": "0.68429124",
"text": "def beginning_of_minute; end",
"title": ""
},
{
"docid": "54a1eabcb55b97260f16885e47a0cd58",
"score": "0.68429124",
"text": "def beginning_of_minute; end",
"title": ""
},
{
"docid": "54a1eabcb55b97260f16885e47a0cd58",
"score": "0.68429124",
"text": "def beginning_of_minute; end",
"title": ""
},
{
"docid": "54a1eabcb55b97260f16885e47a0cd58",
"score": "0.68429124",
"text": "def beginning_of_minute; end",
"title": ""
},
{
"docid": "df6f2e6975d4474e508e6dd37a9a81b7",
"score": "0.6793675",
"text": "def timer; end",
"title": ""
},
{
"docid": "df6f2e6975d4474e508e6dd37a9a81b7",
"score": "0.6793675",
"text": "def timer; end",
"title": ""
},
{
"docid": "df6f2e6975d4474e508e6dd37a9a81b7",
"score": "0.6793675",
"text": "def timer; end",
"title": ""
},
{
"docid": "df6f2e6975d4474e508e6dd37a9a81b7",
"score": "0.6793675",
"text": "def timer; end",
"title": ""
},
{
"docid": "f7faf0e1efd9b7f2d2ea9a3663c9295c",
"score": "0.67823195",
"text": "def end_of_minute; end",
"title": ""
},
{
"docid": "f7faf0e1efd9b7f2d2ea9a3663c9295c",
"score": "0.67823195",
"text": "def end_of_minute; end",
"title": ""
},
{
"docid": "f7faf0e1efd9b7f2d2ea9a3663c9295c",
"score": "0.67823195",
"text": "def end_of_minute; end",
"title": ""
},
{
"docid": "f7faf0e1efd9b7f2d2ea9a3663c9295c",
"score": "0.67823195",
"text": "def end_of_minute; end",
"title": ""
},
{
"docid": "f7faf0e1efd9b7f2d2ea9a3663c9295c",
"score": "0.67823195",
"text": "def end_of_minute; end",
"title": ""
},
{
"docid": "6c6b029d0bc9d2129f8ba49c51c21663",
"score": "0.67558384",
"text": "def set_timer\r\n show do\r\n title \"Set a timer\"\r\n \r\n check \"When you get back to your bench, set a 40 minute timer.\" \r\n check \"When the 40 minute timer is up, grab a lab manager to check on the gel. The lab manager may have you set another timer after checking the gel.\"\r\n end\r\n end",
"title": ""
},
{
"docid": "419a08a7aa60d27b62545fdc28eebdba",
"score": "0.6687709",
"text": "def wait_ten_min\r\n show do\r\n title \"Wait for 10 minutes\"\r\n \r\n timer initial: { hours: 0, minutes: 10, seconds: 0}\r\n end\r\n end",
"title": ""
},
{
"docid": "9a089f90dc77f11559dae0ef0aa3141f",
"score": "0.6618134",
"text": "def timer(description, &block)\n start_time = Time.new\n block.call\n duration = Time.new - start_time\n puts \"#{description} ::: #{duration} seconds\"\nend",
"title": ""
},
{
"docid": "a6291f8017e40210a0ac616362dd7442",
"score": "0.6559787",
"text": "def at_beginning_of_minute; end",
"title": ""
},
{
"docid": "a6291f8017e40210a0ac616362dd7442",
"score": "0.6559787",
"text": "def at_beginning_of_minute; end",
"title": ""
},
{
"docid": "a6291f8017e40210a0ac616362dd7442",
"score": "0.6559787",
"text": "def at_beginning_of_minute; end",
"title": ""
},
{
"docid": "a6291f8017e40210a0ac616362dd7442",
"score": "0.6559787",
"text": "def at_beginning_of_minute; end",
"title": ""
},
{
"docid": "a6291f8017e40210a0ac616362dd7442",
"score": "0.6559787",
"text": "def at_beginning_of_minute; end",
"title": ""
},
{
"docid": "ce1442e46135c9a45024376425e46ba3",
"score": "0.6519423",
"text": "def timer=(_arg0); end",
"title": ""
},
{
"docid": "ce1442e46135c9a45024376425e46ba3",
"score": "0.6519423",
"text": "def timer=(_arg0); end",
"title": ""
},
{
"docid": "ce1442e46135c9a45024376425e46ba3",
"score": "0.6519423",
"text": "def timer=(_arg0); end",
"title": ""
},
{
"docid": "ce1442e46135c9a45024376425e46ba3",
"score": "0.6519423",
"text": "def timer=(_arg0); end",
"title": ""
},
{
"docid": "1a8684e18ea9af7be767ccfb122f6781",
"score": "0.651167",
"text": "def setTimeout\t\t# Time item will play for\n\t\tself[:run_time] = @hours * 3600 + @minutes * 60 + @seconds\n\trescue\n\t\t@hours = 0 if @hours.nil?\n\t\t@minutes = 0 if @minutes.nil?\n\t\t@seconds = 0 if @seconds.nil?\n\t\tsetTimeout\n\tend",
"title": ""
},
{
"docid": "ec8a32af58d05d848a929babca1e20dc",
"score": "0.64900124",
"text": "def time(message=\"\")\n Timer.new(:title => \"YMDP\", :growl => CONFIG.growl?).time(message) do\n yield\n end\nend",
"title": ""
},
{
"docid": "c33a93b66722ce2dc584bcedd3f96488",
"score": "0.64753526",
"text": "def timer(&block)\n require 'hitimes'\n Hitimes::Interval.measure &block\nend",
"title": ""
},
{
"docid": "99c810d5ccddb2854c1ee6c8dd4f4323",
"score": "0.6462221",
"text": "def at_end_of_minute; end",
"title": ""
},
{
"docid": "99c810d5ccddb2854c1ee6c8dd4f4323",
"score": "0.6462221",
"text": "def at_end_of_minute; end",
"title": ""
},
{
"docid": "99c810d5ccddb2854c1ee6c8dd4f4323",
"score": "0.6462221",
"text": "def at_end_of_minute; end",
"title": ""
},
{
"docid": "99c810d5ccddb2854c1ee6c8dd4f4323",
"score": "0.6462221",
"text": "def at_end_of_minute; end",
"title": ""
},
{
"docid": "99c810d5ccddb2854c1ee6c8dd4f4323",
"score": "0.6462221",
"text": "def at_end_of_minute; end",
"title": ""
},
{
"docid": "86897710abb3a2fb9c4d9f5653e937b9",
"score": "0.6454326",
"text": "def time(&block); end",
"title": ""
},
{
"docid": "58681d857118b6ea868f517e1567db08",
"score": "0.6429772",
"text": "def minute; end",
"title": ""
},
{
"docid": "a6504a8eaafa7fe77297ece5467b8482",
"score": "0.6391498",
"text": "def start_time=(_); end",
"title": ""
},
{
"docid": "e45f20427a277ef158ea0b60843e3af3",
"score": "0.6367379",
"text": "def bot_minute(event)\n if @minutes\n event.respond 'i already count. but i cant do two count,,'\n else\n @minutes = true\n event.respond 'okaaay!! one minute i reming u!'\n\n timer(60) do\n event.respond 'minutee up!'\n @minutes = false\n end\n end\n end",
"title": ""
},
{
"docid": "e2c5e227b40eeec42f3248b913fb2105",
"score": "0.63659465",
"text": "def run_at(time, &block)\r\n seconds_until = time - Time.now\r\n t = Timer(seconds_until, shots: 1 , &block)\r\n t.start\r\n return t\r\n end",
"title": ""
},
{
"docid": "c64208f8fb3ca595b260609f8a794bf9",
"score": "0.6365876",
"text": "def start_timer\n timer_link = 'https://www.google.com/search?q=timer+for+1+hour&oq=timer+for+1+hour+30+minute&aqs=chrome..69i57j0l5.2200j0j7&sourceid=chrome&ie=UTF-8'\n show do\n title \"Start 1-hour, 30-minute timer\"\n \n note \"Start a <a href=#{timer_link} target='_blank'>one-hour 30-minute timer on Google</a>, and sit tight.\"\n end\n end",
"title": ""
},
{
"docid": "e1d5ca7ae7afd02741e0f415470388b4",
"score": "0.63335943",
"text": "def seconds_idle; end",
"title": ""
},
{
"docid": "efb6cb00916dcd7386a76726e4186d80",
"score": "0.6319754",
"text": "def timer(&block) = Cnfs.with_timer('Command execution', &block)",
"title": ""
},
{
"docid": "d58547ed2c24ecb0966b16ecc9e76f09",
"score": "0.6312736",
"text": "def in(seconds); end",
"title": ""
},
{
"docid": "d58547ed2c24ecb0966b16ecc9e76f09",
"score": "0.6312736",
"text": "def in(seconds); end",
"title": ""
},
{
"docid": "d58547ed2c24ecb0966b16ecc9e76f09",
"score": "0.6312736",
"text": "def in(seconds); end",
"title": ""
},
{
"docid": "d58547ed2c24ecb0966b16ecc9e76f09",
"score": "0.6312736",
"text": "def in(seconds); end",
"title": ""
},
{
"docid": "d58547ed2c24ecb0966b16ecc9e76f09",
"score": "0.6312736",
"text": "def in(seconds); end",
"title": ""
},
{
"docid": "d58547ed2c24ecb0966b16ecc9e76f09",
"score": "0.6312736",
"text": "def in(seconds); end",
"title": ""
},
{
"docid": "d58547ed2c24ecb0966b16ecc9e76f09",
"score": "0.6312736",
"text": "def in(seconds); end",
"title": ""
},
{
"docid": "027f0d2bb5ea8c3a2e46bc892c461ead",
"score": "0.6306758",
"text": "def minutes; end",
"title": ""
},
{
"docid": "027f0d2bb5ea8c3a2e46bc892c461ead",
"score": "0.6306758",
"text": "def minutes; end",
"title": ""
},
{
"docid": "b82066c67fdccc0ebb55a90d4f656293",
"score": "0.6287894",
"text": "def seconds; end",
"title": ""
},
{
"docid": "b82066c67fdccc0ebb55a90d4f656293",
"score": "0.6287894",
"text": "def seconds; end",
"title": ""
},
{
"docid": "b82066c67fdccc0ebb55a90d4f656293",
"score": "0.6287894",
"text": "def seconds; end",
"title": ""
},
{
"docid": "b82066c67fdccc0ebb55a90d4f656293",
"score": "0.6287894",
"text": "def seconds; end",
"title": ""
},
{
"docid": "b82066c67fdccc0ebb55a90d4f656293",
"score": "0.6287894",
"text": "def seconds; end",
"title": ""
},
{
"docid": "a80f1e7c86eae5317eb5d3872e8407f6",
"score": "0.6277465",
"text": "def tick\n\t\n\t\t@secs +=1\n\t\t\n\t\tif @secs == 60\n\t\t\tthen\n\t\t\t@mins += 1\n\t\t\t@secs = 0\n\t\t\tif @mins == 60\n\t\t\t\tthen\n\t\t\t\t@hours += 1\n\t\t\t\t@mins = 0\n\t\t\t\tif @hours == 24\n\t\t\t\t\tthen\n\t\t\t\t\t@hours = 0\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "5ab70a6f460a1eeb47c0204be8101672",
"score": "0.6273656",
"text": "def timer(e)\n end",
"title": ""
},
{
"docid": "343cdc585473b4cdac3e5415925b6299",
"score": "0.62704253",
"text": "def with_timer(&block)\n start_time = Time.now\n block.call\n end_time = Time.now\n duration_in_seconds = (end_time - start_time).to_i\n $stderr.puts \"Total duration: #{ duration_in_seconds } seconds.\"\n $stderr.puts \"Boom done!\".color(:yellow) if duration_in_seconds < 2\n end",
"title": ""
},
{
"docid": "4439e66daa43c0d3d9b7b6ca687dcbc3",
"score": "0.6265787",
"text": "def editing_time(time = 3)\n\t\"It takes #{time} hours to finish post production on one minute of a finished piece.\"\nend",
"title": ""
},
{
"docid": "ea8ddac6b9c7b444e2eead8f9f608402",
"score": "0.62630266",
"text": "def interval; end",
"title": ""
},
{
"docid": "5c3dce21a35d9db50ae35b95a3537fe5",
"score": "0.6260379",
"text": "def seconds_per_minute() 60 end",
"title": ""
},
{
"docid": "f0cd85d985a37c8a3dc02e22f86d5fd0",
"score": "0.62443435",
"text": "def in_minutes; end",
"title": ""
},
{
"docid": "f0cd85d985a37c8a3dc02e22f86d5fd0",
"score": "0.62443435",
"text": "def in_minutes; end",
"title": ""
},
{
"docid": "d4d7ecee9ef583829e486c5d971d8dd8",
"score": "0.6240823",
"text": "def time=(*) end",
"title": ""
},
{
"docid": "efcb5cd864bef14b27f7f4bf65041e65",
"score": "0.623825",
"text": "def set_timer_quantum(_arg0); end",
"title": ""
},
{
"docid": "0211bf9dab4c984c58abf0a9d47a2ce3",
"score": "0.6222333",
"text": "def timer_for\n # TODO: Return time taken to execute the given block\nend",
"title": ""
},
{
"docid": "9de2f07c2ee8123acb007f7510cca392",
"score": "0.6217715",
"text": "def enhanced_timer # 2: found method 'enhanced_timer'\n start_time = Time.now # 3: starts execution\n\n yield # 4: click pause button and go to the block\n\n # 6: unpause and continue\n end_time = Time.now\n puts \"Elapsed time: #{end_time - start_time} seconds\"\nend",
"title": ""
},
{
"docid": "8333877aa5638b3b5b7491b944ed4a55",
"score": "0.6215498",
"text": "def add_timer(duration, &block)\n\tend",
"title": ""
},
{
"docid": "ac222d9d788ab54c361ed1fff246825d",
"score": "0.62149334",
"text": "def timer(msg, start, stop, round = 2)\n # elapsed_time = Time.at(time).utc.strftime '%H:%M:%S'\n time = stop - start\n # 1 hour is 60 seconds * 60 minutes = 60 * 60 = 3600\n hours = (time / 3600).to_i\n minutes = (time % 3600 / 60).to_i\n seconds = (time % 60).round round\n elapsed_time = ''\n elapsed_time << \"#{hours}h\" if hours.positive?\n elapsed_time << \"#{minutes}m\" if minutes.positive?\n elapsed_time << \"#{seconds}s\"\n\n puts \"#{msg}: #{elapsed_time}\"\n end",
"title": ""
},
{
"docid": "4ea28dc9fc8c1a5f23cdd1668ab84809",
"score": "0.6190518",
"text": "def global_timer_set; end",
"title": ""
},
{
"docid": "4ea28dc9fc8c1a5f23cdd1668ab84809",
"score": "0.6190518",
"text": "def global_timer_set; end",
"title": ""
},
{
"docid": "b92a0996519bd6ddb0de3d04d476fde9",
"score": "0.6182529",
"text": "def start_time; end",
"title": ""
},
{
"docid": "b92a0996519bd6ddb0de3d04d476fde9",
"score": "0.6182529",
"text": "def start_time; end",
"title": ""
},
{
"docid": "b92a0996519bd6ddb0de3d04d476fde9",
"score": "0.6182529",
"text": "def start_time; end",
"title": ""
},
{
"docid": "b92a0996519bd6ddb0de3d04d476fde9",
"score": "0.6182529",
"text": "def start_time; end",
"title": ""
},
{
"docid": "c2974963391233b0a6eeb54ad06994bc",
"score": "0.6158308",
"text": "def timing; end",
"title": ""
},
{
"docid": "afec3823f6b2f2df074676d424d708d4",
"score": "0.6157328",
"text": "def counting_minutes(str)\r\n\r\nend",
"title": ""
},
{
"docid": "bdfa22694faa466faedc744a452e8a73",
"score": "0.6148848",
"text": "def timer\n starting_time = Time.now\n yield\n puts (Time.now - starting_time)\nend",
"title": ""
},
{
"docid": "5dfeb1c366eed3f46805c757fd1c6610",
"score": "0.6148132",
"text": "def block_time\n 60*10\n end",
"title": ""
},
{
"docid": "f56389827ffca3deee4b77d4c52a2c26",
"score": "0.61349523",
"text": "def start_time=(_arg0); end",
"title": ""
},
{
"docid": "b87e6453e97770862d99414018701f35",
"score": "0.6134181",
"text": "def time(*args, &block); end",
"title": ""
},
{
"docid": "3c26c53818c7afc52d2d208a827e19e4",
"score": "0.6130031",
"text": "def timer\n start_time = Time.now\n yield\n end_time = Time.now\n end_time - start_time\n end",
"title": ""
},
{
"docid": "0dc51f81688b8ea4df7dddcfc7d79a4f",
"score": "0.61250365",
"text": "def sec; end",
"title": ""
},
{
"docid": "0c7857bdd5f0c1cf6c4396813ee5d43c",
"score": "0.61244595",
"text": "def init_clock(minutes, &block)\n @seconds = minutes * 60\n @display = stack margin: 10\n display_time\n clock_ticking(&block)\n end",
"title": ""
},
{
"docid": "662f410b0061cad3d784a22470af66ba",
"score": "0.61109644",
"text": "def _test_2\n\n scheduler = Rufus::Scheduler.start_new\n last = nil\n job_id = scheduler.schedule_every \"1s\" do\n t = Time.now\n puts t.to_f\n end\n sleep 4 * 60\n scheduler.sstop\n end",
"title": ""
},
{
"docid": "bac993f3680d3f0b745a50922fa10acf",
"score": "0.61095566",
"text": "def myTimer(time_string, position)\n mytime = Time.new(2014,time_string.split(\",\")[0], time_string.split(\",\")[1], time_string.split(\",\")[2], time_string.split(\",\")[3])\n \n return mytime + 5 * 60 * (position - 1)\nend",
"title": ""
},
{
"docid": "7954f072236aefebca9bf07bdbe30f60",
"score": "0.61016035",
"text": "def end_of_minute\n change(:sec => 59)\n end",
"title": ""
},
{
"docid": "5f016bc3786d1b33a9038881c7d9cecb",
"score": "0.6100277",
"text": "def print_timer\n\tputs \"timer_s completed\"\nend",
"title": ""
},
{
"docid": "4282654ce1441f417ba1a137d50e04d0",
"score": "0.6095546",
"text": "def time_component; end",
"title": ""
},
{
"docid": "65c8c591dc09972fdf03ee29311a21df",
"score": "0.6088399",
"text": "def time_us(before, after); end",
"title": ""
},
{
"docid": "5e4551e0e9c42f95877ed692af62be9f",
"score": "0.608752",
"text": "def timer\n\t\tstart = Time.now\n\t\tyield\n\t\tage = Time.now - start\n\n\t\tdiff = age\n\t\tsecs = diff % 60\n\t\tdiff = ( diff - secs ) / 60\n\t\tmins = diff % 60\n\t\tdiff = ( diff - mins ) / 60\n\t\thour = diff % 24\n\n\t\treturn \"%02d:%02d:%02d\" % [ hour, mins, secs ]\n\tend",
"title": ""
},
{
"docid": "a6281353440d79a0788f56924f461141",
"score": "0.60858464",
"text": "def rewrite_dur(t); end",
"title": ""
},
{
"docid": "1aa76deb5133f9768e96eb84ab410030",
"score": "0.6085824",
"text": "def beginning_of_minute\n change(:sec => 0)\n end",
"title": ""
},
{
"docid": "1aa76deb5133f9768e96eb84ab410030",
"score": "0.6085824",
"text": "def beginning_of_minute\n change(:sec => 0)\n end",
"title": ""
},
{
"docid": "58afc33c0f253d1ab4157b7c34bbfbad",
"score": "0.6082491",
"text": "def start_of_minute\n change(:sec => 0)\n end",
"title": ""
},
{
"docid": "bd616eee7a4be853a2647a2fd9222a06",
"score": "0.6080652",
"text": "def tick\n\t\tif @sec < 59\n\t\t\t@sec += 1\n\t\telse\n\t\t\t@sec = 0\n\t\t\tif min < 59\n\t\t\t\t@min += 1\n\t\t\telse\n\t\t\t\t@min = 0\n\t\t\t\tif @hr < 23\n\t\t\t\t\t@hr += 1\n\t\t\t\telse\n\t\t\t\t\t@hr = 0\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "affcb53f3472b4f9b61767b1ea23e38a",
"score": "0.60705775",
"text": "def schedule\n [:interval, '10s']\n end",
"title": ""
},
{
"docid": "fb5fea3049d849fb8f69c7b8fb4e32b4",
"score": "0.60598195",
"text": "def time(*) end",
"title": ""
},
{
"docid": "fb5fea3049d849fb8f69c7b8fb4e32b4",
"score": "0.60598195",
"text": "def time(*) end",
"title": ""
}
] |
603607850bfe3bf548980779c8349d1a
|
creates 20 recipes, one for each user
|
[
{
"docid": "3e03ea79e322850ec0070b013afb7209",
"score": "0.6184878",
"text": "def associate_ingredients_to_recipes\n Recipe.all.each do |recipe|\n 5.times do\n recipe.ingredients << Ingredient.all.sample\n end\n \n recipe.ingredients = recipe.ingredients.uniq\n \n while recipe.ingredients.count < 5\n recipe.ingredients << Ingredient.all.sample\n recipe.ingredients = recipe.ingredients.uniq\n end\n end\nend",
"title": ""
}
] |
[
{
"docid": "8e2e1afa1545e8107d2cd72e7806d261",
"score": "0.71042645",
"text": "def userFill(holder)\n holder.each do | x |\n a_user = User.create!(x)\n recipeMaker(3, a_user)\n end\n # call recipeMaker like 3 times here, which will call subcategories\nend",
"title": ""
},
{
"docid": "95ad4f37512a361732327ff61d65ba88",
"score": "0.6936998",
"text": "def create_ingredients(recipe, count: 2)\n (1..count).map do |i|\n create :ingredient, recipe_id: recipe.id\n end\n end",
"title": ""
},
{
"docid": "0542f67c7597225af725e3d316d9feee",
"score": "0.6574878",
"text": "def userRecipe\n @user_id = params[:id]\n @user = User.find_by(id: @user_id)\n @recipes = Recipe.where(user_id: @user_id)\n end",
"title": ""
},
{
"docid": "6c17709e5e225e7c1ed5d6c7f56f8045",
"score": "0.65647864",
"text": "def index\n @recipe = Recipe.new\n @recipes = current_user.recipes.page(params[:page]).per(15)\n end",
"title": ""
},
{
"docid": "6d51e6d212b53afa98756be29d5df8d8",
"score": "0.6507678",
"text": "def new_users\n print \"\\nadding 5 new users: \"\n users = []\n 5.times do\n print '.'\n user = User.create!(\n email: Faker::Internet.unique.email,\n password: \"password\",\n first_name: Faker::Superhero.descriptor,\n last_name: Faker::Superhero.suffix\n )\n users << user\n end\n users\nend",
"title": ""
},
{
"docid": "3f21cedab91037b9687da54438cd9ee2",
"score": "0.64464486",
"text": "def externalRecipeSeed\n 20.times do\n api_recipe = get_random_recipe()\n createRecipeFromAPI(api_recipe)\n end\nend",
"title": ""
},
{
"docid": "de2635c63b27519565599a20df8609a6",
"score": "0.64320713",
"text": "def create_new_recipe3 user, params\n recipe = Recipe.new(name: params[\"recipe_name\"], create_time: Time.now.to_i, user_id: user.id, user_name: user.name)\n recipe.picture = params[\"recipe_url\"] if params[\"recipe_url\"] != nil\n raise Error::RecipeError, recipe.errors.messages.values[0][0] unless recipe.save\n\n ingredients = params[\"ingredients\"]\n ingredients.each { |ingredient| Ingredient.create(name: ingredient[\"name\"], amount: ingredient[\"amount\"], recipe_id: recipe.id)}\n\n steps = params[\"steps\"]\n steps.length.times { |i| Step.create(index: i+1, content: steps[i], recipe_id: recipe.id)}\n\n recipe\n end",
"title": ""
},
{
"docid": "8b2f0d805bd2ed2d248234cbf838e8f2",
"score": "0.6408215",
"text": "def create_users\n 50.times do\n Person.create(\n first_name: Faker::Name.first_name,\n last_name: Faker::Name.last_name,\n display_name: Faker::Name.title,\n email: Faker::Internet.email,\n password: \"test1234\",\n password_confirmation: \"test1234\"\n )\n end\nend",
"title": ""
},
{
"docid": "65a890842599139369da19de00a2b50d",
"score": "0.6363888",
"text": "def createRecipeFromAPI(randRecipe)\n # make a recipe obj to create for our DB\n recipe = Recipe.create(title: randRecipe[\"title\"], cookbook: Cookbook.all.sample, instructions: randRecipe[\"instructions\"])\n photo = Photo.create(recipe: recipe, img_url: randRecipe[\"image\"], description: \"test photo\")\n ingredients = randRecipe[\"extendedIngredients\"].map do |ing| \n ingredient = Ingredient.find_or_create_by(name: ing[\"name\"].titlecase)\n ri = RecipeIngredient.create(recipe: recipe, ingredient: ingredient, quantity: \"#{ing[\"amount\"]} #{ing[\"unit\"]}\")\n end\nend",
"title": ""
},
{
"docid": "ac60989e94d5b2c893510addea0f84d9",
"score": "0.6359329",
"text": "def index\n @recipes = Recipe.all\n @recipe = Recipe.new\n @user = User.find_by_id(current_user.id)\n end",
"title": ""
},
{
"docid": "ff3e51da74968969f684607e850748af",
"score": "0.63298595",
"text": "def recipes\n # Loop through RecipeCard\n #Find cards for this user\n #Gather recipes on those cards\n self.recipe_cards.map do |recipecard|\n recipecard.recipe\n end\n end",
"title": ""
},
{
"docid": "43d0a315449b9bb519646190bd4688d9",
"score": "0.6313044",
"text": "def make_microposts\r\n users = User.all(limit: 6)\r\n 50.times do\r\n content = Faker::Lorem.sentence(5)\r\n users.each { |user| user.microposts.create!(content: content) }\r\n end\r\nend",
"title": ""
},
{
"docid": "e8166e7599e7da73bc9f6bf4002c6a66",
"score": "0.62965447",
"text": "def seed_users\n 10.times do\n \tu = User.create(name:Faker::Name.name, email:Faker::Internet.free_email, password:\"testing\")\t \n\t\t 5.times do\n\t\t \t\ts = Survey.create(name: Faker::Company.bs)\n\t\t \t\tu.created_surveys << s\n\t\t \t\t\t6.times do\n\t\t\t\t \t\tquestion_text = Faker::Lorem.sentence + \"?\"\n\t\t\t\t \t\tq = Question.create(text: question_text)\n\t\t\t\t \t\t\t\t# each q has 4 choices\n\t\t\t\t \t\t\t4.times do\n\t\t\t\t \t\t\t\tc = Choice.create(choice: Faker::Company.bs)\n\t\t\t\t \t\t\t\tq.choices << c\n\t\t\t\t \t\t\tend\n\t\t\t\t \t\ts.questions << q\n\t\t\t\t \tend\n\t\t \tend\n end\nend",
"title": ""
},
{
"docid": "8365484baaf59de503962ee731b3860b",
"score": "0.62717843",
"text": "def make_33_users\ncounter = 0\n\nwhile counter < 33 \n counter += 1 \n User.create(username: \"evan_#{counter}\", email: \"user#{counter}@user.com\", password_digest: \"password_#{counter}\")\n end \nend",
"title": ""
},
{
"docid": "05e7706b842f892241c550bb5c14bb1f",
"score": "0.62237835",
"text": "def seed_users\n 10.times do\n name = Faker::Movies::PrincessBride.character\n new_user = User.new(username: name.split(\" \").join(\"\"), password: \"1234\")\n new_user.save\n Artist.create(name: name.split(\" \").join(\"\"), user_id: new_user[:id])\n end\nend",
"title": ""
},
{
"docid": "debdb6157aaead331d5ed46916537bb8",
"score": "0.6198082",
"text": "def generate_users\n User.destroy_all\n Profile.destroy_all\n\n puts 'Generating users'\n\n MULTIPLIER.times do\n first_name = Faker::Name.first_name\n last_name = Faker::Name.last_name\n username = Faker::Company.name\n email = Faker::Internet.free_email(\"#{first_name} #{last_name}\")\n\n user = User.new(email: email, password: 'qwerqwer')\n user.build_profile(first_name: first_name, last_name: last_name, username: username)\n user.save!\n end\nend",
"title": ""
},
{
"docid": "5b5084919345ab0b185b10fff101db33",
"score": "0.6195931",
"text": "def make_users\r\n admin = User.create!(name: \"Example User\",\r\n email: \"[email protected]\",\r\n password: \"foobar\",\r\n password_confirmation: \"foobar\",\r\n admin: true)\r\n\r\n 99.times do |n|\r\n name = Faker::Name.name\r\n email = \"example-#{n+1}@railstutorial.org\"\r\n password = \"password\"\r\n User.create!(name: name,\r\n email: email,\r\n password: password,\r\n password_confirmation: password)\r\n end\r\nend",
"title": ""
},
{
"docid": "dce77683ad2d9f7ebcf068fe7d1a6ead",
"score": "0.61866033",
"text": "def setup_data\n user = create(:user)\n another_user = create(:user)\n recipe_type = create(:recipe_type)\n another_recipe_type = create(:recipe_type)\n cuisine = create(:cuisine)\n torta_morango = create(:recipe, title: 'Torta de Morango', difficulty: 'Médio',\n recipe_type: recipe_type, cuisine: cuisine, cook_time: 120,\n ingredients: 'Morango, farinha, ovos',\n cook_method: 'Misture tudo e coloque no forno',\n user: user)\n create(:recipe, title: 'Torta de Limão', difficulty: 'Médio',\n recipe_type: recipe_type, cuisine: cuisine, cook_time: 120,\n ingredients: 'Limão, farinha, ovos',\n cook_method: 'Misture tudo e coloque no forno',\n user: user)\n create(:recipe, title: 'Torta de Abacate', difficulty: 'Médio',\n recipe_type: another_recipe_type, cuisine: cuisine, cook_time: 120,\n ingredients: 'Abacate, farinha, ovos, decoracoes',\n cook_method: 'Misture tudo, coloque no forno, e apos retirar decore a torta',\n user: another_user)\n sobremesas = create(:list, name: 'Sobremesas', user: user)\n create(:list_recipe, list: sobremesas, recipe: torta_morango)\n login_as(user, scope: :user)\n end",
"title": ""
},
{
"docid": "bc1c3bd5cdc6612e91cb9e9271415f15",
"score": "0.61729264",
"text": "def create\n @recipe = Recipe.new(params[:recipe])\n\n respond_to do |format|\n if @recipe.save\n Instruction.multi_save(params[:instructions], @recipe)\n Ingredient.multi_save(params[:ingredients], @recipe)\n current_user.recipes << @recipe\n current_user.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render json: @recipe, status: :created, location: @recipe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b5c1bcd3151e0b69b74ca8cec0088d0d",
"score": "0.6151063",
"text": "def make_microposts\n # Generate 50 posts for 6 users. Use Faker to generate some content for the Microposts.\n 50.times do\n User.all(:limit => 6).each do |user|\n user.microposts.create!(:content => Faker::Lorem.sentence(5))\n end\n end\nend",
"title": ""
},
{
"docid": "5748991e21d442ad97305cb34554e3de",
"score": "0.6148951",
"text": "def user_accounts\n \n 3.times do\n user = User.new\n user.username = Faker::Internet.user_name\n user.email = Faker::Internet.email\n user.password = \"123456789\"\n user.password_confirmation = \"123456789\"\n user.save!\n puts \"created user\"\n end\nend",
"title": ""
},
{
"docid": "40a04d3b3612b62c946218cfe03e0d86",
"score": "0.6136669",
"text": "def generate_shopping_list\n\n #pull out whichever recipe you are clicking on\n recipe = Yummly.find(params[:yummly_id])\n\n # create a recipe for the database for future use\n r = Recipe.find_or_create_by(name: recipe.name, thumbnail: recipe.thumbnail)\n\n #create new shopping list for each recipe\n s = ShoppingList.create(\n name: recipe.name, \n yummly_id: params[:yummly_id],\n user_id: current_user.id,\n recipe_id: r.id)\n\n #find recipe and ingredient name from yummly\n recipe.ingredients.each do |ingredient|\n ShoppingListItem.create(done: nil, shopping_list_id: s.id, ingredient_name: ingredient, ingredient_quantity: nil, ingredient_quantity_unit: nil)\n end\n\n redirect_to recipes_url, notice: \"Added recipe to your shopping lists\"\n\n end",
"title": ""
},
{
"docid": "f043221b456210e3ff8e2978c6f14998",
"score": "0.6135199",
"text": "def create_new_recipe2 user_id, user_name, params\n recipe = Recipe.new\n recipe.name = params[:recipe_name]\n recipe.create_time = Time.now().to_i\n recipe.user_id = user_id\n recipe.user_name = user_name\n recipe.picture = \"uploads/user#{user_id}recipe#{recipe.create_time}.jpg\" if params[:recipe_file] != nil\n raise Error::CreateRecipeError, recipe.errors.messages.values[0][0] unless recipe.save\n\n threads = []\n if params[:recipe_file] != nil\n threads << Thread.new { File.open(\"public/#{recipe.picture}\", \"wb\") { |file| file.write params[:recipe_file][:tempfile].read } }\n end\n\n ingredients = JSON.parse params[:ingredients]\n ingredients.length.times do |i|\n Ingredient.create(name: ingredients[i][\"name\"], recipe_id: recipe.id, amount: ingredients[i][\"amount\"])\n end\n\n steps = params[:steps].to_i\n steps_text = JSON.parse params[:steps_text]\n steps.times do |i|\n step = Step.new(recipe_id: recipe.id, index: i+1, content: steps_text[i])\n if (params[\"steps_file#{i+1}\"] != nil)\n step.picture = \"uploads/recipe#{recipe.id}step#{i+1}.jpg\"\n threads << Thread.new { File.open(\"public/#{step.picture}\", \"wb\") { |file| file.write params[\"steps_file#{i+1}\"][:tempfile].read } }\n end\n step.save\n end\n\n recipe\n end",
"title": ""
},
{
"docid": "09d6c087281d6275e818ca813dc933be",
"score": "0.61108327",
"text": "def find_recipes_that_use_me_and_create_link\n my_recipes = Recipe.search_recipe_ingredient_lists_for_ingredient(self)\n my_recipes.each {|recipe| self.recipes << recipe}\n end",
"title": ""
},
{
"docid": "0e0fd917480f5106a4a218581c340122",
"score": "0.6100605",
"text": "def add_ingredientusers(ingredients)\n ingredients.each {|ingredient| IngredientUser.create(user_id: self.id, ingredient_id: ingredient.id)}\n end",
"title": ""
},
{
"docid": "82f9da054062c292f0de578e05fa9cb2",
"score": "0.60746306",
"text": "def loop_it(users, trait)\n users.each do |user|\n users.each do |boozer|\n rand_num = rand(1..100)\n Rating.create(value: rand_num, rater_id: user.id, ratee_id: boozer.id, trait_id: trait.id)\n end\n end\nend",
"title": ""
},
{
"docid": "70bb610ff1e698a7163b6789613836cb",
"score": "0.6061104",
"text": "def create_orders(count)\n users = User.where(admin: false)\n i = 0\n while i < count.to_i && users.count > 0 do\n Order.create(user: users[i % users.count], total_amount: 0,\n shipping_address: Faker::Address.street_address)\n i += 1\n end\nend",
"title": ""
},
{
"docid": "c5f43492b53b906a1784499c441c2cac",
"score": "0.6041197",
"text": "def make_microposts\n #this was above but upon merge I found my file & moved this here\n #10.23: Adding mp's to sample data, looping thru 6 users & adding 50 mp's\n users = User.all(limit: 6)\n 51.times do\n content = Faker::Lorem.sentence(5)\n users.each { |user| user.microposts.create!(content: content) }\n #to generate:\n #bundle exec rake db:reset\n # bundle exec rake db:populate\n\n end\nend",
"title": ""
},
{
"docid": "ad4704923a3f82c6ef4181756a27386b",
"score": "0.60306436",
"text": "def create\n user = current_user\n if params[:id]\n @recipe = Recipe.new(name: params[:name],\n description: params[:description],\n ingredients: params[:indredients],\n instructions: params[:instructions],\n servings: params[:servings],\n original_id: params[:id])\n else\n @recipe = Recipe.new(recipe_params)\n end\n user.recipes << @recipe\n if user.save\n render json: @recipe, status: :created\n else\n render json: {message: \"something went wrong\"}\n end\n end",
"title": ""
},
{
"docid": "572b2b43504bc205ca7a111a6fe4498c",
"score": "0.6003742",
"text": "def create_recipe(row, db)\n name = row[0]\n ingredients= Array.new\n # function to run through row after index\n\n row[2..-1].each do |item|\n get_food = db[item]\n ingredients.push(get_food)\n end\n Recipe.new(name, ingredients)\n end",
"title": ""
},
{
"docid": "94e291b4683b7db660d65e151431019b",
"score": "0.6003572",
"text": "def create\n\n @recipe = Recipe.new(recipe_params)\n @recipe.recipe_creator_id = current_user.id\n @recipe.allergies = get_allergies_from_params\n @recipe.ingredients = get_selected_ingredients\n\n #Shows an example on how to automatically check whether a recipe is suitable for a person with an intolerance\n laktoseintoleranz = Allergy.where(name: 'Laktoseintoleranz').first\n unless @recipe.allergies.include?(laktoseintoleranz)\n neo = Neography::Rest.new({:username => \"user\", :password => \"user\"})\n includes_laktose_ingredient = false\n\n @recipe.ingredients.each do |ingredient|\n node = neo.execute_query(\"MATCH (n)-[]->(i) WHERE n.name = 'Laktoseintoleranz' AND i.name = '#{ingredient.name}' RETURN i\")\n if node[\"data\"].present?\n includes_laktose_ingredient = true\n end\n end\n unless includes_laktose_ingredient\n @recipe.allergies << laktoseintoleranz\n end\n end\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f26f0734191b8b2b9d3b2ffa1139e230",
"score": "0.5993901",
"text": "def create\n name = @view.ask_user_for_info(\"name\")\n description = @view.ask_user_for_info(\"description\")\n prep_time = @view.ask_user_for_attribute(\"prep_time\")\n difficulty = @view.ask_user_for_attribute(\"difficulty\")\n recipe = Recipe.new(name: name, description: description, prep_time: prep_time, difficulty: difficulty)\n @cookbook.add_recipe(recipe)\n end",
"title": ""
},
{
"docid": "6f32750a7e1386412593e208ba3f18a7",
"score": "0.5984274",
"text": "def create_entries_for_user(_user)\n entries = []\n (0..30).each do |_number|\n entries << EntryBuilder.new(number).entry\n end\n end",
"title": ""
},
{
"docid": "1f6de4975c5f2960e3f2ba9826edb8b8",
"score": "0.5957638",
"text": "def safe_recipes\n safe_recipes_array =[]\n #get all the recipies of a user\n all_user_rec = self.recipes\n #get user allergens\n user_allergens = self.allergens\n all_user_rec.each do |recipe|\n y = 0\n recipe.ingredients.each do |ingredient|\n if user_allergens.include?(ingredient)\n y = 1\n end\n end\n safe_recipes_array << recipe if y == 0\n end\n safe_recipes_array\n\n #return array of recipe objects that are safe\n\n end",
"title": ""
},
{
"docid": "6097ae245e6296b1604dca44d81f4d9c",
"score": "0.5956437",
"text": "def seed_clients\n 10.times do |n|\n Client.create!({\n sex: %w(male female other).sample,\n year_of_birth: [*1950..2004].sample,\n cell_phone: fake_cell_phone,\n category_ids: [1, 2, 3, 4].sample\n })\n end\nend",
"title": ""
},
{
"docid": "49d689087d0c5cb22cb154642811427f",
"score": "0.59237736",
"text": "def generate_users\n @users = (1..GEN_USERS).to_a\n ([email protected]).each do |user|\n username = Faker::Internet.user_name\n email = Faker::Internet.safe_email(username)\n unless User.create!(username: username, email: email)\n puts \"*********** ERROR ******************\"\n end\n end\nend",
"title": ""
},
{
"docid": "29921207a83ab32d4744932248a515c0",
"score": "0.59167445",
"text": "def my_recipes\n @recipes = @user.savedrecipe.recipe\n end",
"title": ""
},
{
"docid": "0e4e4356aa7cb64a201e16b03fd44878",
"score": "0.5890181",
"text": "def create\n new_recipe = Recipe.create(recipe_params)\n redirect_to user_recipes_path(new_recipe.user)\n end",
"title": ""
},
{
"docid": "af6ec53ba13a068dc8155bbc36de0ced",
"score": "0.58856875",
"text": "def recipes # /v1/user/:id/recipes (GET)\n recipes = ::Recipe.all\n render json: recipes, :each_serializer => RecipeSmallSerializer, root: false, status: 200\n end",
"title": ""
},
{
"docid": "e3428f57208443b6fb1fdf4690d7b960",
"score": "0.5859887",
"text": "def create\n puts recipe_params[:ingredients], recipe_params[:recipe], recipe_params[:user_id]\n recipe = Recipe.create(recipe_params[:recipe])\n if(recipe.valid?)\n Ingredient.create_and_assign(recipe_params[:ingredients], recipe.id)\n newUR = UserRecipe.create(recipe_id: recipe.id, user_id: recipe_params[:user_id])\n render json: UserRecipeSerializer.new(newUR).to_serialized_json\n else\n render json: recipe.errors.full_messages\n end\n end",
"title": ""
},
{
"docid": "32af821b8bfd0ef222c9053d87400691",
"score": "0.585497",
"text": "def populate_services\n\t\tusers \t= User.limit(5)\n\t\tswitch\t= true\n\n\t\t# Loop through each user\n\t\tusers.each do |u|\n\t\t\t# Each user will create 8 services\n\t\t\t15.times do |n|\n\t\t\t\tservice_hash \t= random_service_hash\n\t\t\t\ttitle \t\t\t= \"#{n} \" + service_hash[:desc][:title]\n\t\t\t\theadline \t\t= service_hash[:desc][:headline]\n\t\t\t\tsummary \t\t= Faker::Lorem.paragraphs(5).join(\"\\n\\n\")\n\t\t\t\tprice \t\t\t= service_hash[:price]\n\t\t\t\tcategory \t\t= service_hash[:desc][:category]\n\t\t\t\ttags \t\t\t= service_hash[:desc][:tag]\n\t\t\t\tlocation \t\t= service_hash[:location]\n\t\t\t\taddress \t\t= Faker::Address.street_address\n\t\t\t\tstate \t\t\t= Faker::Address.state_abbr\n\t\t\t\tcity\t\t\t= Faker::Address.city\n\t\t\t\tzip \t\t\t= Faker::Address.zip_code\n\t\t\t\t\n\t\t\t\t# Create the service\n\t\t\t\tu.services.create!(title: title, \n\t\t\t\t\t\t\t\t\t\theadline: headline, \n\t\t\t\t\t\t\t\t\t\tsummary: summary, \n\t\t\t\t\t\t\t\t\t\tlocation: location,\n\t\t\t\t\t\t\t\t\t\taddress: address,\n\t\t\t\t\t\t\t\t\t\tcity: city,\n\t\t\t\t\t\t\t\t\t\tstate: state,\n\t\t\t\t\t\t\t\t\t\tzip: zip,\n\t\t\t\t\t\t\t\t\t\tprice: price,\n\t\t\t\t\t\t\t\t\t\tcategory: category, \n\t\t\t\t\t\t\t\t\t\ttags: tags )\n\t\t\t\t# Every other service will get 5 reviews and ratings\n\t\t\t\tif switch\n\t\t\t\t\treview_lender(u)\n\t\t\t\t\tswitch = false\n\t\t\t\telse\n\t\t\t\t\tswitch = true\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "49c2f6157290fec0a7f64e2153afb51f",
"score": "0.58547515",
"text": "def initialize(user, recipe, date, rating)\n @user = user\n @recipe = recipe\n @date = date\n @rating = rating\n @@all << self\n end",
"title": ""
},
{
"docid": "e0186a471b17ad80a541ba33084d2ee3",
"score": "0.5843761",
"text": "def generate_recipes_list\n recipes = YARD::Registry.all(:recipe).uniq.sort_by {|recipe| recipe.Name.to_s}\n generate_full_list(recipes, 'Recipe', 'recipes')\nend",
"title": ""
},
{
"docid": "ea9c151422d19f4024c752aa9ca9d445",
"score": "0.5809231",
"text": "def add_extra_projects\n users = User.all\n n = 0\n users.each do |u|\n n += 1\n next if n < 20 || rand < 0.2 || u.projects.count.positive?\n\n u.projects.create(title: \"Project #{n}: #{Faker::Company.catch_phrase}\",\n source_code_url: Faker::Internet.url,\n deployed_url: Faker::Internet.url,\n description: \"Description #{n}: #{Faker::Lorem.paragraph(10)}\",\n created_at: 11.minutes.ago,\n updated_at: 10.minutes.ago)\n end\nend",
"title": ""
},
{
"docid": "9b30d511f4e1513bcdb001ffe155183c",
"score": "0.5803998",
"text": "def index\n @recipes = Recipe.where(user_id: current_user.id)\n end",
"title": ""
},
{
"docid": "4bebe870fd353eadbfec00a2d9c30636",
"score": "0.5772387",
"text": "def signup(n=N)\n puts \"-- Signup #{n} Users\"\n n.times do |i|\n User.create(\"testuser#{i}\", \"password#{i}\")\n end\nend",
"title": ""
},
{
"docid": "999bd0338025586328f2ee35c0b1ceff",
"score": "0.5729173",
"text": "def add_attributes_to_recipes\n EasyVegan::Recipe.all.each do |recipe|\n recipe.add_recipe_attributes(EasyVegan::Scraper.scrape_recipe_page(recipe.url))\n #binding.pry\n end\n end",
"title": ""
},
{
"docid": "5842b754ee471b3513dbb49cfe578c43",
"score": "0.57247955",
"text": "def clean_up_user_recipes\n\n allergen_found = 0\n\n self.recipes.each do |r|\n i = r.ingredients.compact\n\n # for each ingredient\n i.each do |ingr| \n ## see if user is allergic\n get_allergy_ids.each do |ua_id|\n if (ingr.allergen1_id == ua_id) or (ingr.allergen2_id == ua_id) or (ingr.allergen3_id == ua_id)\n allergen_found = 1\n break\n end\n end\n end\n ## set active to false if user has selected an allergy that conflicts with the recipe\n if allergen_found == 1 \n ur = UsersRecipe.find(:first, :conditions => {:user_id => self.id, :recipe_id => r.id})\n ur.active = false\n ur.save! \n end\n allergen_found = 0\n end \n end",
"title": ""
},
{
"docid": "dfc6ada83a1f44aa9cd384bc5444fdae",
"score": "0.57239634",
"text": "def c_users(first, last, isCustomer = false)\n un = \"#{first}#{last}\" # username\n un = un.delete(' ')\n user = User.create(first_name: first,\n last_name: last,\n user_name: un,\n img_path: \"profiles/#{un}.png\",\n email: Faker::Internet.email,\n role: isCustomer ? USER : TECHY,\n password: PW)\n puts \"#{isCustomer ? 'Customer' : 'Techy'}: #{un}\"\n\n # add one offer per techy\n unless isCustomer\n # generate 1 to 5 skills -> connected numbers\n skill_id = rand(0...Skill.count - 4)\n skills = Skill.all[skill_id..(skill_id + rand(0..4))]\n # randomize available_now -> only 1/3 are true\n now = (rand(1..3) % 2).zero?\n # generate rate\n rate = rand(25..150)\n # reviews\n puts \"\\n\"\n reviews = []\n rand(2..6).times do\n review = Review.create(\n title:REVIEW_TITLE.sample,\n content:REVIEW_CONTENT.sample,\n rating:rand(4..5)\n )\n reviews.push(review)\n end\n # create offer\n offer = Offer.create(title: c_title(skills.sample),\n description: Faker::Hacker.say_something_smart,\n user: user,\n skills: skills,\n available_now: now,\n hourly_rate: rate,\n reviews: reviews)\n puts \"-> added offer\"\n skills.each { |skill| puts \" #{skill.name}\" }\n end\nend",
"title": ""
},
{
"docid": "7c2caddefa13b12fe30817868641715c",
"score": "0.57238364",
"text": "def create_users\n puts 'Creating Users'\n\n locations = Location.pluck(:id)\n\n #creates the default known users\n users = default_users\n\n used_names = Set.new\n while users.count < 1000 do\n random_first_name = Faker::Name.first_name\n random_last_name = Faker::Name.last_name\n random_location = locations.sample\n\n user_name = Faker::Internet.user_name(\"#{random_first_name} #{random_last_name}\")\n #ensures that there are only unique names\n next if used_names.include?(user_name)\n email = \"#{user_name}@#{Faker::Internet.domain_name}\"\n\n\n user = User.new(location_id: random_location, user_name: user_name,\n email: email, password: 'CS5200',\n first_name: random_first_name, last_name: random_last_name)\n\n next unless user.valid?\n\n users << user\n used_names.add(user_name)\n end\n #validate is false because secret validation with password prevents the import\n User.import(users, validate: false)\n end",
"title": ""
},
{
"docid": "0ea1cf6b8d6a9ea4aa4f94aaecaf51e7",
"score": "0.57159007",
"text": "def create_data_test\n 5.times do\n user = User.make\n user.save\n #creeate and assing list\n 5.times do\n list=List.make\n list.save\n user.lists << list\n end\n #create and assign contacts\n 5.times do\n user.contacts << create_contact\n ContactList.create(:list => user.lists.first, :contact => user.contacts.last)\n ContactList.create(:list => user.lists.last, :contact => user.contacts.last)\n end\n user.save\n end\nend",
"title": ""
},
{
"docid": "0d2d25ec9f07a8ab08110a315046bf90",
"score": "0.57135046",
"text": "def create_recipe(title, ingredients_array, steps)\n recipe = Recipe.find_or_create_by(title: title, steps: steps)\n recipe.ingredients = Ingredient.create_ingredients_from_array(ingredients_array)\n recipe\n end",
"title": ""
},
{
"docid": "fc74601d5955bc2bcdfb2828cec7f9ff",
"score": "0.56845486",
"text": "def initialize(recipe, date, rating, user)\n @recipe = recipe\n @rating = rating\n @date = date\n @user = user\n @@all << self\n end",
"title": ""
},
{
"docid": "dc244bb03edaa5d266109dc5359d11cc",
"score": "0.5680239",
"text": "def create\n @recipe = Recipe.new(recipe_params)\n params[:recipe][:ingredients].each do |ingredient_id|\n next if ingredient_id.to_i == 0\n ingredient = Ingredient.find(ingredient_id.to_i)\n @recipe.ingredients << ingredient\n end\n params[:recipe][:gadgets].each do |gadget_id|\n next if gadget_id.to_i == 0\n gadget = Gadget.find(gadget_id.to_i)\n @recipe.gadgets << gadget\n end\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render action: 'show', status: :created, location: @recipe }\n else\n format.html { render action: 'new' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "65c8c4988f2a8ae6dabcdb581746928d",
"score": "0.56680465",
"text": "def set_recipe\n @user = User.find(params[:user_id])\n @recipe = @user.recipes.find(params[:id])\n end",
"title": ""
},
{
"docid": "fed546d44aeb8765244bf5a46ebf067f",
"score": "0.5660836",
"text": "def make_user!(attributes={})\n User.make(attributes) do |user|\n user.accounts.make do |account|\n account.searches.make\n 4.times { account.links.make }\n account.searches.first.followed_people.make\n account.followed_people.make\n end\n end\nend",
"title": ""
},
{
"docid": "696d8f0827762828364ca5d7e405dfeb",
"score": "0.56544036",
"text": "def create_question_responses\n 10.times do\n response = Response.create(content: \"that sucks\", response_context_type: \"Question\", response_context_id: rand(1..12))\n User.find(rand(3)+1).responses << response\n end\nend",
"title": ""
},
{
"docid": "8f98b7fd8c91603a4341dca6dfdb4d91",
"score": "0.5652917",
"text": "def apply_recipe(recipe)\n # Creates a random string name\n recipe_name = \"recipe~test~#{(0...8).map { (65 + rand(26)).chr }.join}\"\n recipe_loc = File.join(File.dirname(__FILE__), '..', 'recipes',\n \"#{recipe_name}.rb\")\n\n File.open(recipe_loc, 'w') do |file|\n file.write([build_cred, recipe].join(\"\\n\"))\n end\n recipe_path = \"google-gbigquery::#{recipe_name}\"\n begin\n yield recipe_path\n ensure\n File.delete(recipe_loc)\n end\n end",
"title": ""
},
{
"docid": "77e5f1a3db887fd853835731dc7e0e69",
"score": "0.56497616",
"text": "def create_franchises\n 8.times do \n Franchise.create(company_id: Company.all.sample.id, owner_id: Owner.all.sample.id, location: Faker::Address.city, profit: Faker::Number.within(range: -1000.00..1000000.00))\n end\nend",
"title": ""
},
{
"docid": "b2bf4b60f33aba16a9f18e4a87cbe3ce",
"score": "0.5640827",
"text": "def index\n @recipe_users = RecipeUser.all\n end",
"title": ""
},
{
"docid": "047c4be385762f3a029258473933f4ff",
"score": "0.5613253",
"text": "def test_item\n 20.times do |i|\n new_item = Item.new\n new_item.title = Faker::Name.name\n new_item.description = Faker::Lorem.paragraph(8)\n new_item.price = Faker::Number.decimal(2)\n new_item.image_url = Faker::Avatar.image\n # temporaly, add item to first category\n new_item.category_id = Category.first.id\n new_item.save\n end\nend",
"title": ""
},
{
"docid": "70b42247acfa35b7be11c622d325371e",
"score": "0.56059635",
"text": "def add_recipe(recipe:, multiplier: 1)\n full_names = recipe.ingredients_full_names(multiplier: multiplier)\n full_names.map { |ingredient| create_task(ingredient) }\n # TODO: count the responses instead of the given list\n full_names.count\n end",
"title": ""
},
{
"docid": "1c1f1eac262088b06bbd5f534c2690db",
"score": "0.5602548",
"text": "def setup_discover\n return if @recipes.blank?\n \n @recipes.each do |recipe|\n recipe.setup_recipe\n end\n @have_ingredients = current_user.kitchen.have_ingredients\n @starred_ids = current_user.kitchen.starred_meal_ingredient_ids \n @my_meals_ids = current_user.kitchen.my_meals_recipe_ids\n end",
"title": ""
},
{
"docid": "4ff4e0fca294d83b8157d6efaf46241e",
"score": "0.5594833",
"text": "def add_extra_openings\n users = User.all\n n = 0\n users.each do |u|\n n += 1\n next if n < 20 || rand < 0.2 || u.openings.count.positive?\n\n u.openings.create(title: \"Opening #{n}: #{Faker::Job.title}\",\n description: \"Description #{n}: #{Faker::Lorem.paragraph(10)}\",\n created_at: 11.minutes.ago,\n updated_at: 10.minutes.ago)\n end\nend",
"title": ""
},
{
"docid": "ac9774dab49ab3659acf86d6b396deaf",
"score": "0.5592604",
"text": "def create\n @recipe = current_user.recipes.build(recipe_params)\n \n if @recipe.save\n redirect_to @recipe, notice: \"Successfully created new recipe\"\n else\n render 'new'\n end\n end",
"title": ""
},
{
"docid": "caf85c0b8e304d7bad1c4aabb418cfe4",
"score": "0.5587229",
"text": "def create\n @recipe = current_user.recipes.build(recipe_params)\n @recipe.user = current_user\n @recipe.save\n @measurs = Array.new\n @ingrs = Array.new\n @tgs = Array.new\n #ovo bi trebalo unutar sebe prikupiti sastojke i mjere\n parse_ingredients\n parse_tags\n @recipe.measurements = @measurs\n @recipe.ingredients = @ingrs\n @recipe.recipe_tags = @tgs\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ac45436b4fc989241668e993b2f9ca6c",
"score": "0.5583989",
"text": "def recipes\n @recipes ||= []\n end",
"title": ""
},
{
"docid": "4d362c8d814ebfef50676af6cecae083",
"score": "0.55773073",
"text": "def create\n @recipe = Recipe.new(params[:recipe])\n\n respond_to do |format|\n if @current_user.recipes << @recipe\n flash[:notice] = 'Recipe was successfully created.'\n format.html { redirect_to recipe_url(@recipe) }\n format.xml { head :created, :location => recipe_url(@recipe) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @recipe.errors.to_xml }\n end\n end\n end",
"title": ""
},
{
"docid": "93c3b43b1f8efa412c5ff92947181098",
"score": "0.5576161",
"text": "def apply_recipe(recipe)\n # Creates a random string name\n recipe_name = \"recipe~test~#{(0...8).map { (65 + rand(26)).chr }.join}\"\n recipe_loc = File.join(File.dirname(__FILE__), '..', 'recipes',\n \"#{recipe_name}.rb\")\n\n File.open(recipe_loc, 'w') do |file|\n file.write([build_cred, recipe].join(\"\\n\"))\n end\n recipe_path = \"google-gcompute::#{recipe_name}\"\n begin\n yield recipe_path\n ensure\n File.delete(recipe_loc)\n end\n end",
"title": ""
},
{
"docid": "93c3b43b1f8efa412c5ff92947181098",
"score": "0.5576161",
"text": "def apply_recipe(recipe)\n # Creates a random string name\n recipe_name = \"recipe~test~#{(0...8).map { (65 + rand(26)).chr }.join}\"\n recipe_loc = File.join(File.dirname(__FILE__), '..', 'recipes',\n \"#{recipe_name}.rb\")\n\n File.open(recipe_loc, 'w') do |file|\n file.write([build_cred, recipe].join(\"\\n\"))\n end\n recipe_path = \"google-gcompute::#{recipe_name}\"\n begin\n yield recipe_path\n ensure\n File.delete(recipe_loc)\n end\n end",
"title": ""
},
{
"docid": "8a2f953053f89ce158ac6ca913330d66",
"score": "0.5573303",
"text": "def make_ivory_tower\n 5.times do |n| \n user = make_user\n journal = make_journal\n journal.save!\n publication = make_publication\n article = make_article\n section_array = []\n 3.times { |n| section_array << make_section }\n author = make_author\n journal.publications << publication\n publication.articles << article\n article.authors << author\n section_array.each { |section| article.sections << section }\n end\nend",
"title": ""
},
{
"docid": "10282f9973f165cc93c3660747d79e12",
"score": "0.5563855",
"text": "def create\n @recipe = Recipe.new(recipe_params)\n if params['ingredients']\n params['ingredients'].each do |ingredient_name|\n @recipe.ingredients << Ingredient.find_by(name: ingredient_name)\n end\n end\n\n @recipe.save \n redirect_to recipes_path\n end",
"title": ""
},
{
"docid": "68d0db0555456d30e3e5112ff60f61ea",
"score": "0.5563132",
"text": "def new\n @recipe = current_user.recipes.build\n end",
"title": ""
},
{
"docid": "857f0c9208e2a06ebce6eea38791a8d0",
"score": "0.5558432",
"text": "def add_recipe(name, foods)\n # Check if any items in foods don't exist in DB\n foods.each do |food|\n if not @basic_foods.has_key? food and not @recipes.has_key? food\n puts \"Food doesn't exist in DB\"\n return\n end\n end\n # Check if name already exists in hash tables\n if @basic_foods.has_key? name or @recipes.has_key? name\n puts \"Food already exists in DB\"\n else\n @recipes[name] = Recipe.new(name, foods)\n end\n end",
"title": ""
},
{
"docid": "5d3e72e209eb49d41b28e88fc5dd9c5d",
"score": "0.55439985",
"text": "def initialize(user, recipe, date, rating)\n @user = user\n @recipe = recipe\n @date = date\n @rating = rating\n @@all << self # adds current RecipeCard to the list of all RecipeCards\n end",
"title": ""
},
{
"docid": "33500f5c7e34c4345f6a746d19bca3a7",
"score": "0.55382985",
"text": "def create_Ants\n while @food > 0\n create_random_Ant\n create_Ant_Room\n end\n \n end",
"title": ""
},
{
"docid": "467fca213683355bad38223c377976bb",
"score": "0.55381846",
"text": "def create\n @recipe = current_user.recipes.build(recipe_params)\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "50e5fde1a16db3cceb155ef994a324d6",
"score": "0.5536013",
"text": "def fill_database(db, number_of_people, number_of_villages)\r\n number_of_people.to_i.times do\r\n fill_nightswatch(db, Faker::GameOfThrones.character, Faker::GameOfThrones.house, Faker::Number.between(1, number_of_villages), Faker::Number.between(1, 5), Faker::Number.between(1, 60))\r\n end\r\n number_of_villages.times do\r\n fill_village_table(db, Faker::GameOfThrones.city)\r\n end\r\nend",
"title": ""
},
{
"docid": "7e9eccb6bb4dbe262cef2c2c0091c79c",
"score": "0.5528138",
"text": "def create\n @recipe = Recipe.new(params[:recipe])\n\n respond_to do |format|\n if @current_user.recipes << @recipe\n flash[:notice] = 'Recipe was successfully created.'\n format.html { redirect_to edit_recipe_url(@recipe) }\n format.xml { head :created, :location => recipe_url(@recipe) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @recipe.errors.to_xml }\n end\n end\n end",
"title": ""
},
{
"docid": "5501e70bf4caa3e3655d65c8050c3b1f",
"score": "0.5513461",
"text": "def create\n @recipe = Recipe.new(recipe_params)\n\n respond_to do |format|\n if @recipe.save\n count = 1\n complete_directions = \"\"\n params[\"directions\"].each do |direction|\n complete_directions += direction + \"\\n\"\n count += 1\n end\n @recipe.directions = complete_directions\n params[\"ingredients\"].each_with_index do |ingredient, index|\n found = false\n Ingredient.all.each do |db_ingredient|\n if db_ingredient.name == ingredient\n @ingredient = db_ingredient\n Recipeingredient.create({:ingredient_id => @ingredient.id, :recipe_id => @recipe.id, :amount => params[\"amounts\"][index]})\n found = true\n end\n end\n if found == false\n @ingredient = Ingredient.create({:name => ingredient})\n Recipeingredient.create({:ingredient_id => @ingredient.id, :recipe_id => @recipe.id, :amount => params[\"amounts\"][index]})\n end\n end\n Userrecipe.create({:contribution_id => @recipe.id, :user_id => current_user.id})\n if params[\"tags\"] != nil\n params[\"tags\"].each do |tag|\n @tag = Tag.find_by_name(tag)\n Recipetag.create({:recipe_id => @recipe.id,:tag_id => @tag.id})\n end\n end\n @recipe.serves = params[\"serves\"]\n @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "240011514f8e4cdc2487123b9f631c9e",
"score": "0.5501113",
"text": "def add_ingredients(ingredients)\n ingredients.each { |i| RecipeIngredient.new(self, i) }\n end",
"title": ""
},
{
"docid": "0f21b054e6f0082d7b1a8f2a5ff9db75",
"score": "0.5500349",
"text": "def make_tags\r\n Post.all.each do |post|\r\n 10.times do\r\n name = Faker::Lorem.word\r\n post.tags.create!(name: name)\r\n end\r\n end\r\nend",
"title": ""
},
{
"docid": "3e2bb60288436c52f62d1f37cd5a14a3",
"score": "0.5498013",
"text": "def addRecipe\n\n params['results'].each do |result|\n recipe = Recipe.new\n recipe.title = result[1]['name']\n if result[1]['images'] &&\n result[1]['images'].values.first[\"large_image_path\"] != '/photos/large/missing.png'\n # deal with ridiculous image nesting\n recipe.image_url = result[1]['images'].values.first[\"large_image_path\"]\n else\n recipe.image_url = nil # for recipes with no images\n end\n recipe.description = result[1]['description']\n recipe.method = result[1]['instructions']\n recipe.ingredients = result[1]['ingredients']\n recipe.cook_time = 15 + rand(26)\n recipe.nbr_times_cooked = 5 + rand(146)\n recipe.user_rating = 1 + rand(5)\n if recipe.image_url\n recipe.save\n else\n next\n end\n end\n\n redirect_to root_path # lol this don't work no good\n\n end",
"title": ""
},
{
"docid": "b9611885b7e18d48a0be66ae06a88b18",
"score": "0.54980063",
"text": "def creates_stickers_collection_to_user quantity=15\n\t\tsticker_default_ids = StickerDefault.pluck(:id)\n\t\tquantity.times do \n\t\t\tposition_selected_sticker_default_ids = \n\t\t\t\t\t\t\trand(0..sticker_default_ids.size-1)\n\t\t\tstickers.create({sticker_default_id: \n\t\t\t\tsticker_default_ids[position_selected_sticker_default_ids]})\n\t\tend\n\tend",
"title": ""
},
{
"docid": "82ebd67f6906e716ee7dbfa9e763eff4",
"score": "0.5493562",
"text": "def create_additional_addresses(amount)\n amount.times do\n profile = UserProfile.all.sample\n Address.create fake_address(profile_id: profile.id)\n end\nend",
"title": ""
},
{
"docid": "d5d3d3c5748fb3b431160b49f8bc7395",
"score": "0.54844165",
"text": "def create\n recipe_name = @view.ask_name\n recipe_description = @view.ask_description\n recipe = Recipe.new(recipe_name, recipe_description)\n @cookbook.add_recipe(recipe)\n @view.listing\n end",
"title": ""
},
{
"docid": "6f28821875c2c4f48d31123bec7c06c0",
"score": "0.5482885",
"text": "def create_orders_over_time(amount)\n amount.times do\n profile = UserProfile.all.sample\n created = Faker::Time.between(1.years.ago, Time.now)\n updated = Faker::Time.between(created, Time.now)\n Order.create(\n user_id: profile.id,\n shipping_address_id: profile.shipping_address_id,\n billing_address_id: profile.billing_address_id,\n cc_id: profile.cc_id, in_cart: false,\n created_at: created, updated_at: updated\n )\n add_products(order_id: Order.last.id)\n end\nend",
"title": ""
},
{
"docid": "553b0e2adad88d76d865df34f62df6a3",
"score": "0.547953",
"text": "def seed_posts(count)\n (1..count).map do\n post = Post.create!(title: Faker::Lorem.words(number: rand(2..10)).join(' '),\n content: Faker::Lorem.paragraphs(number: rand(2..8)).join(' '),\n user: User.create!(login: Faker::Name.unique.last_name))\n post.ratings.create!(rating: rand(1..5))\n post\n end\n end",
"title": ""
},
{
"docid": "bd5704245c316c658896bc8496dbb7e2",
"score": "0.5478094",
"text": "def create\n\n @recipe = Recipe.new(recipe_params)\n @recipe.user = current_user\n\n \n\n respond_to do |format|\n if @recipe.save\n recipe_ingredient_group = @recipe.recipe_ingredient_groups.new\n recipe_ingredient_group.name = \"Main ingredients\"\n recipe_ingredient_group.save\n format.html { redirect_to @recipe, notice: \"Recipe was successfully created.\" }\n format.json { render :show, status: :created, location: @recipe }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e4638ba9a81026238bbf18ed5554ac69",
"score": "0.5477601",
"text": "def generate_participants(micropost, num_participants)\r\n\towner = micropost.user\r\n\t\r\n\twhile num_participants > 0 do\r\n\t\tparticipant = FactoryGirl.create(:user)\r\n\t\t\r\n\t\tmake_friends(owner, participant)\r\n\t\tparticipant.participate(micropost)\r\n\t\t\r\n\t\tnum_participants-=1\r\n\tend\r\nend",
"title": ""
},
{
"docid": "e4a81873a4bdf3e49f75dd38cdb4ba87",
"score": "0.54751384",
"text": "def user\n\t\t@recipes = Recipe.find_by_user_id(params[:id])\n\t\trespond_with @recipes\n\tend",
"title": ""
},
{
"docid": "91b37bc7a21083489eecf8fcd7443a5e",
"score": "0.5472498",
"text": "def find_recipe_profiles(user)\n profiles = []\n faves = find_favorite_recipes(user)\n faves.each do |recipe|\n profiles << create_recipe_profile(recipe)\n end\n return profiles\n end",
"title": ""
},
{
"docid": "aeb3fe0b074f2507090537117022782c",
"score": "0.54610527",
"text": "def create\n if mass_recipe.valid?\n flash[:notice] = \"#{mass_recipe.item_id_collection.size} items were added\"\n mass_recipe.create_recipes!\n end\n respond_with(mass_recipe, :location => profession_path(mass_recipe.recipe_group.profession))\n end",
"title": ""
},
{
"docid": "7de4324988666ef623149f06c077310d",
"score": "0.5454231",
"text": "def test_add_multiple_recipes\n\t\tputs \"TEST 5\"\n\t\tassert( @db.empty?, \"DB should be empty\" )\n\n\t\[email protected](\"burger\", \"124124\")\n\t\[email protected](\"Bacon\", \"814\")\n\t\[email protected](\"Lettuce\", \"12\")\n\t\[email protected](\"Tomato\",\"14\")\n\t\[email protected](\"BLT\" , [\"bacon\",\"lettuce\",\"tomato\"])\n\t\[email protected](\"Bacon Burger\", [\"Bacon\",\"burger\"])\n\n\t\tassert( @db.size == 6, \"There should be 6 items in db, 4 foods, 2 recipes\")\n\t\tassert( @db.is_Recipe?(\"BLT\") , \"Should be BLT recipe\" )\n\t\tassert( @db.is_Recipe?(\"Bacon Burger\") , \"bacon burger should be a recipe\" )\n\t\t\n\t\[email protected](\"BLT\" , [\"bacon\",\"lettuce\",\"tomato\"])\n\t\tassert( @db.size == 6, \"Cannot add duplicate recipies\")\n\n\t\[email protected](\"NewRecipe\", [])\n\t\tassert( @db.size == 6, \"cannot add recipe with empty foods\")\n\n\t\[email protected](\"Copy Recipe\", [\"bacon\", \"bacon\"])\n\t\tassert( @db.size == 7, \"Size should be 7, add copy food on recipe\")\n\n\tend",
"title": ""
},
{
"docid": "e708e85fe3c00c0786621527981d0b3a",
"score": "0.5447854",
"text": "def index\n if params[:user_id] then\n @recipes=User.find(params[:user_id]).created_recipes\n respond_with do |format|\n format.html { @recipes=RecipeDecorator.decorate @recipes }\n format.json { render json: RecipeJsonDecorator.decorate(@recipes) }\n end\n else\n @featured ||= RecipeDecorator.decorate Recipe.recent.limit(2) unless params[:search]\n index! do |format|\n format.html { @recipes=RecipeDecorator.decorate @recipes }\n format.json { render json: RecipeJsonDecorator.decorate(@recipes) }\n end\n end\n end",
"title": ""
},
{
"docid": "bb004cff2e1991c9c0f60fb625af7708",
"score": "0.5445889",
"text": "def build_empty_ingredients\n 10.times { recipe_ingredients.build.build_ingredient }\n end",
"title": ""
},
{
"docid": "0f7fbbd57ba2bf843f618c6c88ef356d",
"score": "0.5445423",
"text": "def add_ingredients(ingredients)\n ingredients.each do |ingredient|\n RecipeIngredient.new(self, ingredient)\n end\n end",
"title": ""
},
{
"docid": "3d51740f8766817efa1fae1383176a62",
"score": "0.5442799",
"text": "def create\n \tset_tag_list\n\n @recipe = @current_user.recipes.build(params[:recipe])\n @recipe.status = @recipe.get_status\n item_client_ip(@recipe)\n # @recipe.is_draft = params[:is_draft]\n # @recipe.is_draft = @recipe.get_is_draft\n # @recipe.published_at = @recipe.get_published_at\n \n ActiveRecord::Base.transaction do \n\t\t\tif @recipe.save\n\t\t\t\t# @recipe.tag_list = params[:tags].strip if params[:tags] && !params[:tags].strip.blank?\n\t\t\t\treg_homepage(@recipe)\n\t\t\t\tafter_create_ok\n\t\t\telse\n\t\t\t\tafter_create_error\n\t\t\tend\n\t\tend\n end",
"title": ""
},
{
"docid": "b63b84ad3162fc5c7ec9c2711cf20e13",
"score": "0.54328656",
"text": "def set_recipes(fridge)\r\n # put recipes you want to puts manumally\r\n recipe_ingredients = {\"Teriyaki\" =>[\"chicken\",\"sugar\",\"mirin\",\"soy sauce\"],\r\n \"Curry rice\" => [\"rice\",\"curry mix\",\"potato\",\"onion\",\"beef\",\"carrot\"],\r\n \"Oyakodon\" => [\"chicken\",\"sugar\",\"mirin\",\"soy sauce\",\"rice\",\"egg\",\"onion\"],\r\n \"Takoyaki\" => [\"flour\",\"octopus\",\"ginger\",\"dashi\"],\r\n \"Nikujyaga\" => [\"beef\",\"sugar\",\"mirin\",\"soy sauce\",\"carrot\",\"onion\",\"potato\"],\r\n \"Octopus Sashimi\" => [\"octopus\",\"soy sauce\"],\r\n \"Miso soup\" => [\"miso\",\"dashi\"]}\r\n\r\n # set recipes_array to make new instence of Recipe\r\n recipes_array = {\"Teriyaki\" => [\"http://natashaskitchen.com/2015/12/11/easy-teriyaki-chicken/\",15],\r\n \"Curry rice\" => [\"http://www.japanesecooking101.com/curry-and-rice-recipe/\",40],\r\n \"Oyakodon\" => [\"http://www.justonecookbook.com/oyakodon/\",30],\r\n \"Takoyaki\" => [\"http://www.justonecookbook.com/takoyaki-recipe/\",20],\r\n \"Nikujyaga\" => [\"http://www.justonecookbook.com/nikujaga/\",30],\r\n \"Octopus Sashimi\" => [\"http://www.makesushi.com/sashimi/\",5],\r\n \"Miso soup\" =>[ \"http://steamykitchen.com/106-simple-10-minute-miso-soup.html\",5]}\r\n\r\n # make new instance and put to fridge.recipes\r\n recipes_array.each do |key,value|\r\n new_recipe = Recipe.new(key,value[0],value[1])\r\n new_recipe.ingredients = recipe_ingredients[\"#{key}\"]\r\n fridge.recipes << new_recipe\r\nend # recipes_array each end\r\nend",
"title": ""
},
{
"docid": "8a3cbf5e2776093e773ff40a4f4135a1",
"score": "0.5420175",
"text": "def create\n \n if params[\"donor\"]\n @recipe = Recipe.find(params[\"donor\"]).clone_with_ingredients(params[\"recipe\"])\n @recipe.user = current_user\n\n else\n @recipe = Recipe.new(params[\"recipe\"])\n end\n\n @recipe.user = current_user\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to @recipe, notice: 'Recipe was successfully created.' }\n format.json { render json: @recipe, status: :created, location: @recipe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
da4a2687e887ebb54b386f809f8837d3
|
Look up the values of a user's attributes
|
[
{
"docid": "a1c068fb6543d32eec6813268d6ce6b6",
"score": "0.0",
"text": "def get_attributes(attributes:, govuk_account_session:)\n querystring = nested_query_string({ attributes: attributes }.compact)\n get_json(\"#{endpoint}/api/attributes?#{querystring}\", auth_headers(govuk_account_session))\n end",
"title": ""
}
] |
[
{
"docid": "818a374fb34ef38d3650ae91708408a8",
"score": "0.73987615",
"text": "def user_attributes\n self.attribute_names.select{|a| Profile::USER_FIELDS.include?(a)}\n end",
"title": ""
},
{
"docid": "f6acf8e186b0a4a43785d83a3686163e",
"score": "0.7309964",
"text": "def retrieve_attributes(user)\n filter = Net::LDAP::Filter.contains(auth_attribute, user)\n info = {} # Used to store attributes on first matching user\n connection.search(base: base, filter: filter, attributes: attributes.keys) do |entry|\n entry.each do |attribute, values|\n next unless attributes.include?(attribute.to_sym)\n info[attributes[attribute].to_sym] = values.size > 1 ? values.map(&:to_s) : values.first.to_s\n end\n return info\n end\n end",
"title": ""
},
{
"docid": "9ba13945947235977836ab48965270f3",
"score": "0.7291454",
"text": "def attributes_from_user\n user_attributes = {}\n ldap_attribute_map.each do |ldap_attr, attr|\n user_attributes[ldap_attr] = attr.is_a?(Proc) ? attr.call(self.user) : self.user[attr]\n end\n user_attributes\n end",
"title": ""
},
{
"docid": "49127a2f49bea00ea487d6e7d8da6fac",
"score": "0.70974904",
"text": "def user_attribute_values\n return @user_attribute_values\n end",
"title": ""
},
{
"docid": "5dd44d08a711a09ee6178850f92c09bf",
"score": "0.6988975",
"text": "def attributes_from(ad_user)\n\t\t\th = {}\n\t\t\t@@attribute_map.each { |local, remote| h[local] = ad_user.send(remote) }\n\t\t\th[:guid] = ad_user.objectGUID\n\t\t\th[:password => '']\n\t\t\th\n\t\tend",
"title": ""
},
{
"docid": "a0d086b80142ad64afd1e87aed3e033d",
"score": "0.6903272",
"text": "def attribute(name)\n if attributes.include?(name)\n attributes[name]\n else\n user.send(name)\n end\n end",
"title": ""
},
{
"docid": "a0d086b80142ad64afd1e87aed3e033d",
"score": "0.6903272",
"text": "def attribute(name)\n if attributes.include?(name)\n attributes[name]\n else\n user.send(name)\n end\n end",
"title": ""
},
{
"docid": "944bc20b399d754a01801e4ae7aa8c2d",
"score": "0.6867153",
"text": "def user_search_attributes\n ['dn'] + options['attributes']['username'] + options['attributes']['email'] + [options['attributes']['name'], options['attributes']['first_name'], options['attributes']['last_name']]\n end",
"title": ""
},
{
"docid": "0ac06e3b49d3440d2ef273a63421652c",
"score": "0.6784428",
"text": "def user_attributes\n if from_registered_user?\n { :user_id => user_id }\n elsif from_public_user?\n { :name => name, :email => email }\n end\n end",
"title": ""
},
{
"docid": "b79293d7bc3a6b99dd237024c65b576d",
"score": "0.6741874",
"text": "def user\n @attributes[:user]\n end",
"title": ""
},
{
"docid": "b79293d7bc3a6b99dd237024c65b576d",
"score": "0.6741874",
"text": "def user\n @attributes[:user]\n end",
"title": ""
},
{
"docid": "3ecce701fc63819861839ce3745b214c",
"score": "0.6673366",
"text": "def admin_user_attributes()\n %w(uid cn sn gn gender birthDate ffckCategory ffckNumber ffckNumberYear postalCode l)\nend",
"title": ""
},
{
"docid": "6508e8a3da022ba2bf47117f536ed8c1",
"score": "0.65947545",
"text": "def user_attribute\n return @user_attribute\n end",
"title": ""
},
{
"docid": "e263884036efadbfbd18ac197f76125f",
"score": "0.6479013",
"text": "def safe_user_attrs\n [:display_name, :email, :location, :password, :units,\n :years_experience, :mailing_list, :is_private, :agree]\n end",
"title": ""
},
{
"docid": "7d017a6e955d423ba6d78b28655ca249",
"score": "0.646039",
"text": "def ldap_attributes(user)\n attributes = {\n :cn => user.human_name,\n :mail => user.email,\n :objectclass => [\"top\", \"person\", \"organizationalPerson\", \"user\"],\n :userPrincipalName => user.email,\n :unicodePwd => password_encode('Just4now' + Time.now.to_f.to_s[-4, 4]),\n :userAccountControl => \"512\",\n :sn => user.last_name,\n :givenName => user.first_name,\n :displayName => user.human_name\n }\n return attributes\n end",
"title": ""
},
{
"docid": "c45705dc26f5572fee716cbd1230efe0",
"score": "0.64346546",
"text": "def user_get_info(attribs, dir_info)\n attribs = user_record_name_alternatives(attribs)\n\n check_critical_attribute( attribs, :record_name )\n attribs = tidy_attribs(attribs)\n\n command = {action: 'read', scope: 'Users', attribute: nil, value: nil}\n user_attrs = attribs.merge(command)\n\n answer = dscl( user_attrs, dir_info )\n attribs[:value] = nil\n return answer\n end",
"title": ""
},
{
"docid": "03accda4cf1a3da53c54b230ee2611a6",
"score": "0.6426456",
"text": "def usernames\n @attributes[:usernames]\n end",
"title": ""
},
{
"docid": "9d7b666cba1f79c4a7c69a70f0ea47ed",
"score": "0.64159286",
"text": "def user_attributes\n { email: '[email protected]',\n password: 'xxxx',\n password_confirmation: 'xxxx',\n first_name: 'Hans',\n last_name: 'Muster',\n gender: 100,\n birth_date: 32.years.ago}\nend",
"title": ""
},
{
"docid": "33e56ee47ff926ca50d4f9f42f81a803",
"score": "0.64066094",
"text": "def user_attributes\n {\n name: @auth.info.first_name.presence || @auth.extra.raw_info.first_name + \" \" + @auth.info.last_name.presence || @auth.extra.raw_info.last_name,\n fb_token: @auth.credentials.token,\n fb_profile_picture: @auth.info.image.presence || @auth.extra.raw_info.image\n }\n end",
"title": ""
},
{
"docid": "e8f61de2088a5c64492b8a9bc0459ce5",
"score": "0.6398342",
"text": "def user_type_attributes\n \"\n id\n firstName\n shortDesc\n longDesc\n distance\n \"\nend",
"title": ""
},
{
"docid": "f76f8de2bb2bb66488ec3d0469fbc98e",
"score": "0.63842255",
"text": "def user_vars(user)\n { first_name: user.name, last_name: user.surname, full_name: \"#{user.name} #{user.surname}\".strip }\n end",
"title": ""
},
{
"docid": "4576c3258ec19890a75f706c10a406f0",
"score": "0.6378458",
"text": "def user_attributes_for_user(user)\n #Don't use this kind of query plan in a for-production adapter.\n find_all_of_type_user_attribute.select do |user_attribute|\n connected?(user, user_attribute)\n end\n end",
"title": ""
},
{
"docid": "33bc12f06b9beececc04c3555ffec48d",
"score": "0.63446295",
"text": "def user_attributes_for_user(user)\n end",
"title": ""
},
{
"docid": "3c7de7da69019494fce9c8baa614c3ba",
"score": "0.63269824",
"text": "def get_users_attributes_from_response(resp)\n users = resp.users.map do |user|\n {\n cognito_uuid: user.username,\n email: get_attribute_value_from_user_attributes(user.attributes, 'email'),\n account_status: user.enabled\n }\n end\n\n users.sort_by { |user| user[:email] }\n end",
"title": ""
},
{
"docid": "9fc7a8aae8f8323fca525049c757ef49",
"score": "0.63166094",
"text": "def user_attribute\n # if params[:attribute] == \"groups\"\n # res = User.groups(params[:uid])\n # else\n # res = User.directory_attributes(params[:uid], params[:attribute])\n # end\n # render json: res\n render json: ''\n end",
"title": ""
},
{
"docid": "169961c9b8b2ac622b3f428a6c8460d5",
"score": "0.6291597",
"text": "def user_with_proficiency(value)\n skillset = Skillset.find_by_proficiency(value)\n user_id = skillset.user_id\n user_name = User.find(user_id)\n user_name\n end",
"title": ""
},
{
"docid": "d4442544935e491c210dffdf81cdbe6c",
"score": "0.62819105",
"text": "def user; @data['user']; end",
"title": ""
},
{
"docid": "47db4d8dc259f03d424d408659012eec",
"score": "0.62731606",
"text": "def use_with_users\n @attributes[:use_with_users]\n end",
"title": ""
},
{
"docid": "f0fb5fa51b58d5fc418e1f645cb7c679",
"score": "0.62538415",
"text": "def userid\n attributes['userid']\n end",
"title": ""
},
{
"docid": "8f4b6720374fb290fe803438bb5c17e9",
"score": "0.6243196",
"text": "def user_attributes_for_user(user)\n find_all_of_type_user_attribute.select do |user_attribute|\n connected?(user, user_attribute)\n end\n end",
"title": ""
},
{
"docid": "776c1c9c5560b4d49bbc4996164d1db0",
"score": "0.6236998",
"text": "def find_attributes\n response = Client.auth_request(:find_principal_with_attributes_by_name, :in1 => name)[:out]\n \n response[:attributes][:soap_attribute].inject({}) do |memo, entry|\n # next two lines: prevent Nori::StringWithAttributes to bubble up\n # use plain strings instead (for serializability) [thomas, 2011-06-07]\n value = entry[:values][:string]\n value = value.to_s if value.is_a?(String)\n memo[entry[:name].snakecase.to_sym] = value\n memo\n end\n end",
"title": ""
},
{
"docid": "688fa0f0241605f655bd3981c71baa39",
"score": "0.6221267",
"text": "def get_user_info(user)\n u = Hash.new\n u[\"id\"] = user[\"id\"]\n u[\"firstName\"] = user[\"firstName\"]\n u[\"lastName\"] = user[\"lastName\"]\n u[\"email\"] = user[\"email\"]\n u[\"grr\"] = user[\"grr\"]\n u[\"phoneNumber\"] = user[\"phoneNumber\"]\n u[\"gender\"] = user[\"gender\"]\n u[\"accountConfirmed\"] = user[\"accountConfirmed\"]\n u[\"level\"] = calculate_level(user[\"experiencePoints\"])\n u[\"xp\"] = user[\"experiencePoints\"]\n u[\"money\"] = user[\"currencyPoints\"]\n return u\nend",
"title": ""
},
{
"docid": "e7477327e6d027aef0b45db30a6949b7",
"score": "0.62096465",
"text": "def retreive_user_info u_id, force = false\n %w{FULLNAME SEX BIRTHDAY CITY}.each{|prop|\n if not(@cache.send(\"get_user_#{prop.downcase}\".to_sym,u_id)) or force == true\n @cache.send(\"set_user_#{prop.downcase}\".to_sym, u_id,\n receive_user_info(u_id,prop))\n end\n }\n end",
"title": ""
},
{
"docid": "940c85059e28dd7c31718355ba165b75",
"score": "0.61645806",
"text": "def map_and_set_user_attributes(twitter_user)\n USER_ATTRIBUTES.each { |key, twitter_key| self.send(\"#{ key }=\", twitter_user[twitter_key]) }\n end",
"title": ""
},
{
"docid": "4eaeec3a5104e1261f88b57c23a483fd",
"score": "0.615119",
"text": "def user_fields\n @users.first&.keys\n end",
"title": ""
},
{
"docid": "383710c7f88a02e060648cf5376b69f0",
"score": "0.61495453",
"text": "def attrs\n @attrs ||= LazyHash.new {ASF.search_one(base, \"uid=#{name}\").first}\n end",
"title": ""
},
{
"docid": "1499ccd5d3e8b52b50acb98601487952",
"score": "0.6141823",
"text": "def parse_user_values(query, item)\n\t\t\t\treturn query.fields.map { |f| item[f.field.to_s] }\n\t\t\tend",
"title": ""
},
{
"docid": "05e5bd07f3024437bace603ab8a6c4c2",
"score": "0.61362976",
"text": "def extract_data(user)\n valid_params[:customer].keys.map { |k| user[k.to_s] }\n end",
"title": ""
},
{
"docid": "05e5bd07f3024437bace603ab8a6c4c2",
"score": "0.61362976",
"text": "def extract_data(user)\n valid_params[:customer].keys.map { |k| user[k.to_s] }\n end",
"title": ""
},
{
"docid": "15b4ab40b2651e49d49c500093928171",
"score": "0.61214703",
"text": "def display(user_or_id = Origen.current_user)\n lookup(user_or_id).each do |attribute, values|\n puts \" #{attribute}:\"\n values.each do |value|\n puts \" --->#{value}\"\n end\n end\n end",
"title": ""
},
{
"docid": "2f9b6cd0b638dc9a588918d4552d6e57",
"score": "0.60760814",
"text": "def collect_user_details\n backend = Backend.create\n users = backend.list_users.users.map(&:to_h)\n\n # TODO: lazy columns - https://github.com/chef/inspec-aws/issues/100\n users.each do |user|\n begin\n _login_profile = backend.get_login_profile(user_name: user[:user_name])\n user[:has_console_password] = true\n rescue Aws::IAM::Errors::NoSuchEntity\n user[:has_console_password] = false\n end\n user[:has_console_password?] = user[:has_console_password]\n\n begin\n aws_mfa_devices = backend.list_mfa_devices(user_name: user[:user_name])\n user[:has_mfa_enabled] = !aws_mfa_devices.mfa_devices.empty?\n rescue Aws::IAM::Errors::NoSuchEntity\n user[:has_mfa_enabled] = false\n end\n user[:has_mfa_enabled?] = user[:has_mfa_enabled]\n end\n users\n end",
"title": ""
},
{
"docid": "68fe36e897a6440cae907472d7a37b70",
"score": "0.6066997",
"text": "def delegate_to_user(attr_name)\n user ? user.read_attribute(attr_name) : read_attribute(attr_name)\n end",
"title": ""
},
{
"docid": "01924cf5a041a173227ec26cc6ae0578",
"score": "0.6057439",
"text": "def get_attributes()\n\t\treturn self.get(\"attribute\",\"\")\n\tend",
"title": ""
},
{
"docid": "a2fb5317430fde9fd0c65315cbb369ed",
"score": "0.6045064",
"text": "def user_data\n data.user_data\n end",
"title": ""
},
{
"docid": "55836acde852fb65ab2c501191677a73",
"score": "0.6033234",
"text": "def user_details\n user_details_for(@qualified_username).first\n end",
"title": ""
},
{
"docid": "5cc7cb6b90cccd432131e957257c52aa",
"score": "0.60160977",
"text": "def get_user_info\n return User.find_by_id(self.user_id)\n end",
"title": ""
},
{
"docid": "7b70c80e960b94d3b9a5f1875456afb3",
"score": "0.6012407",
"text": "def method_missing(method_name, *args, &block)\n mapped_key = user_map[method_name.to_sym]\n if attributes.has_key?(mapped_key)\n attributes[mapped_key]\n else\n super\n end\n end",
"title": ""
},
{
"docid": "16324d7ddbcfb507ded0d4fa80754db3",
"score": "0.60105544",
"text": "def user_attribute\n # if params[:attribute] == \"groups\"\n # res = User.groups(params[:uid])\n # else\n # res = User.directory_attributes(params[:uid], params[:attribute])\n # end\n # render :json => res\n render :json => \"\" \n end",
"title": ""
},
{
"docid": "9b3c614dc19ca4c04d8ad7e49efc68ef",
"score": "0.6008087",
"text": "def get_attribute(entry,attr=nil)\n\t\tcase attr\n\t\twhen :user\n\t\t\treturn entry[0].user\n\t\twhen :movie\n\t\t\treturn entry[0].movie\n\t\twhen :real\n\t\t\treturn entry[1][0].to_f\n\t\twhen :predict\n\t\t\treturn entry[1][1].to_f\n\t\telse\n\t\t\treturn entry\n\t\tend\n\tend",
"title": ""
},
{
"docid": "e860a10b01b1eb2d7eaeac8f2b1eade7",
"score": "0.6007839",
"text": "def user\n attributed_to\n end",
"title": ""
},
{
"docid": "aea3cba8f5b675eb94b7c213bcc1ce08",
"score": "0.59914124",
"text": "def user_info\n {\n :id => self.id,\n :username => self.username,\n :location => self.location,\n :display_name => self.display_name,\n :profile_image => self.profile_image\n }\n end",
"title": ""
},
{
"docid": "808b36d03203277ea8c0a01101b60dbf",
"score": "0.5982083",
"text": "def user_attributes_for_user(user)\n user.descendants.merge(PolicyElement.where(type: class_for_type('user_attribute').name))\n end",
"title": ""
},
{
"docid": "13f9fc45ce0f13f02e28d2eab6c66c2a",
"score": "0.597317",
"text": "def user_attributes\n [:first_name, :last_name, :email, :password, :password_confirmation, :current_password, :remember_me, :avatar, :avatar_cache, :remove_avatar, :avatar_crop_x, :avatar_crop_y, :avatar_crop_w, :avatar_crop_h]\n end",
"title": ""
},
{
"docid": "4487fcb6ce08f843e8cd47d0165d0ac0",
"score": "0.5971762",
"text": "def userDetails *args\n options=fill_args [:id,:apikey],[:id],*args\n request_widget(\"/User/Properties.json\",options)\n end",
"title": ""
},
{
"docid": "62000d7287cd14f06fdf691904901f5a",
"score": "0.59705496",
"text": "def age\n attributes[:age]\n end",
"title": ""
},
{
"docid": "fd642a81acc249bf1d1f6ee304889eaa",
"score": "0.59633034",
"text": "def search_attributes\n if onthefly_register?\n ['dn', self.attr_firstname, self.attr_lastname, self.attr_mail]\n else\n ['dn']\n end\n end",
"title": ""
},
{
"docid": "b34ffee9819ac6252af1d374b92fd3f8",
"score": "0.59631604",
"text": "def getUserInfo(userId)\r\n\t userQuery = \"SELECT UserName, FirstName, Profile.PermissionsModifyAllData, Profile.PermissionsAuthorApex, UserPreferencesApexPagesDeveloperMode \" +\r\n\t \"FROM User WHERE Id = '\" + userId + \"'\";\t\r\n\t userInfo = Hash.new\r\n\t \r\n\t if userId == nil || userId == ''\r\n\t \treturn userInfo\r\n\t end\r\n\t \r\n\t results = query(userQuery)\r\n\t \r\n\t if results != nil && results.kind_of?(Array) && results.length > 0\r\n\t \tuserInfo['username'] = results[0].Username\r\n\t \tuserInfo['userId'] = userId\r\n\t \tuserInfo['firstname'] = results[0].FirstName\r\n\t \tuserInfo['admin'] = results[0].Profile.PermissionsModifyAllData && results[0].Profile.PermissionsAuthorApex\r\n\t \tuserInfo['devMode'] = results[0].UserPreferencesApexPagesDeveloperMode\r\n\t end\r\n\t \r\n\t return userInfo\r\n\tend",
"title": ""
},
{
"docid": "8a64744e0f33a1a24d1f35ec6d2d15e8",
"score": "0.5961778",
"text": "def user_info \n @user_info ||= raw_info.nil? ? {} : raw_info[\"user\"]\n end",
"title": ""
},
{
"docid": "6be2f96118a085b099c32b919c5cc5b9",
"score": "0.59576595",
"text": "def get_user_info(user)\n\t\tuser_info={}\n\t\tdata.each do |singleMovie|\n\t\t# user_info is a hash storing info such as{\"movie_id=>rating\"}\n\t\t\tif singleMovie[\"user_id\"] == user.to_i\n\t\t\t\tmoive_id = singleMovie[\"movie_id\"].to_i\n\t\t\t\trating = singleMovie[\"rating\"].to_i\n\t\t\t\tuser_info[moive_id] = rating\n\t\t\tend\n\t\tend\n\t\treturn user_info \n\tend",
"title": ""
},
{
"docid": "1493cb79a324090fe54d45d4a64f3a6e",
"score": "0.5954691",
"text": "def attributes_api\n self.attributes.reject { |k| k =~ /password/ }.merge({'user_role' => self.user_role})\n end",
"title": ""
},
{
"docid": "217769a8a47e4d88cc70f22aa7158aaa",
"score": "0.5952242",
"text": "def characteristics\n object.user_eligibilities.map { |ue| ue.api_hash }\n end",
"title": ""
},
{
"docid": "b855f3ebb58b6c93c6883b357f1c51fd",
"score": "0.5930809",
"text": "def existing_user_attributes= user_attributes\n #downcase_user_attributes(user_attributes)\n users_containers.reject(&:new_record?).each do |uc|\n attributes = user_attributes[uc.id.to_s]\n attributes ? uc.attributes = attributes : users_containers.delete(uc)\n end\n end",
"title": ""
},
{
"docid": "a21155ac140f43116a5c07647b718502",
"score": "0.5919924",
"text": "def update_user_info(user, attributes)\n user.update!(attributes.select do |attr, value|\n attr.in?(%i[points]) || (user.attributes[attr.to_s].blank? && value.present?)\n end)\n end",
"title": ""
},
{
"docid": "337d827b674eb0b0e4c677c48aa43e06",
"score": "0.59137803",
"text": "def load\n response = api('sp/user_info')\n self.attributes = response['result']\n super\n end",
"title": ""
},
{
"docid": "4ac21516144007c3acf9fae2067969f0",
"score": "0.5913564",
"text": "def user_attributes_for_user(user)\n user.descendants.merge(PolicyElement.where(type: class_for_type('user_attribute')))\n end",
"title": ""
},
{
"docid": "5b4e2db74fe1f82e7dc407e2a42cef16",
"score": "0.5909843",
"text": "def user_info\n {\n 'uid' => user_hash['id'],\n 'nickname' => user_hash['username'],\n 'first_name' => user_hash['firstname'],\n 'last_name' => user_hash['lastname'],\n 'name' => [user_hash['firstname'],user_hash['lastname']].reject{ |n| n.nil? || n.empty? }.join(' '),\n 'email' => user_hash['email'],\n 'language' => user_hash['language']\n }\n end",
"title": ""
},
{
"docid": "7d49f12b66248dd7c2a0320ad5ab79a5",
"score": "0.59074247",
"text": "def get_user_info(twitter_id)\n user = User.first(twitter_id: twitter_id)\n if user\n user_data = user.twitter_attributes_json\n else\n user_data = Twitter.user(twitter_id).attrs\n end\n user_data\n end",
"title": ""
},
{
"docid": "392247ebf9da996a7e352aebc19f7a8e",
"score": "0.5906229",
"text": "def user_ldap_entry_attr(entry)\n attr = {}\n # These are attributes that might be empty. If they are empty,\n # a NoMethodError exception will be raised. We have to check each\n # individually and set an initial indicator value (nil). All the\n # other attributes should exist and do not require this level of\n # checking.\n attr[:first_name] = nil\n attr[:initials] = nil\n attr[:middle_name] = nil\n attr[:surname] = nil\n attr[:script_path] = nil\n attr[:profile_path] = nil\n attr[:local_path] = nil\n attr[:local_drive] = nil\n attr[:uid] = nil\n attr[:gid] = nil\n attr[:nis_domain] = nil\n attr[:gecos] = nil\n attr[:unix_password] = nil\n attr[:shadow_expire] = nil\n attr[:shadow_flag] = nil\n attr[:shadow_inactive] = nil\n attr[:shadow_last_change] = nil\n attr[:shadow_max] = nil\n attr[:shadow_min] = nil\n attr[:shadow_warning] = nil\n attr[:shell] = nil\n attr[:home_directory] = nil\n attr[:mail] = nil\n attr[:telephone_number] = nil\n attr[:user_account_control] = nil\n\n begin\n attr[:first_name] = entry.givenName.pop\n rescue NoMethodError\n end\n\n begin\n attr[:initials] = entry.initials.pop\n rescue NoMethodError\n end\n\n begin\n attr[:middle_name] = entry.middleName.pop\n rescue NoMethodError\n end\n\n begin\n attr[:surname] = entry.sn.pop\n rescue NoMethodError\n end\n\n begin\n attr[:script_path] = entry.scriptPath.pop\n rescue NoMethodError\n end\n\n begin\n attr[:profile_path] = entry.profilePath.pop\n rescue NoMethodError\n end\n\n begin\n attr[:local_path] = entry.homeDirectory.pop\n rescue NoMethodError\n end\n\n begin\n attr[:local_drive] = entry.homeDrive.pop\n rescue NoMethodError\n end\n\n begin\n attr[:uid] = entry.uidNumber.pop.to_i\n rescue NoMethodError\n end\n\n begin\n attr[:gid] = entry.gidNumber.pop.to_i\n rescue NoMethodError\n end\n\n begin\n attr[:nis_domain] = entry.msSFU30NisDomain.pop\n rescue NoMethodError\n end\n\n begin\n attr[:gecos] = entry.gecos.pop\n rescue NoMethodError\n end\n\n begin\n attr[:unix_password] = entry.unixUserPassword.pop\n rescue NoMethodError\n end\n\n begin\n attr[:shadow_expire] = entry.shadowExpire.pop.to_i\n rescue NoMethodError\n end\n\n begin\n attr[:shadow_flag] = entry.shadowFlag.pop.to_i\n rescue NoMethodError\n end\n\n begin\n attr[:shadow_inactive] = entry.shadowInactive.pop.to_i\n rescue NoMethodError\n end\n\n begin\n attr[:shadow_last_change] = entry.shadowLastChange.pop.to_i\n rescue NoMethodError\n end\n\n begin\n attr[:shadow_max] = entry.shadowMax.pop.to_i\n rescue NoMethodError\n end\n\n begin\n attr[:shadow_min] = entry.shadowMin.pop.to_i\n rescue NoMethodError\n end\n\n begin\n attr[:shadow_warning] = entry.shadowWarning.pop.to_i\n rescue NoMethodError\n end\n\n begin\n attr[:shell] = entry.loginShell.pop\n rescue NoMethodError\n end\n\n begin\n attr[:home_directory] = entry.unixHomeDirectory.pop\n rescue NoMethodError\n end\n\n begin\n attr[:mail] = entry.mail.pop\n rescue NoMethodError\n end\n\n begin\n attr[:telephone_number] = entry.telephoneNumber.pop\n rescue NoMethodError\n end\n\n begin\n attr[:user_account_control] = entry.userAccountControl.pop\n rescue NoMethodError\n end\n\n begin\n attr[:must_change_password?] = (entry.pwdLastSet.pop.to_i == 0)\n rescue NoMethodError\n end\n\n begin\n attr[:primary_group] = find_group_by_rid(entry.primaryGroupID.pop.to_i)\n rescue NoMethodError\n end\n\n begin\n attr[:rid] = sid2rid_int(entry.objectSid.pop)\n rescue NoMethodError\n end\n\n begin\n attr[:username] = entry.sAMAccountName.pop\n rescue NoMethodError\n end\n\n begin\n attr[:distinguished_name] = entry.distinguishedName.pop\n rescue NoMethodError\n end\n\n attr[:disabled?] = false\n\n return attr\n end",
"title": ""
},
{
"docid": "6c3bdfb5de925d07d060830574c2b1c4",
"score": "0.589386",
"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": "d1699e785e4b8dcac9f001071d930e05",
"score": "0.58852154",
"text": "def user_info\n\n end",
"title": ""
},
{
"docid": "56b98a8789b45eea256cf529edfad2f2",
"score": "0.5884299",
"text": "def find_user_data\n\n\tend",
"title": ""
},
{
"docid": "534dad6e19e1ce806529192c8042fe3a",
"score": "0.58829796",
"text": "def user_id\n @attributes[:user_id]\n end",
"title": ""
},
{
"docid": "534dad6e19e1ce806529192c8042fe3a",
"score": "0.58829796",
"text": "def user_id\n @attributes[:user_id]\n end",
"title": ""
},
{
"docid": "534dad6e19e1ce806529192c8042fe3a",
"score": "0.58829796",
"text": "def user_id\n @attributes[:user_id]\n end",
"title": ""
},
{
"docid": "534dad6e19e1ce806529192c8042fe3a",
"score": "0.58829796",
"text": "def user_id\n @attributes[:user_id]\n end",
"title": ""
},
{
"docid": "534dad6e19e1ce806529192c8042fe3a",
"score": "0.58829796",
"text": "def user_id\n @attributes[:user_id]\n end",
"title": ""
},
{
"docid": "534dad6e19e1ce806529192c8042fe3a",
"score": "0.58829796",
"text": "def user_id\n @attributes[:user_id]\n end",
"title": ""
},
{
"docid": "534dad6e19e1ce806529192c8042fe3a",
"score": "0.58829796",
"text": "def user_id\n @attributes[:user_id]\n end",
"title": ""
},
{
"docid": "534dad6e19e1ce806529192c8042fe3a",
"score": "0.58829796",
"text": "def user_id\n @attributes[:user_id]\n end",
"title": ""
},
{
"docid": "534dad6e19e1ce806529192c8042fe3a",
"score": "0.58829796",
"text": "def user_id\n @attributes[:user_id]\n end",
"title": ""
},
{
"docid": "534dad6e19e1ce806529192c8042fe3a",
"score": "0.58829796",
"text": "def user_id\n @attributes[:user_id]\n end",
"title": ""
},
{
"docid": "534dad6e19e1ce806529192c8042fe3a",
"score": "0.58829796",
"text": "def user_id\n @attributes[:user_id]\n end",
"title": ""
},
{
"docid": "534dad6e19e1ce806529192c8042fe3a",
"score": "0.58829796",
"text": "def user_id\n @attributes[:user_id]\n end",
"title": ""
},
{
"docid": "534dad6e19e1ce806529192c8042fe3a",
"score": "0.58829796",
"text": "def user_id\n @attributes[:user_id]\n end",
"title": ""
},
{
"docid": "534dad6e19e1ce806529192c8042fe3a",
"score": "0.58829796",
"text": "def user_id\n @attributes[:user_id]\n end",
"title": ""
},
{
"docid": "534dad6e19e1ce806529192c8042fe3a",
"score": "0.58829796",
"text": "def user_id\n @attributes[:user_id]\n end",
"title": ""
},
{
"docid": "eae3b9ad0500a6a4e3c0b50044dea88a",
"score": "0.58745176",
"text": "def get_users\n Hash[run_conduit('user.query').map do |user|\n [user['realName'].downcase, user['phid']]\n end]\nend",
"title": ""
},
{
"docid": "3ac85374cd7b5fec1c2fa11a59b9a991",
"score": "0.58742",
"text": "def user_crypted_attributes(user)\r\n @user_encrypted_attributes ||= self.class.crypted_attributes.values.map do |attr|\r\n attr[:attribute_class].for_encrypter(user).for_encryptable(self).first\r\n end.select {|a| !a.nil?} \r\n end",
"title": ""
},
{
"docid": "0c698a87c17c7be4b4acb43a7d31c2f8",
"score": "0.58644134",
"text": "def userinfo; end",
"title": ""
},
{
"docid": "0c698a87c17c7be4b4acb43a7d31c2f8",
"score": "0.58644134",
"text": "def userinfo; end",
"title": ""
},
{
"docid": "23cd9f47f698666defeb4f17f00b5b07",
"score": "0.5863727",
"text": "def parse_user_info(node)\n return nil if node.nil?\n\n h = {}\n if !node.blank?\n h[\"user\"] = node.css(\"AttributeStatement\").css(\"NameIdentifier\")[0].children[0].to_s\n\n node.css(\"Attribute\").each do |attr|\n h[attr.attributes[\"AttributeName\"].value] = attr.children[0].children[0].to_s\n end\n end\n h\n end",
"title": ""
},
{
"docid": "94c388e4c3fa5169ee0a0aa900586b20",
"score": "0.58635896",
"text": "def user_details(username)\n item = {}\n id = identity(username)\n item.merge!(id) unless id.nil?\n meta = meta_info(username)\n item.merge!(meta) unless meta.nil?\n cred = credentials(username)\n item.merge!(cred) unless cred.nil?\n item\n end",
"title": ""
},
{
"docid": "25a2281b94a0a7fa1745cee9e94c5ae4",
"score": "0.5859272",
"text": "def user_attribute_values=(value)\n @user_attribute_values = value\n end",
"title": ""
},
{
"docid": "905c3e3bc83577333fbda427d8644e2d",
"score": "0.58577955",
"text": "def attributes\n self.class.attributes[params]\n end",
"title": ""
},
{
"docid": "44e01f6eff8be1d6e88d98f7763e3088",
"score": "0.58575475",
"text": "def user_base(user)\n {\n id: user[:id],\n email: user[:email],\n properties: user[:properties_array],\n created_at: user[:created_at]\n }\n end",
"title": ""
},
{
"docid": "ba46c33eaa6033eeddbbdddd3ad3411f",
"score": "0.5857138",
"text": "def user_info\n get(api_get.body.identity).body\n end",
"title": ""
},
{
"docid": "17012175d3705664d1c7f391cedf32c3",
"score": "0.5853377",
"text": "def user_info\n self.authority.user_info\n end",
"title": ""
},
{
"docid": "161f9f29b4a797e70fe70799570604f1",
"score": "0.58466184",
"text": "def user_object user\n object = {'id' => user.object_id}\n user.meta.each_pair do |key, value|\n object[key.to_s] = value\n end\n return object\n end",
"title": ""
},
{
"docid": "4c72e591ff41711d912427a1563a4d18",
"score": "0.5838144",
"text": "def vars\n @user_var\n end",
"title": ""
},
{
"docid": "fd96f164e5ef594d206bacd68d515e8e",
"score": "0.58326924",
"text": "def value\n @users\n end",
"title": ""
},
{
"docid": "3dd5cb7adf8ff5ebd5a7b7f1d8823eb6",
"score": "0.58309627",
"text": "def userinfo\n return @userinfo\n end",
"title": ""
}
] |
ea2868894baab4762f220c14a75eae22
|
New method : Store targets in array
|
[
{
"docid": "650c331054b9f54d251407358a531d86",
"score": "0.816748",
"text": "def target_array=(targets)\n @target_array = targets\n @ori_targets = targets.clone\n end",
"title": ""
}
] |
[
{
"docid": "e9aa655c7fa1125cc501e9814ab62043",
"score": "0.77810246",
"text": "def targets\n @targets ||= []\n end",
"title": ""
},
{
"docid": "d738838acc7d4d7ee436c871cde82d21",
"score": "0.7453504",
"text": "def targets=(value)\n @targets = value\n end",
"title": ""
},
{
"docid": "d738838acc7d4d7ee436c871cde82d21",
"score": "0.7453504",
"text": "def targets=(value)\n @targets = value\n end",
"title": ""
},
{
"docid": "2c7e49b0802002ea877ff0df849e2d3c",
"score": "0.7197005",
"text": "def targets()\n if @target then\n return [self]\n else\n return []\n end\n end",
"title": ""
},
{
"docid": "db7a6030426b350a4350f2ee9e365381",
"score": "0.6983366",
"text": "def targets=( *args )\n update_state_collection( '@targets', *args )\n end",
"title": ""
},
{
"docid": "460b28468b7e70865b0c7035fae437d9",
"score": "0.6939127",
"text": "def targets\n @targets ||= (data['targets'] || {})\n end",
"title": ""
},
{
"docid": "5bc64747acaa14c86850e69da852ea65",
"score": "0.688068",
"text": "def targets; self[:targets]; end",
"title": ""
},
{
"docid": "e39f93a6cae98d60fd299d85e9e4832f",
"score": "0.6803024",
"text": "def targets\n return @targets\n end",
"title": ""
},
{
"docid": "e39f93a6cae98d60fd299d85e9e4832f",
"score": "0.6803024",
"text": "def targets\n return @targets\n end",
"title": ""
},
{
"docid": "87da577c27212e259ef3df4a1b3514f9",
"score": "0.6711529",
"text": "def find_target\n Array(target_class.find(source_ids.to_a))\n end",
"title": ""
},
{
"docid": "6c919225eb3db86f7a56329736767e0e",
"score": "0.6671306",
"text": "def targets\n ['Barn 0 - 14', 'Ung 15 - 24', 'Voksen 25 - 65', 'Eldre 65 +']\n end",
"title": ""
},
{
"docid": "e5ca745b85de8d9f78d455f90cbf016c",
"score": "0.66620046",
"text": "def get_targets\n {\n method: \"Target.getTargets\"\n }\n end",
"title": ""
},
{
"docid": "71e2bd53f7610e108b7254007d017cc1",
"score": "0.666078",
"text": "def initialize(targets = [])\n @targets = targets.dup\n end",
"title": ""
},
{
"docid": "2934650b49ec0e4f7b5f8fff54653ca5",
"score": "0.66302484",
"text": "def make_targets\n @targets = Array.new(8) { Vec2D.new(rand(width), rand(height)) }\nend",
"title": ""
},
{
"docid": "3d240419e3c0abef09f243a3dfa3dee1",
"score": "0.65343934",
"text": "def to *args\n options = args.extract_options!.symbolize_keys!\n args.flatten!\n raise options.inspect unless options.empty?\n self.targets= *args\n end",
"title": ""
},
{
"docid": "f039989d3e2987626e724bd7dbeb32b5",
"score": "0.65128845",
"text": "def targets\n\t\tTarget.find(:all)\n\tend",
"title": ""
},
{
"docid": "8b3b6acd780567fdae0ae0ab0194a89d",
"score": "0.6462042",
"text": "def targets\r\n @dispatch_targets\r\n end",
"title": ""
},
{
"docid": "1fac9766d40dcaa5073254f72df52acf",
"score": "0.64180326",
"text": "def make_targets\n if @set\n targets = @set and @set = nil\n return targets\n end\n en_tm_ga_mt\n end",
"title": ""
},
{
"docid": "4bdec2007fae3826b9042003c4924011",
"score": "0.6341599",
"text": "def target_positions=(positions)\n @target_need_refresh = true\n @reselect_targets = true\n set_targets([])\n @target_positions = positions\n end",
"title": ""
},
{
"docid": "ac6d7485eee16a09092598448b4acd1b",
"score": "0.6269707",
"text": "def on_target(attr)\n @targets << attr['id'] if @buffer_targets\n end",
"title": ""
},
{
"docid": "15a233bcf8026531f1606f46df4d1931",
"score": "0.6240095",
"text": "def update_target\n obj = JSON.load(@clnt.get(@config_url).body) || []\n obj = @parsing_block.call(obj) if @parsing_block\n\n obj.each do |target|\n @target_array = []\n name = target[\"name\"]\n type = target[\"type\"]\n target_array << path_for(name, type)\n end\n end",
"title": ""
},
{
"docid": "dcf474de292f936ad8d17dbe2b9a5b30",
"score": "0.6206449",
"text": "def targets\n @targets ||= targets_path.children.map do |target|\n begin\n self.target(target.basename)\n rescue Target::FileNotFoundError\n nil\n end\n end.compact\n end",
"title": ""
},
{
"docid": "fc36f3b9eb33513d9e65aee6c05a99bc",
"score": "0.6185551",
"text": "def target_objects=(value)\n @target_objects = value\n end",
"title": ""
},
{
"docid": "fc36f3b9eb33513d9e65aee6c05a99bc",
"score": "0.6185551",
"text": "def target_objects=(value)\n @target_objects = value\n end",
"title": ""
},
{
"docid": "3154a67a7c01db1af559db449e8a3f08",
"score": "0.6170888",
"text": "def getTargets fullData\r\n\t\tputs \"Base Get Targets\"\r\n\t\t#Get training set, retrieve target and remove from the RegressionDataSet\r\n\t\t[fullData, fullData.retrieveFeatureAsArray(@target, true)]\r\n\tend",
"title": ""
},
{
"docid": "2ed3e0fd585b85ee7d15dc05f6105d1a",
"score": "0.6070806",
"text": "def to_a\n [source, target]\n end",
"title": ""
},
{
"docid": "260f73e5010e06da0e590d4bfac3adb7",
"score": "0.60690236",
"text": "def targets\n @targets = Array(@attrs[:targets]).map do |status|\n Twitter::Status.fetch_or_new(status)\n end\n end",
"title": ""
},
{
"docid": "efb11a6ccde2487247e039f481f01238",
"score": "0.60277855",
"text": "def with_targets(targets)\n targets = Array(targets)\n @invocation[:targets] = targets.map do |target|\n if target.is_a? String\n target\n else\n target.name\n end\n end\n self\n end",
"title": ""
},
{
"docid": "e91167dfa5e49b49372b0585455c4b4e",
"score": "0.6019677",
"text": "def setup_check_collapse\n target_array.each do |tar|\n tar.target = self\n get_scene.check_collapse(tar)\n end\n end",
"title": ""
},
{
"docid": "165347f40b4c5c2047d7cb0f7be0cc2b",
"score": "0.60083",
"text": "def targets( paths )\n Target.new( config.targets + paths || [], config.excludes.uniq )\n end",
"title": ""
},
{
"docid": "6f7212f2492c1ba2c6d3c7d9ac768304",
"score": "0.5989158",
"text": "def reset\n @targets_run = [ ]\n end",
"title": ""
},
{
"docid": "e8fb3e767e4acc9c9b65498185d2680c",
"score": "0.59566694",
"text": "def acquire_target_array\n File.read(TARGET_FILE_PATH).split(EXPORT_LIST_SEPARATOR)\n end",
"title": ""
},
{
"docid": "6418b6d9fe950db2353701bd993b32f7",
"score": "0.59445506",
"text": "def target_ids\n @target_ids ||= node.xpath('span/target')\n .map { |target| target.attr('id') }\n end",
"title": ""
},
{
"docid": "6608d4255ec67478e174b8319767eee6",
"score": "0.5943557",
"text": "def reset_target_buffer\n @buffer_targets = false\n @targets = []\n end",
"title": ""
},
{
"docid": "7d66e5ad3c0e436a9218f4fdfa5a70cc",
"score": "0.5905328",
"text": "def targets\n\t\t@targets ||= begin\n\t\t\tconfig_list('target(Enumerator)?$').map do |li|\n\t\t\t\tif li[0].downcase == 'target'\n\t\t\t\t\tli[1]\n\t\t\t\telsif li[0].downcase == 'targetenumerator'\n\t\t\t\t\trv = run_command(\"Enumerating targets using '#{li[1]}'\", li[1]).split(/\\s+/)\n\t\t\t\t\tif $?.exitstatus != 0\n\t\t\t\t\t\traise RuntimeError,\n\t\t\t\t\t\t\t\t\"Target enumeration failed. Aborting.\"\n\t\t\t\t\tend\n\t\t\t\t\trv\n\t\t\t\telse\n\t\t\t\t\traise RuntimeError,\n\t\t\t\t\t\t\t\"Unknown target expansion option: #{li[0]}\"\n\t\t\t\tend\n\t\t\tend.flatten\n\t\tend\n\tend",
"title": ""
},
{
"docid": "714c8a7c808bac8eecdbdf9d13a1c394",
"score": "0.5898749",
"text": "def addTarget(target, result, usableItems)\n t = self[target]\n if t.nil?\n t = Target.new(target.to_s)\n (@targets ||= []) << t\n @targets.sort!\n end\n t.addResult(result, usableItems)\n end",
"title": ""
},
{
"docid": "a27999ad98346a57a30aa0d73a229acf",
"score": "0.58983755",
"text": "def get_targets(name=:target)\n ActivityTarget.where(:name => name, :activity_id => id).map{ |at| at.target }\n end",
"title": ""
},
{
"docid": "438511c56119a740b410129dcc83a51f",
"score": "0.5893077",
"text": "def target_objects\n return @target_objects\n end",
"title": ""
},
{
"docid": "438511c56119a740b410129dcc83a51f",
"score": "0.5893077",
"text": "def target_objects\n return @target_objects\n end",
"title": ""
},
{
"docid": "81ff6d4054f7cc2012286ea2b4d9b0c5",
"score": "0.5888879",
"text": "def add_to_sequence origin_states, target_state\n origin_states = [origin_states].flatten\n existing = origin_states.select {|s| target_for_origin(s) }\n raise ArgumentError.new unless existing.empty? && !targets \n @sequence[target_state] ||= []\n [origin_states].flatten.each do |o|\n @sequence[target_state] << o\n end\n @sequence\n end",
"title": ""
},
{
"docid": "6146aa35ace17bf6cd49d2cb36139d93",
"score": "0.5878787",
"text": "def target_files\n files.map {|f| target_file f}\n end",
"title": ""
},
{
"docid": "d4e058678ad1e7aa2e98b9adcfb1545f",
"score": "0.5871516",
"text": "def [](target)\n return (@targets ||= []).find { |x| x.target == target.to_sym }\n end",
"title": ""
},
{
"docid": "bde252a4427cfca10662256dc153c8e8",
"score": "0.58669037",
"text": "def update!(**args)\n @target_ids = args[:target_ids] if args.key?(:target_ids)\n end",
"title": ""
},
{
"docid": "53853a030deac7cb3f248375e078efab",
"score": "0.5858302",
"text": "def target_names\n targets ? targets.map(&:to_sym) : nil\n end",
"title": ""
},
{
"docid": "49b656b30f1d5c68ecd2ee7bf2b43e71",
"score": "0.5854942",
"text": "def generate_file_list\n self.file_list = Concurrent::Array.new\n targets.each do |target|\n add_target(target)\n end\n end",
"title": ""
},
{
"docid": "58ce4c2429540ac9f0bd1dd30aea9d69",
"score": "0.58381367",
"text": "def include_targets=(value)\n @include_targets = value\n end",
"title": ""
},
{
"docid": "7ec9c84cfd2812eac3f6e4045a77da65",
"score": "0.5830065",
"text": "def index\n @targets = Target.all\n end",
"title": ""
},
{
"docid": "7ec9c84cfd2812eac3f6e4045a77da65",
"score": "0.5830065",
"text": "def index\n @targets = Target.all\n end",
"title": ""
},
{
"docid": "7ec9c84cfd2812eac3f6e4045a77da65",
"score": "0.5830065",
"text": "def index\n @targets = Target.all\n end",
"title": ""
},
{
"docid": "83c0b1a0450eb33e0a3027ed843b7010",
"score": "0.58214045",
"text": "def preprocess_targets_targeted_refresh!(ems, targets)\n # We want all targets of class EmsEvent to be merged into one target, so they can be refreshed together, otherwise\n # we could be missing some crosslinks in the refreshed data\n # We can also disable targeted refresh with a setting, then we will just do full ems refresh on any event\n targets_by_ems_id[ems.id] = [\n ems.allow_targeted_refresh? ? InventoryRefresh::TargetCollection.new(:targets => targets, :manager => ems) : ems\n ]\n end",
"title": ""
},
{
"docid": "9db9d685f94198d6fb70b0a5bcd330e8",
"score": "0.5816505",
"text": "def get_targets\n targets = @active_battler.get_targets\n @cursor.set_targets(targets)\n return targets\n end",
"title": ""
},
{
"docid": "750c28c472a68673742cec286cc342ea",
"score": "0.57922095",
"text": "def branch_targets\n []\n end",
"title": ""
},
{
"docid": "02af7321d2683ceeb02ee211acda0a4b",
"score": "0.57880265",
"text": "def by_target\n targets.\n map { |t| [t.object, @matches[t].map { |m| m.candidate.object }] }.\n to_h.\n freeze\n end",
"title": ""
},
{
"docid": "646c47bab038b372672c94c0e27362d7",
"score": "0.5787977",
"text": "def targets(*names, &block)\n if names.empty?\n UI.warning('Book#targets to get all targets is deprecated, use #all_targets instead', location: caller_locations.first)\n return all_targets\n end\n\n names.map { |name| target(name, &block) }\n end",
"title": ""
},
{
"docid": "8b3bb871890d84cc55a38520a86ea8f5",
"score": "0.5757617",
"text": "def targets\n name.split(\"_\")\n end",
"title": ""
},
{
"docid": "7bd27ebca24f218485c0891035135d69",
"score": "0.5746003",
"text": "def targets\n\t\tKassociation.where( :target_id => self.id )\n\tend",
"title": ""
},
{
"docid": "a8ca53a6cb0aba598a57f75155eda58f",
"score": "0.5744392",
"text": "def targets\n\t\tWmapTarget.find(:all)\n\tend",
"title": ""
},
{
"docid": "3577b70d24898e721a8d35db97906e76",
"score": "0.57440054",
"text": "def target(*indexes)\n ['-t', ':' + indexes.join('.')]\n end",
"title": ""
},
{
"docid": "7d27711a8fd6ded49613378b24be2ba8",
"score": "0.57424635",
"text": "def method_missing(method, *args, &block)\n @targets.each { |t| t.send(method, *args, &block) }\n end",
"title": ""
},
{
"docid": "9d27596a813a8d78b90ea082a318f7c9",
"score": "0.5721805",
"text": "def getTargets fullData\r\n\t\t#Clone the test set, inject the target feature bounds, get the feature bounds/target Hash Array\r\n\t\tfullData.injectFeatures({domainLowerBound: @domainLowerBound, domainUpperBound: @domainUpperBound})\r\n\t\ttargets = fullData.segregate([:domainLowerBound, :domainUpperBound, @target], true).getDataStructure(true)\r\n\t\t[fullData, targets]\r\n\tend",
"title": ""
},
{
"docid": "1befa869cf808fad15ebcac512c0a10a",
"score": "0.5713827",
"text": "def targets\n target.split(NAMESPACE_PATTERN)\n end",
"title": ""
},
{
"docid": "1befa869cf808fad15ebcac512c0a10a",
"score": "0.5713827",
"text": "def targets\n target.split(NAMESPACE_PATTERN)\n end",
"title": ""
},
{
"docid": "a6a2f42425cf487a1778b435af35048c",
"score": "0.5707565",
"text": "def index\n @user_targets = UserTarget.all\n end",
"title": ""
},
{
"docid": "5cd790f30b6447c7d47fe08c1de87bef",
"score": "0.56967777",
"text": "def setup_change_target\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n case @acts[1]\n # --------------------\n when 0 # Original Target\n self.area_flag = item_in_use.area?\n @target = @ori_target\n @target_array = @ori_targets.clone\n # -------------------\n when 1 # All Battler\n self.area_flag = true\n t = $game_party.alive_members + $game_troop.alive_members\n @target_array = t\n $game_temp.battler_targets += t\n # -------------------\n when 2 # All Battler except user\n self.area_flag = true\n t = $game_party.alive_members + $game_troop.alive_members\n t -= [self]\n @target_array = t\n $game_temp.battler_targets += t\n # -------------------\n when 3 # All Enemies\n self.area_flag = true\n t = opponents_unit.alive_members\n @target_array = t\n $game_temp.battler_targets += t\n # -------------------\n when 4 # All Enemies except current target\n self.area_flag = true\n t = opponents_unit.alive_members\n t -= [target]\n @target_array = t\n $game_temp.battler_targets += t\n # -------------------\n when 5 # All Allies\n self.area_flag = true\n t = friends_unit.alive_members\n @target_array = t\n $game_temp.battler_targets += t\n # -------------------\n when 6 # All Allies except user\n self.area_flag = true\n t = friends_unit.alive_members\n t -= [self]\n @target_array = t\n $game_temp.battler_targets += t\n # -------------------\n when 7 # Next random enemy\n self.area_flag = false\n @target = opponents_unit.random_target\n @target_array = [@target]\n $game_temp.battler_targets += [@target]\n # -------------------\n when 8 # Next random ally\n self.area_flag = false\n @target = friends_unit.random_target\n @target_array = [@target]\n $game_temp.battler_targets += [@target]\n # -------------------\n when 9 # Absolute Targets (Enemies)\n self.area_flag = true\n @target_array = opponents_unit.abs_target(@acts[2])\n @target_array -= [target] if @acts[3]\n $game_temp.battler_targets += @target_array\n # -------------------\n when 10 # Absolute Target (Allies)\n self.area_flag = true\n @target_array = friends_unit.abs_target(@acts[2])\n @target_array -= [target] if @acts[3]\n $game_temp.battler_targets += @target_array\n # -------------------\n when 11 # self\n self.area_flag = false\n @target = self\n @target_array = [@target]\n $game_temp.battler_targets += [@target]\n end\n end",
"title": ""
},
{
"docid": "f4e7adf5f9c9410307f4cc4becabb080",
"score": "0.5678692",
"text": "def add_default_targets list\n raise \"@targets not defined\" if !defined? @targets # should be defined\n\n list.each_slice( 2 ) { |nm, kind|\n name = add_ext nm, kind # append appropriate extension to name\n\n # target must already exist\n t = find_target name\n raise \"Target #{name} not found\" if !t\n raise \"Multiple targets for #{name}\" if t.size > 1\n @targets << t.first\n }\n end",
"title": ""
},
{
"docid": "8712fa810c68c588d8527603b63fa777",
"score": "0.56661147",
"text": "def target_ids\n case target_class.associations[target_association][:type]\n when :has_one, :belongs_to\n id = target.send(target_attribute) if target\n (id && Set[id]) || Set.new\n when :has_many, :has_and_belongs_to_many\n (target && target.send(target_attribute)) || Set.new\n end\n end",
"title": ""
},
{
"docid": "5a71ac7239a2df3ddef6ce91c509c176",
"score": "0.56593275",
"text": "def read_targets\n\tif $targets_array[1].nil?\n\t\tprint \"Enter target IP address: \"\n\t\t$targets_array.push gets.chomp\n\t\t$target = $targets_array[$targets_array.length - 1]\n\telse\n\t\tputs \"[?]\".blue + \"Select target: \"\n\t\t$targets_array.each_with_index do |value, index|\n\t\t\tputs \"#{index} : #{value}\"\n\t\tend\n\t\tprint \"[?]\".blue + \"Which target should we use (default: 0)? \"\n\t\ttarget = gets.to_i\n\t\tif target == 0 or target.nil?\n\t\t\tprint \"Enter target IP address: \"\n\t\t\t$targets_array.push gets.chomp\n\t\t\t$target = $targets_array[$targets_array.length - 1]\n\t\telse\n\t\t\t$target = $targets_array[target]\n\t\tend\n\tend\nend",
"title": ""
},
{
"docid": "8e1e71bbe219dca4b8646d621db962a0",
"score": "0.5655508",
"text": "def maybe_child_targets uris, uri\n # this could be more efficient by trackign whihc uris have already been fetched\n maybe_new_targets = Links.new(uris, uri)\n maybe_new_targets.get_links.each do |k,v|\n # add children of target\n maybe_add_target k, false, \"\", uri\n end\nend",
"title": ""
},
{
"docid": "603fb1c12de39504cbd22fff1ed32dd1",
"score": "0.5653918",
"text": "def index\n @target = Target.new\n @targets = action_state.targets\n end",
"title": ""
},
{
"docid": "c8ebbc038a89fbf15e56b47f825906d6",
"score": "0.56377",
"text": "def all_targets\n targets = []\n find('').sort.each do |file|\n targets << File.basename(file)\n end\n targets # return\n end",
"title": ""
},
{
"docid": "8131e2da4f6977d0a0c1b60f606a685a",
"score": "0.5629643",
"text": "def user_targets\n return [] unless user_project\n user_target_uuids.map do |uuid|\n native_target = user_project.objects_by_uuid[uuid]\n unless native_target\n raise Informative, '[Bug] Unable to find the target with ' \\\n \"the `#{uuid}` UUID for the `#{self}` integration library\"\n end\n native_target\n end\n end",
"title": ""
},
{
"docid": "bd26674a4407be6d5184e0264e6db28e",
"score": "0.5623733",
"text": "def link_to_target_refs(to_link_array)\n return if to_link_array.empty?\n create_ngrs_objs_hash = to_link_array.inject({}) do |h, to_link_el|\n h.merge(Input::BaseNodes.target_ref_link_hash(to_link_el.node_instance_id, to_link_el.target_ref.id))\n end\n create_objs_hash = { node_group_relation: create_ngrs_objs_hash }\n Model.input_hash_content_into_model(@target.id_handle(), create_objs_hash)\n end",
"title": ""
},
{
"docid": "c5d9fb36029f38cf6f956381e68c3f68",
"score": "0.5599729",
"text": "def make_attack_targets\n targets = []\n if battler.confusion?\n targets.push(friends_unit.random_target)\n elsif battler.berserker?\n targets.push(opponents_unit.random_target)\n else\n targets.push(opponents_unit.smooth_target(@target_index))\n end\n if battler.dual_attack # Chain attack\n targets += targets\n end\n return targets.compact\n end",
"title": ""
},
{
"docid": "a0e4b71648115b9cc565da13fe596d81",
"score": "0.55987334",
"text": "def cmd_with_targets(cmd_array, target, extras)\n final_arr = cmd_array\n final_arr.concat(['-target', target]) unless target.nil?\n # rubocop:disable Style/SafeNavigation\n extras.each { |e| final_arr.concat(['-target', e]) } unless extras.nil?\n # rubocop:enable Style/SafeNavigation\n final_arr.join(' ')\n end",
"title": ""
},
{
"docid": "0c8d7c0473f87b1c88aa3dd7599f2422",
"score": "0.55956686",
"text": "def each_target(&block)\n\t\ttargets.each do |target|\n\t\t\tblock.call(target)\n\t\tend\n\tend",
"title": ""
},
{
"docid": "0c8d7c0473f87b1c88aa3dd7599f2422",
"score": "0.55956686",
"text": "def each_target(&block)\n\t\ttargets.each do |target|\n\t\t\tblock.call(target)\n\t\tend\n\tend",
"title": ""
},
{
"docid": "9c5fb8f1e3dc2f459c1b8687ff94bb56",
"score": "0.5580495",
"text": "def parse_options(_targets)\n []\n end",
"title": ""
},
{
"docid": "63d66a7b5a613cac726b330547cfe3ed",
"score": "0.55694157",
"text": "def targets(options = {})\n run_command('targets', options)\n end",
"title": ""
},
{
"docid": "bdbb35888d1a662c271fd36cae97e08c",
"score": "0.5554715",
"text": "def valid_targets\n valid = []\n self.class.fetch_tgts.collect do |target|\n begin\n fetch target\n valid << target\n rescue\n # noop\n end\n end\n valid\n end",
"title": ""
},
{
"docid": "bd4431abb2a49782d95695cbd39f2c48",
"score": "0.55544317",
"text": "def target(*target_vectors)\n new_map.target(*target_vectors)\n end",
"title": ""
},
{
"docid": "b44c5620e7534ab859f1d3ea646c2c1f",
"score": "0.55510277",
"text": "def initialize(name)\n @targets = Array.new\n @name = name\n @color = nil\n end",
"title": ""
},
{
"docid": "335d11c3c6a53f39f1e8d8d22299b42e",
"score": "0.5511647",
"text": "def get_targets(path, logger)\n logger.info 'Gathering Targets...'\n open(path) { |f| f.read }\n end",
"title": ""
},
{
"docid": "eccb4fde659dbec432ea0b9fd9d677ec",
"score": "0.54921836",
"text": "def targetsAggregate _obj, _args\n \"_obj targetsAggregate _args;\" \n end",
"title": ""
},
{
"docid": "6c2190bebd37520d87aca79f586a4c73",
"score": "0.54860646",
"text": "def index\n @targets = Target.all.page(params[:page])\n end",
"title": ""
},
{
"docid": "4f06c90ee0ea096b3c3cd823836e25ed",
"score": "0.5483103",
"text": "def add_target_set(value)\n @children['target-set'][:value] << value\n end",
"title": ""
},
{
"docid": "9377e77a405498e3dbb37aa1907e1974",
"score": "0.5437669",
"text": "def target=(target)\n @target = target\n @ori_target = target\n end",
"title": ""
},
{
"docid": "13183c59b19a222bf23a45b5a89f605f",
"score": "0.54122907",
"text": "def true_targets\n return [] unless deleted_at.nil?\n\n release_tags.where(release_type: true).map(&:name) | Settings.ALWAYS_SEND_TRUE_TARGET.to_a\n end",
"title": ""
},
{
"docid": "21664c55c0e97deeb29c0126cd4ea36a",
"score": "0.53970414",
"text": "def md_array(target)\n md_array = [[],[],[]]\n\n target.each_index do |row_index|\n target[row_index].each_index do |col_index|\n md_array[row_index][col_index] =\n distance(target[row_index][col_index], target)\n end\n end\n\n md_array\n end",
"title": ""
},
{
"docid": "9fe89fba8991d2d3f61eefdcb17b08d9",
"score": "0.5394968",
"text": "def target\n unless defined?(@target)\n d = @data\n @target = SeqDesc.new(d[6], d[7], d[13], d[14], d[15], d[16],\n split_comma(d[20]), split_comma(d[22]))\n end\n @target\n end",
"title": ""
},
{
"docid": "60658f9e647f4404336b170fffb93130",
"score": "0.53921574",
"text": "def index\n @targets = current_user.targets\n end",
"title": ""
},
{
"docid": "5885b3c45d015ab3defdb774941c02ee",
"score": "0.5377776",
"text": "def addRefs2Target(filePath,targets,group)\n\tfile_refs = []\n\tDir.foreach(filePath) do |file|\n\t\tif file.to_s.end_with?(keyword) then\n\t\t\tpathNeed = File.join(filePath,file)\n\t\t\t# puts path\n\t\t\tfile_ref = group.new_reference(pathNeed)\n\t\t\tfile_refs.push(file_ref)\n\t\t\t# target.resources_build_phase.add_file_reference(file_ref, true)\n\t\tend\n\tend\n\t# add_file_references\n\ttargets.each do |target|\n\t\ttarget.add_resources(file_refs)\n\tend\nend",
"title": ""
},
{
"docid": "6580c3bc337a9e9c43953b9d53a9e9a9",
"score": "0.5376987",
"text": "def inspect_targets(targets_orig,privates_orig,blacklisted_orig, logger=$LOG)\n targets,privates,blacklisted=targets_orig.clone,privates_orig.clone,blacklisted_orig.clone\n raise \"#{targets.class} not an Array!\\n #{targets_orig.class}\\n #{targets_orig.inspect}\\n #{targets.inspect}\" if !targets.respond_to?(:delete_if)\n targets.delete_if {|target| \n # to handle cases like timestamp when the request is actually an array\n # we assume the first is the destination and do not blacklist based on\n # the other values\n if target.class==Array\n target=target.at(0)\n end\n privates.include?(target) or blacklisted.include?(target) or\n if Inet::in_private_prefix?(target)\n privates << target\n logger.puts \"Removed private address #{target} from targets\"\n true\n elsif Inet::in_blacklisted_prefix?(target)\n blacklisted << target\n logger.puts \"Removed blacklisted address #{target} from targets\"\n true\n else\n false\n end\n }\n return targets, privates, blacklisted\nend",
"title": ""
},
{
"docid": "0e6447dbb23fa8a7669af5fa628e8660",
"score": "0.5357324",
"text": "def target_idx\n @target_idx\n end",
"title": ""
},
{
"docid": "c4734d6202ec9de9d1069051124edd1a",
"score": "0.53563327",
"text": "def add_target(target)\n\n # If there are no targets yet, use this one as the default\n if @active_target == nil #@targets.empty?\n target.active = true\n @active_target = target\n end\n\n # Push the new target\n @targets[target.name] = target\n\n #write out the config\n dump_settings\n\n puts \"Target Added\"\n target.print\n end",
"title": ""
},
{
"docid": "8ba1fd17b5638b74e54a991a82f75a19",
"score": "0.5354185",
"text": "def set_discover_targets(discover:)\n {\n method: \"Target.setDiscoverTargets\",\n params: { discover: discover }.compact\n }\n end",
"title": ""
},
{
"docid": "221e6fc73405618c073ea6850bd892c0",
"score": "0.5353274",
"text": "def versions_for_targets\n versions_for_targets = []\n target_version_array.each_with_index do |target_version, i|\n if !target_version.nil?\n versions_for_targets.push(target_version)\n else\n versions_for_targets.push(nil) if allow_nils?\n end\n end\n multipackage? ? versions_for_targets : versions_for_targets[0]\n end",
"title": ""
},
{
"docid": "a3b4f4fddcce9745f2794c203d063193",
"score": "0.5351613",
"text": "def target=(target)\n self.each{|e| e.target=target}\n end",
"title": ""
},
{
"docid": "d654994ae181f775061bf0a61ff3ee75",
"score": "0.5322283",
"text": "def tbs_make_attack_targets \n targets = []\n targets += subject.opponents + subject.friends\n targets &= subject.opponents if !GTBS::ATTACK_ALLIES\n targets &= $tbs_cursor.targeted_battlers \n targets = targets.select {|target| target.dead? == false}\n return targets.compact\n end",
"title": ""
},
{
"docid": "4ad95763b34c6df93d327c08d606ca03",
"score": "0.53151095",
"text": "def target=(value)\n @target = value\n end",
"title": ""
},
{
"docid": "c4ff1207817b1ff7bb668c612b100763",
"score": "0.5314027",
"text": "def target\n VertexSet.new(self.collect {|e| e.target}).uniq\n end",
"title": ""
}
] |
dbdd2d0102791dd5e0a0d109f201472f
|
Load the initial state for the script. Abstract method to be implemented by extending classes.
|
[
{
"docid": "587d22cdc8bf74e22a0d6b9e431592a9",
"score": "0.6524608",
"text": "def load_initial_state()\n CopySnapshotState.load_state(@input_params)\n end",
"title": ""
}
] |
[
{
"docid": "40baa6255b638c3fd98a3e534d94735f",
"score": "0.689019",
"text": "def run_init_script; end",
"title": ""
},
{
"docid": "7f2cdf3febdc549f87fccb12e9faf163",
"score": "0.65803856",
"text": "def load_initial_state()\n CopyMsWindowsSnapshotState.load_state(@input_params)\n end",
"title": ""
},
{
"docid": "d4e9f0893e8e7fcd593fb99f037fd63d",
"score": "0.64291793",
"text": "def begin_load\n load_stack.push(true)\n end",
"title": ""
},
{
"docid": "a7d8bb9611baa8155dfe2152dca33f49",
"score": "0.63523793",
"text": "def init\n fname = path(\"init.rb\")\n load fname unless fname.nil?\n end",
"title": ""
},
{
"docid": "42ce8e7ae9879e41aef2d8ed6f541105",
"score": "0.6313589",
"text": "def load_state\n return {} unless @state_reader\n\n @state_reader.call\n end",
"title": ""
},
{
"docid": "1e1fdeaf33040cc06126d1823dabea59",
"score": "0.62476283",
"text": "def start\n\t\tinit\n\t end",
"title": ""
},
{
"docid": "42fd71e744b6f5420f547b0e7f48520e",
"score": "0.6190797",
"text": "def initialize\n\t \t# loading or not loading should be the key here.\n end",
"title": ""
},
{
"docid": "b91a2305d7b5b7eb3e043ec8871310b4",
"score": "0.61046207",
"text": "def set_initial_state state\n $LOGGER.info \"Setting up the initial state of the game.\"\n @state = state\n calculate_shadows @player_name\n end",
"title": ""
},
{
"docid": "119720001509c7961196e5a5d3fac99c",
"score": "0.6080289",
"text": "def initial\n end",
"title": ""
},
{
"docid": "c81c5ee355f51086bd1045c75a3c5c34",
"score": "0.6078878",
"text": "def init_script\n @adapter.init_script\n end",
"title": ""
},
{
"docid": "b9ca45da8b10ca78fb43d6693e3ea429",
"score": "0.60544086",
"text": "def init\n Runner.in_shell = true\n Command.all_option_commands = true if @options[:option_commands]\n super\n Index.update(:verbose=>true, :libraries=>@options[:index]) if @options.key?(:index)\n if @options[:load]\n Manager.load @options[:load], load_options\n elsif @options[:execute]\n define_autoloader\n else\n load_command_by_index\n end\n end",
"title": ""
},
{
"docid": "622addc23a38f899b790a0756c46d323",
"score": "0.6033329",
"text": "def initialize_state\n load_and_process_n3 '{ <http://example.com/x> <http://example.com/y> <http://example.com/z>.} a <http://purl.org/restdesc/states#State>.'\n end",
"title": ""
},
{
"docid": "66374193a218eb652af22e6d43c78d37",
"score": "0.60204047",
"text": "def load_state\n begin\n if File.file?(\"#{$statefile}\") && File.readable?(\"#{$statefile}\") \n @current_state = File.read(\"#{$statefile}\").strip.split(':')\n end\n rescue\n error('Invalid Resume Point')\n exit 1\n end\n end",
"title": ""
},
{
"docid": "ecca10e1ea0b403498ae01fdbd11afbd",
"score": "0.60195243",
"text": "def initialize\n @state_file = \"./workspace.json\"\n get_state\n self\n end",
"title": ""
},
{
"docid": "0fad9cda4b4d34ea3e013276a2a60183",
"score": "0.60101324",
"text": "def initialize(script)\n @script = File.expand_path(script)\n @mount = File.basename(script, '.rb')\n @requires = nil\n load_app\n end",
"title": ""
},
{
"docid": "82070bc3b0099a03b407e64cf40bb8f7",
"score": "0.6002055",
"text": "def load_state\n if File.file?(STATE_FILE)\n state = RightScale::JsonUtilities::read_json(STATE_FILE)\n @log_level = state['log_level'] || Logger::INFO\n Log.info(\"Initializing CookState from #{STATE_FILE} with #{state.inspect}\") if @log_level == Logger::DEBUG\n\n @has_downloaded_cookbooks = state['has_downloaded_cookbooks']\n @startup_tags = state['startup_tags'] || []\n @reboot = state['reboot']\n @log_file = state['log_file'] # nil if not in state loaded from disk\n end\n true\n end",
"title": ""
},
{
"docid": "2e2b4de9e6f602eb8387f4810892c78e",
"score": "0.5994038",
"text": "def set_initial_state!\n\t\t\t\tdefaults = {\n\t\t\t\t}\n\t\t\t\topts = read_initial_state\n\t\t\t\topts = defaults.merge(opts)\n\t\t\t\topts[:dealer] = opts[:button_seat]\n\t\t\t\tinitialize_from_opts(opts)\n\t\t\t\tstart_hand\n\t\t\tend",
"title": ""
},
{
"docid": "f867917810b8883c527f144db05c101d",
"score": "0.5975514",
"text": "def initialize\n # set some defaults\n @has_downloaded_cookbooks = false\n @reboot = false\n @startup_tags = []\n @log_level = Logger::INFO\n @log_file = nil\n\n # replace defaults with state on disk\n load_state\n\n true\n end",
"title": ""
},
{
"docid": "821168b3da4b9627ed3b0de5f6b6c0f0",
"score": "0.59600466",
"text": "def script_load(script); end",
"title": ""
},
{
"docid": "867f9e55543df7a15d432415211f9c56",
"score": "0.5956832",
"text": "def initial_state\n {}\n end",
"title": ""
},
{
"docid": "8890eadeb1c3e928482718f51822c008",
"score": "0.5932221",
"text": "def initialise(loadfile)\n\n # Initialise steps\n\n phases = Phases.new\n $commands = Commands.new\n \n if $testing == 1\n require_relative 'Testing.rb'\n require_relative '../Extra/Parser.rb'\n end\n \n if $debugplay == 1\n $debug.debugplay\n end\n \n # Initialise graphics if graphics mode is on\n #if $graphics == 1\n #require 'RMagick'\n require_relative '../Graphics/GraphicsHandler.rb'\n #graphicsinit\n #end\n \n #system(\"unzip ../Resources/Images.zip\")\n \n \n # Load game\n if $loadgame == true\n loadgame(loadfile)\n end\n \n # Set command authentication levels\n IO.foreach(\"cards.txt\") { |line| puts line }\n \nend",
"title": ""
},
{
"docid": "971c9b96721b1f079c68fbfdb420b0b4",
"score": "0.5923814",
"text": "def loaded()\n end",
"title": ""
},
{
"docid": "e09d6fdd2fa762fdfd411133fd646802",
"score": "0.5920761",
"text": "def init\n require File.expand_path( '../irbtools.rb', File.dirname(__FILE__) )\n end",
"title": ""
},
{
"docid": "4118d344b4f50927426e776d9bbb91df",
"score": "0.59138674",
"text": "def start\n unpack_scripts if File.exist?(DEFLATE_SCRIPT_PATH)\n # Load PSDK Scripts\n if File.exist?(index_filename)\n load_script_from_index\n else\n File.open(SCRIPT_INDEX_PATH, 'w') do |file|\n load_vscode_scripts(VSCODE_SCRIPT_PATH, file)\n end\n end\n # Load RMXP Scripts\n load_rmxp_scripts\n # Load Project Scripts\n load_vscode_scripts(PROJECT_SCRIPT_PATH) if index_filename == SCRIPT_INDEX_PATH\n end",
"title": ""
},
{
"docid": "fa04026d73b5bba9b8dec85a328117bd",
"score": "0.58993226",
"text": "def init\r\n @tasks = {\r\n on_update: {},\r\n on_scene_switch: {},\r\n on_dispose: {},\r\n on_init: {},\r\n on_warp_start: {},\r\n on_warp_process: {},\r\n on_warp_end: {},\r\n on_hour_update: {},\r\n on_getting_tileset_name: {},\r\n on_transition: {}\r\n }\r\n @storage = {}\r\n end",
"title": ""
},
{
"docid": "f52792eb425d4018502dc7200a2dd965",
"score": "0.58945817",
"text": "def initialize\n @scripts = enumerate_scripts\n end",
"title": ""
},
{
"docid": "1447dc17db11d50be24a625c66c4eb32",
"score": "0.5856286",
"text": "def initialize()\n @tileset = Gosu::Image.load_tiles(\"media/tileset.png\", TILE_WIDTH, TILE_HEIGHT, tileable: true)\n\n # Load images here so they will only be loaded once per game\n @enemyAnimation = *Gosu::Image.load_tiles(\"media/enemy_char.png\", Enemy::WIDTH, Enemy::HEIGHT)\n @portalAnimation = *Gosu::Image.load_tiles(\"media/portal.png\", Portal::WIDTH, Portal::HEIGHT)\n @diamondImg = Gosu::Image.new(\"media/diamond.png\")\n\n # Load all the stages in to an array\n @stages = Dir.glob('stages/*').select { |e| File.file? e }\n @finalStage = false\n end",
"title": ""
},
{
"docid": "bcec66ff8dfcfffe65feadfce7ffcc9d",
"score": "0.5819243",
"text": "def define_state_initializer; end",
"title": ""
},
{
"docid": "940051fabf3c6fb8f63e0f01e766b128",
"score": "0.58190197",
"text": "def initialize_component\n initialize_key\n initialize_state\n end",
"title": ""
},
{
"docid": "2ff45ded620a1e40cb6bdd71d4bf191e",
"score": "0.58113927",
"text": "def Init(conditions)\r\n\t\t@start_state = conditions\r\n\tend",
"title": ""
},
{
"docid": "5edac9eb313dd2d82caf4151ca49e7b0",
"score": "0.58004665",
"text": "def post_init\n end",
"title": ""
},
{
"docid": "4a64931c8b6aad6dd672313b808c4ad9",
"score": "0.57995856",
"text": "def initial; end",
"title": ""
},
{
"docid": "055ec6957627ab12119ec36224ec77b1",
"score": "0.5799075",
"text": "def _start_scene\n # Load YAML file\n build_scene(scene_file) if scene_file\n # Call hook method\n start_scene\n # Perform opening transition\n do_transition(transition_options[:start]) if transition_options.try(:[], :start)\n # Mark self as built\n @built = true\n end",
"title": ""
},
{
"docid": "0c19881aecd1f9fe8a7b3854b2fee4f5",
"score": "0.5780288",
"text": "def run_init_script(out = handler.interface)\n cwd_script_file = File.expand_path(File.join(\".\", INITFILE))\n run_script(cwd_script_file, out) if File.exists?(cwd_script_file)\n\n home_script_file = File.expand_path(File.join(HOME_DIR, INITFILE))\n run_script(home_script_file, out) if File.exists?(home_script_file) and \n cwd_script_file != home_script_file\n end",
"title": ""
},
{
"docid": "0c19881aecd1f9fe8a7b3854b2fee4f5",
"score": "0.5780288",
"text": "def run_init_script(out = handler.interface)\n cwd_script_file = File.expand_path(File.join(\".\", INITFILE))\n run_script(cwd_script_file, out) if File.exists?(cwd_script_file)\n\n home_script_file = File.expand_path(File.join(HOME_DIR, INITFILE))\n run_script(home_script_file, out) if File.exists?(home_script_file) and \n cwd_script_file != home_script_file\n end",
"title": ""
},
{
"docid": "92d3cfbb1861e7ca1a444c6f1119ec30",
"score": "0.57745486",
"text": "def initialize\n @scripts, @script_info = {}, []\n\n unless Dir.exists? \"scripts\"\n raise \"Scripts directory does not exist.\"\n end\n end",
"title": ""
},
{
"docid": "3479a20c3f153abfe120b94af592f187",
"score": "0.57629573",
"text": "def at_init\n\n\t\tend",
"title": ""
},
{
"docid": "2f58c03ca52b3b28ddf86f952786b260",
"score": "0.5760632",
"text": "def initialize\n @scripts, @script_info = {}, []\n\n unless Dir.exist? 'scripts'\n # XXX - raise a better exception here\n raise 'Scripts directory does not exist.'\n end\n end",
"title": ""
},
{
"docid": "24485bc962d3c0e22bdb18629d749bed",
"score": "0.5758004",
"text": "def load_scripts!\n scripts_dir = File.expand_path @config['blur']['scripts_dir']\n script_file_paths = Dir.glob File.join scripts_dir, '*.rb'\n\n # Sort the script file paths by file name so they load by alphabetical\n # order.\n #\n # This will make it possible to create a script called '10_database.rb'\n # which will be loaded before '20_settings.rb' and non-numeric prefixes\n # will be loaded after that.\n script_file_paths = script_file_paths.sort do |a, b|\n File.basename(a) <=> File.basename(b)\n end\n\n script_file_paths.each { |script_path| load_script_file script_path }\n\n initialize_superscripts\n\n emit :scripts_loaded\n end",
"title": ""
},
{
"docid": "58068a6774df8e00d519fb1da526fbd8",
"score": "0.5745243",
"text": "def initialise_process\n self.state = \"Initiated\"\n self.save!\n self.init_process\n end",
"title": ""
},
{
"docid": "7160f7abe22fa2f5b03a347e97a891d7",
"score": "0.5737426",
"text": "def initialize(state); end",
"title": ""
},
{
"docid": "0358c5cab973f4b834696a93992d3615",
"score": "0.5731202",
"text": "def initialize(script)\n @script = script\n end",
"title": ""
},
{
"docid": "8e195ddaa2044f6655a0f93bc4c7c7c7",
"score": "0.5698888",
"text": "def initialize \n # Keep track of hooks and what object owns what\n @hooks = {}\n @cmds = {}\n @modules = {}\n\n # Prevent access to hooks when other things are\n # editing or using them.\n @hooks_mutex = Mutex.new\n end",
"title": ""
},
{
"docid": "2ec44876e3c11a7b1fac5e7bf02e9edd",
"score": "0.56926006",
"text": "def begin_load_revision\n load_revision_stack.push(true)\n end",
"title": ""
},
{
"docid": "3bdcbad2f4dab33b0654c227334c5258",
"score": "0.56875104",
"text": "def load_state()\n if session[:game_state_id] == nil\n send_code(\"E03\")\n return false\n else\n @game_state_id = session[:game_state_id]\n end\n\n @game_state = GameState.find_by(id: @game_state_id)\n @problem = Problem.find_by(id: @game_state.problem_id)\n begin\n @ia_player = IaSgf.new(@problem.ia_color, @problem.problem_file)\n rescue MyError::IaInitError\n send_code(\"E00\")\n return false\n end\n begin\n @ia_player.catch_up(@game_state.board.move_history)\n rescue MyError::IaError => e\n puts \"ERREUR ===============================================\"\n puts e.message\n puts e.backtrace\n puts \"======================================================\"\n send_code(\"E01\")\n return false\n end\n\n return true\n end",
"title": ""
},
{
"docid": "dc90d29d71dcbecfbdd1751b07b0b039",
"score": "0.5679602",
"text": "def init\n end",
"title": ""
},
{
"docid": "dc90d29d71dcbecfbdd1751b07b0b039",
"score": "0.5679602",
"text": "def init\n end",
"title": ""
},
{
"docid": "dc90d29d71dcbecfbdd1751b07b0b039",
"score": "0.5679602",
"text": "def init\n end",
"title": ""
},
{
"docid": "5cf2cba0ee7f9825b63b087af5363b37",
"score": "0.5666345",
"text": "def init; end",
"title": ""
},
{
"docid": "5cf2cba0ee7f9825b63b087af5363b37",
"score": "0.5666345",
"text": "def init; end",
"title": ""
},
{
"docid": "5cf2cba0ee7f9825b63b087af5363b37",
"score": "0.5666345",
"text": "def init; end",
"title": ""
},
{
"docid": "5cf2cba0ee7f9825b63b087af5363b37",
"score": "0.5666345",
"text": "def init; end",
"title": ""
},
{
"docid": "b7bc9b8052462c28d50d4b1ed1ddd5e8",
"score": "0.5665676",
"text": "def init_state\n JTAG_CONFIG[:init_state]\n end",
"title": ""
},
{
"docid": "024e7b95ece34f61c588b50f943de997",
"score": "0.5658082",
"text": "def initialize\n load_data\n end",
"title": ""
},
{
"docid": "e7843db660900bced9869e56e793b762",
"score": "0.56526804",
"text": "def load_scripts\n $log.info('ScriptManager.initilize') { 'Loading scripts.' }\n\n noload = Bot::Conf[:core][:noload]\n\n Dir.glob(\"#{SCRIPTS_PATH}/*.rb\").each do |file|\n\n unless noload == nil\n # I realize we are pulling the name out twice. Deal with it.\n next if noload.keys.include? file.match(\"#{SCRIPTS_PATH}/(.+).rb\")[1].to_sym\n end\n\n $log.debug(\"ScriptManager.initilize\") { \"Loading #{file}\" }\n load_file file\n\n end\n end",
"title": ""
},
{
"docid": "f288be9c8cfb8d3cff55ea2a24d8c9b3",
"score": "0.56435287",
"text": "def start\n $game_variables[VAR] = {}\n $game_variables[VAR2] = {}\n @load_hash = nil\n @load_item_hash = nil\n @item_amounts = {}\n save_turn_data\n end",
"title": ""
},
{
"docid": "77cbf7cd6d80f03652597905d30c7de5",
"score": "0.5639765",
"text": "def initial_state=(new_initial_state); end",
"title": ""
},
{
"docid": "ea299e6a97a07a5f8c3494419e5a9dab",
"score": "0.5633515",
"text": "def Init()\n end",
"title": ""
},
{
"docid": "003e3d2fcd99a55d2e12099babb8b408",
"score": "0.56333965",
"text": "def run_init_script(out = handler.interface)\n cwd_script = File.expand_path(File.join(\".\", INITFILE))\n run_script(cwd_script, out) if File.exist?(cwd_script)\n\n home_script = File.expand_path(File.join(ENV['HOME'].to_s, INITFILE))\n if File.exist?(home_script) and cwd_script != home_script\n run_script(home_script, out)\n end\n end",
"title": ""
},
{
"docid": "0384a154f54dec1568d9cfee44e0a504",
"score": "0.562742",
"text": "def initialize(interpreter)\n @app = interpreter\n @state = :ready\n @state_arg = nil\n end",
"title": ""
},
{
"docid": "51fd78728b93fa40c633cf4d88aaacbd",
"score": "0.56267583",
"text": "def load_state\n save_file = File.read(\"saved_state.json\")\n json_hash = JSON.parse(save_file)\n @secret_word = json_hash[\"secret_word\"]\n @display_content = json_hash[\"display_content\"]\n @failed_attemps = json_hash[\"failed_attemps\"]\n end",
"title": ""
},
{
"docid": "5ff47a148ae5fd73442702a55df40c4a",
"score": "0.56240344",
"text": "def start\n @state_machine.startup\n end",
"title": ""
},
{
"docid": "5d4e7111276a253b1584af56b90a1c43",
"score": "0.56206006",
"text": "def before_start\n super\n self.sub_state = :before unless self.sub_state\n end",
"title": ""
},
{
"docid": "da6ee1a7101db4d7787240e2b434cdb6",
"score": "0.56184465",
"text": "def start\n # start a timer on scene load\n @timer.reset_timer\n case @scene\n when 'intro'\n start_intro\n when 'level'\n start_level\n when 'transition'\n start_transition\n when 'credits'\n start_credits\n end\n end",
"title": ""
},
{
"docid": "e059b78a3db39df3941faca39728e0ea",
"score": "0.56090456",
"text": "def load\n end",
"title": ""
},
{
"docid": "e059b78a3db39df3941faca39728e0ea",
"score": "0.56090456",
"text": "def load\n end",
"title": ""
},
{
"docid": "e059b78a3db39df3941faca39728e0ea",
"score": "0.56090456",
"text": "def load\n end",
"title": ""
},
{
"docid": "0cb87f7c818006eb5b5bf66ccca26eac",
"score": "0.5593124",
"text": "def initialize_superscripts\n scripts_config = @config['scripts']\n scripts_cache_dir = File.expand_path @config['blur']['cache_dir']\n\n Blur.scripts.each do |name, superscript|\n script = superscript.allocate\n script.cache = ScriptCache.load name, scripts_cache_dir\n script.config = scripts_config.fetch name, {}\n script._client_ref = self\n script.send :initialize\n\n @scripts[name] = script\n end\n end",
"title": ""
},
{
"docid": "b4564878f41d2dc8b68d6cb6ee7657aa",
"score": "0.5575851",
"text": "def beginning\n abstract!\n end",
"title": ""
},
{
"docid": "8c49a900e72df23aff491eb3631882c1",
"score": "0.55758065",
"text": "def load\n\t\t\t\t0\n\t\t\tend",
"title": ""
},
{
"docid": "b71533860e7e8473e04ae793f2cc3763",
"score": "0.5574055",
"text": "def post_init\n end",
"title": ""
},
{
"docid": "b04379bd69e2d611d38ac5d53a132a13",
"score": "0.5573661",
"text": "def on_init; end",
"title": ""
},
{
"docid": "b04379bd69e2d611d38ac5d53a132a13",
"score": "0.5573661",
"text": "def on_init; end",
"title": ""
},
{
"docid": "3499f1b223b7c0f1f764af50c32974cf",
"score": "0.55725545",
"text": "def load\n Pry.initial_session_setup\n define_additional_commands\n\n Pry.config.hooks.add_hook(:when_started, :start_non_interactively) do |o, t, _pry_|\n non_interactive_mode(_pry_)\n end\n\n Pry.start(Pry.toplevel_binding,\n :input => @content,\n :input_stack => [StringIO.new(\"exit-all\\n\")])\n end",
"title": ""
},
{
"docid": "12aa8416c387aaa74237ac768530f5f4",
"score": "0.55710524",
"text": "def loadScripts\n load \"su2dslib/preferences.rb\"\n load \"su2dslib/exportbase.rb\"\n load \"su2dslib/interface.rb\"\n load \"su2dslib/numeric.rb\"\n load \"su2dslib/material.rb\"\n load \"su2dslib/radiance_entities.rb\"\n load \"su2dslib/radiancescene.rb\"\n load \"su2dslib/location.rb\"\n load \"su2dslib/resultsgrid.rb\"\nend",
"title": ""
},
{
"docid": "17b4e0635505069dec955cf0be13c542",
"score": "0.5557375",
"text": "def initialize\n\n @prompt = TTY::Prompt.new\n escape_to_welcome\n LoadAssets.load_logo\n\n end",
"title": ""
},
{
"docid": "d132f174a632eca3d023006708eb170a",
"score": "0.5553651",
"text": "def initialize()\n @template = \"call load_file() or load_url() to load a template\"\n @loadOK = false \n end",
"title": ""
},
{
"docid": "823b66308265a4cc7a5f4dff9fd7fc4c",
"score": "0.55481255",
"text": "def preload!\n end",
"title": ""
},
{
"docid": "47dc01e9094e75aba80bbbdcf193f69e",
"score": "0.55369467",
"text": "def initialize(script, tokenDefMap, orig_line_number)\n @orig_script = script\n @script = filter_ws(script)\n @nextStateId = 0\n @tokenDefMap = tokenDefMap\n @orig_line_number = orig_line_number\n parseScript\n end",
"title": ""
},
{
"docid": "7aeaeec6886d4f40f4e83dbe7cddc3a5",
"score": "0.5531288",
"text": "def initialize(install_path, game_path)\n @install_path = install_path\n @game_path = game_path\n # Set of scripts that have been run\n @runs = {}\n end",
"title": ""
},
{
"docid": "360efe6a98721e6c1dbbfdf8545593a5",
"score": "0.5522896",
"text": "def init\n Config.load_yaml\n Log.init\n reset\n end",
"title": ""
},
{
"docid": "e4b99d1c832246b84ac5837bfc0a2817",
"score": "0.551841",
"text": "def initialize(*params)\n super(*params)\n @script = Script.new(nil, init_parameters, logger)\n @script.js_eval @init if @init\n @js_filter = nil\n end",
"title": ""
},
{
"docid": "9995e1a056b9665f2315d22196e9ac90",
"score": "0.55171424",
"text": "def initialize(script)\r\n @script = script\r\n $tester = self\r\n Object.define_method(:reload) { $tester.load_script }\r\n Object.define_method(:restart) { $tester.restart_scene }\r\n Object.define_method(:quit) { $tester.quit_test }\r\n data_load\r\n $pokemon_party = PFM::Pokemon_Party.new\r\n $pokemon_party.expand_global_var\r\n @thread = Thread.new do \r\n while true\r\n sleep(0.1)\r\n if Input::Keyboard.press?(Input::Keyboard::F9)\r\n print \"\\rMouse coords = %d,%d\\nCommande : \" % [Mouse.x, Mouse.y]\r\n sleep(0.5)\r\n end\r\n end\r\n end\r\n load_script\r\n show_test_message\r\n @unlocked = true\r\n rescue Exception\r\n manage_exception\r\n end",
"title": ""
},
{
"docid": "7a90e999582dc21f74ea241270a82f05",
"score": "0.55132854",
"text": "def init_file; end",
"title": ""
},
{
"docid": "1ccc82fdf2f0693e29406f5d619a0674",
"score": "0.55088174",
"text": "def init\n @state = :initializing if @state == :created\n true\n end",
"title": ""
},
{
"docid": "f5355cb651885602f0556180870bf9b7",
"score": "0.5506245",
"text": "def startup\n end",
"title": ""
},
{
"docid": "af96f39eef7e62f53cff5dddff47aa2a",
"score": "0.55029017",
"text": "def startup\n end",
"title": ""
},
{
"docid": "af96f39eef7e62f53cff5dddff47aa2a",
"score": "0.55029017",
"text": "def startup\n end",
"title": ""
},
{
"docid": "af96f39eef7e62f53cff5dddff47aa2a",
"score": "0.55029017",
"text": "def startup\n end",
"title": ""
},
{
"docid": "d1ca5ae624f43e229954013d811b0dfb",
"score": "0.5486671",
"text": "def initialize(path, load=nil)\n @path = path\n @inihash = {}\n \n if load or ( load.nil? and FileTest.readable_real? @path )\n restore()\n end\n end",
"title": ""
},
{
"docid": "f0f326d225e8cbd133913143052a8a4a",
"score": "0.5485182",
"text": "def setup(state) ; end",
"title": ""
},
{
"docid": "91d1ad3387938dd2045c925257c13420",
"score": "0.54834217",
"text": "def aasm_ensure_initial_state\n AASM::StateMachineStore.fetch(self.class, true).machine_names.each do |name|\n aasm_column = self.class.aasm(name).attribute_name\n aasm(name).enter_initial_state if !read_attribute(aasm_column) || read_attribute(aasm_column).empty?\n end\n end",
"title": ""
},
{
"docid": "52731326634934653bbbb06a914d2324",
"score": "0.5483267",
"text": "def aasm_ensure_initial_state\n self.aasm_state = :new\n end",
"title": ""
},
{
"docid": "b6843c830a09df529e62283869012766",
"score": "0.5479072",
"text": "def load_scripts\n $log.info(\"ScriptManager.initilize\") { \"Loading scripts.\" }\n\n noload = Bot::Conf[:core][:noload]\n\n Dir.glob(\"scripts/*.rb\").each do |file|\n\n unless noload == nil\n # I realize we are pulling the name out twice. Deal with it.\n next if noload.keys.include? file.match(\"scripts/(.+).rb\")[1].to_sym\n end\n\n $log.debug(\"ScriptManager.initilize\") { \"Loading #{file}\" }\n load_file file\n\n end\n end",
"title": ""
},
{
"docid": "868bee689e613366bcde437be63323ba",
"score": "0.5473395",
"text": "def init\n\n end",
"title": ""
},
{
"docid": "c3867e650b6f9ecf84278b807e58dee9",
"score": "0.54656744",
"text": "def initialize()\n begin\n puts \"Eis::Runner::init called\" if $DEBUG\n @loaded_modules = []\n generate_module_list()\n handle = InputHandler.new()\n set_environment()\n rescue ArgumentError =>e\n puts \"\\e[31mERROR\\e[0m: No config file given...\" + e\n puts \"--------------------------------------------\"\n raise\n end\n end",
"title": ""
},
{
"docid": "9b450a904a75fbcb51a3e76ac6dd9809",
"score": "0.54651195",
"text": "def load; end",
"title": ""
},
{
"docid": "9b450a904a75fbcb51a3e76ac6dd9809",
"score": "0.54651195",
"text": "def load; end",
"title": ""
},
{
"docid": "9b450a904a75fbcb51a3e76ac6dd9809",
"score": "0.54651195",
"text": "def load; end",
"title": ""
},
{
"docid": "1a4e360dc8d241c9ed00919b1f49a606",
"score": "0.54626256",
"text": "def initialize_state\n return if state_initialized?\n adapter = ViewComponentReflex::Engine.state_adapter\n \n # newly mounted\n if !stimulus_reflex? || adapter.state(request, @key).empty?\n\n new_state = create_safe_state\n\n adapter.wrap_write_async do\n adapter.store_state(request, @key, new_state)\n adapter.store_state(request, \"#{@key}_initial\", new_state)\n end\n\n # updating a mounted component\n else\n initial_state = adapter.state(request, \"#{@key}_initial\")\n\n parameters_changed = []\n adapter.state(request, @key).each do |k, v|\n instance_value = instance_variable_get(k)\n if permit_parameter?(initial_state[k], instance_value)\n parameters_changed << k\n adapter.wrap_write_async do\n adapter.set_state(request, controller, \"#{@key}_initial\", {k => instance_value})\n adapter.set_state(request, controller, @key, {k => instance_value})\n end\n else\n instance_variable_set(k, v)\n end\n end\n after_state_initialized(parameters_changed)\n end\n @state_initialized = true\n end",
"title": ""
}
] |
f74c29bdfc4a183e1ec1b91334cd5be2
|
Use callbacks to share common setup or constraints between actions.
|
[
{
"docid": "1308a9fdeb00aa36e1bb9bbbcb745aae",
"score": "0.0",
"text": "def set_serviceprovider\n @serviceprovider = Serviceprovider.find(params[:id])\n end",
"title": ""
}
] |
[
{
"docid": "631f4c5b12b423b76503e18a9a606ec3",
"score": "0.60326946",
"text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end",
"title": ""
},
{
"docid": "7b068b9055c4e7643d4910e8e694ecdc",
"score": "0.6015941",
"text": "def on_setup_callbacks; end",
"title": ""
},
{
"docid": "311e95e92009c313c8afd74317018994",
"score": "0.59229624",
"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.59169936",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "8315debee821f8bfc9718d31b654d2de",
"score": "0.59169936",
"text": "def initialize(*args)\n super\n @action = :setup\nend",
"title": ""
},
{
"docid": "bfea4d21895187a799525503ef403d16",
"score": "0.5899037",
"text": "def define_action_helpers\n super\n define_validation_hook if runs_validations_on_action?\n end",
"title": ""
},
{
"docid": "352de4abc4d2d9a1df203735ef5f0b86",
"score": "0.5889287",
"text": "def required_action\n # TODO: implement\n end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.58890367",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.58890367",
"text": "def actions; end",
"title": ""
},
{
"docid": "801bc998964ea17eb98ed4c3e067b1df",
"score": "0.58890367",
"text": "def actions; end",
"title": ""
},
{
"docid": "8713cb2364ff3f2018b0d52ab32dbf37",
"score": "0.5877498",
"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.5862599",
"text": "def actions\n\n end",
"title": ""
},
{
"docid": "930a930e57ae15f432a627a277647f2e",
"score": "0.5810375",
"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.5740072",
"text": "def setup\n common_setup\n end",
"title": ""
},
{
"docid": "a5ca4679d7b3eab70d3386a5dbaf27e1",
"score": "0.57316417",
"text": "def perform_setup\n end",
"title": ""
},
{
"docid": "ec7554018a9b404d942fc0a910ed95d9",
"score": "0.5718692",
"text": "def before_setup(&block)\n pre_setup_actions.unshift block\n end",
"title": ""
},
{
"docid": "9c186951c13b270d232086de9c19c45b",
"score": "0.5700777",
"text": "def callbacks; end",
"title": ""
},
{
"docid": "c85b0efcd2c46a181a229078d8efb4de",
"score": "0.5692726",
"text": "def custom_setup\n\n end",
"title": ""
},
{
"docid": "100180fa74cf156333d506496717f587",
"score": "0.5668117",
"text": "def do_setup\n\t\tget_validation\n\t\tprocess_options\n\tend",
"title": ""
},
{
"docid": "2198a9876a6ec535e7dcf0fd476b092f",
"score": "0.56531155",
"text": "def initial_action; end",
"title": ""
},
{
"docid": "b9b75a9e2eab9d7629c38782c0f3b40b",
"score": "0.565059",
"text": "def setup_intent; end",
"title": ""
},
{
"docid": "471d64903a08e207b57689c9fbae0cf9",
"score": "0.56384724",
"text": "def setup_controllers &proc\n @global_setup = proc\n self\n end",
"title": ""
},
{
"docid": "468d85305e6de5748477545f889925a7",
"score": "0.5625417",
"text": "def inner_action; end",
"title": ""
},
{
"docid": "bb445e7cc46faa4197184b08218d1c6d",
"score": "0.56102014",
"text": "def pre_action\n # Override this if necessary.\n end",
"title": ""
},
{
"docid": "432f1678bb85edabcf1f6d7150009703",
"score": "0.5596785",
"text": "def target_callbacks() = commands",
"title": ""
},
{
"docid": "48804b0fa534b64e7885b90cf11bff31",
"score": "0.5596253",
"text": "def execute_callbacks; end",
"title": ""
},
{
"docid": "5aab98e3f069a87e5ebe77b170eab5b9",
"score": "0.55899394",
"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.5557985",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "9efbca664902d80a451ef6cff0334fe2",
"score": "0.5557985",
"text": "def global_callbacks; end",
"title": ""
},
{
"docid": "482481e8cf2720193f1cdcf32ad1c31c",
"score": "0.55090857",
"text": "def required_keys(action)\n\n end",
"title": ""
},
{
"docid": "353fd7d7cf28caafe16d2234bfbd3d16",
"score": "0.55058104",
"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": "2f6ef0a1ebe74f4d79ef0fb81af59d40",
"score": "0.54677796",
"text": "def on_setup(&block); end",
"title": ""
},
{
"docid": "dcf95c552669536111d95309d8f4aafd",
"score": "0.5465028",
"text": "def layout_actions\n \n end",
"title": ""
},
{
"docid": "e3aadf41537d03bd18cf63a3653e05aa",
"score": "0.5448835",
"text": "def before(action)\n invoke_callbacks *options_for(action).before\n end",
"title": ""
},
{
"docid": "8ab2a5ea108f779c746016b6f4a7c4a8",
"score": "0.5447902",
"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": "6bd37bc223849096c6ea81aeb34c207e",
"score": "0.54402983",
"text": "def post_setup\n end",
"title": ""
},
{
"docid": "07fd9aded4aa07cbbba2a60fda726efe",
"score": "0.54168683",
"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.5411516",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.5411516",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "9358208395c0869021020ae39071eccd",
"score": "0.5400121",
"text": "def post_setup; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5395004",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "c5904f93614d08afa38cc3f05f0d2365",
"score": "0.5395004",
"text": "def before_setup; end",
"title": ""
},
{
"docid": "cb5bad618fb39e01c8ba64257531d610",
"score": "0.5392725",
"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": "a468b256a999961df3957e843fd9bdf4",
"score": "0.53884417",
"text": "def _setup\n setup_notification_categories\n setup_intelligent_segments\n end",
"title": ""
},
{
"docid": "f099a8475f369ce73a38d665b6ee6877",
"score": "0.53783494",
"text": "def action_run\n end",
"title": ""
},
{
"docid": "2c4e5a90aa8efaaa3ed953818a9b30d2",
"score": "0.53593004",
"text": "def execute(setup)\n @action.call(setup)\n end",
"title": ""
},
{
"docid": "118932433a8cfef23bb8a921745d6d37",
"score": "0.53494495",
"text": "def register_action(action); end",
"title": ""
},
{
"docid": "725216eb875e8fa116cd55eac7917421",
"score": "0.5349437",
"text": "def setup\n @controller.setup\n end",
"title": ""
},
{
"docid": "39c39d6fe940796aadbeaef0ce1c360b",
"score": "0.53471607",
"text": "def setup_phase; end",
"title": ""
},
{
"docid": "bd03e961c8be41f20d057972c496018c",
"score": "0.53441674",
"text": "def post_setup\n controller.each do |name,ctrl|\n ctrl.post_setup\n end\n end",
"title": ""
},
{
"docid": "c6352e6eaf17cda8c9d2763f0fbfd99d",
"score": "0.5342784",
"text": "def initial_action=(_arg0); end",
"title": ""
},
{
"docid": "207a668c9bce9906f5ec79b75b4d8ad7",
"score": "0.53281486",
"text": "def before_setup\n\n end",
"title": ""
},
{
"docid": "669ee5153c4dc8ee81ff32c4cefdd088",
"score": "0.53036916",
"text": "def ensure_before_and_after; end",
"title": ""
},
{
"docid": "c77ece7b01773fb7f9f9c0f1e8c70332",
"score": "0.528415",
"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.52831894",
"text": "def set_minimum_up_member_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"title": ""
},
{
"docid": "4ad1208a9b6d80ab0dd5dccf8157af63",
"score": "0.5258319",
"text": "def rails_controller_callbacks(&block)\n rails_controller_instance.run_callbacks(:process_action, &block)\n end",
"title": ""
},
{
"docid": "63a9fc1fb0dc1a7d76ebb63a61ed24d7",
"score": "0.5256983",
"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.52521855",
"text": "def pre_setup_actions\n @@pre_setup_actions ||= []\n end",
"title": ""
},
{
"docid": "8945e9135e140a6ae6db8d7c3490a645",
"score": "0.52472556",
"text": "def action_awareness\n if action_aware?\n if [email protected]?(:allow_nil)\n if @required\n @allow_nil = false\n else\n @allow_nil = true\n end\n end\n if as_action != \"create\"\n @required = false\n end\n end\n end",
"title": ""
},
{
"docid": "7b3954deb2995cf68646c7333c15087b",
"score": "0.52398384",
"text": "def after_setup\n end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52376497",
"text": "def action; end",
"title": ""
},
{
"docid": "e6d7c691bed78fb0eeb9647503f4a244",
"score": "0.52376497",
"text": "def action; end",
"title": ""
},
{
"docid": "1dddf3ac307b09142d0ad9ebc9c4dba9",
"score": "0.52329665",
"text": "def external_action\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "5772d1543808c2752c186db7ce2c2ad5",
"score": "0.5229699",
"text": "def actions(state:)\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "6350959a62aa797b89a21eacb3200e75",
"score": "0.5225785",
"text": "def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"title": ""
},
{
"docid": "64a6d16e05dd7087024d5170f58dfeae",
"score": "0.52239066",
"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": "db0cb7d7727f626ba2dca5bc72cea5a6",
"score": "0.5219224",
"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": "7bbfb366d2ee170c855b1d0141bfc2a3",
"score": "0.52147436",
"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": "8d7ed2ff3920c2016c75f4f9d8b5a870",
"score": "0.52146924",
"text": "def pick_action; end",
"title": ""
},
{
"docid": "78ecc6a2dfbf08166a7a1360bc9c35ef",
"score": "0.5211636",
"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.52089876",
"text": "def ac_action(&blk)\n @action = blk\n end",
"title": ""
},
{
"docid": "4c23552739b40c7886414af61210d31c",
"score": "0.5206151",
"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": "6a98e12d6f15af80f63556fcdd01e472",
"score": "0.5204869",
"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.520361",
"text": "def create_setup\n \n end",
"title": ""
},
{
"docid": "691d5a5bcefbef8c08db61094691627c",
"score": "0.5201687",
"text": "def performed(action)\n end",
"title": ""
},
{
"docid": "ad33138fb4bd42d9785a8f84821bfd88",
"score": "0.5198511",
"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.5198511",
"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.51926094",
"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.5181837",
"text": "def setup(instance)\n action(:setup, instance)\n end",
"title": ""
},
{
"docid": "9f1f73ee40d23f6b808bb3fbbf6af931",
"score": "0.5178642",
"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.5173357",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.5173357",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "b4f4e1d4dfd31919ab39aecccb9db1d0",
"score": "0.5173357",
"text": "def setup(resources) ; end",
"title": ""
},
{
"docid": "7a0c9d839516dc9d0014e160b6e625a8",
"score": "0.51642865",
"text": "def setup(request)\n end",
"title": ""
},
{
"docid": "e441ee807f2820bf3655ff2b7cf397fc",
"score": "0.5153578",
"text": "def after_setup; end",
"title": ""
},
{
"docid": "1d375c9be726f822b2eb9e2a652f91f6",
"score": "0.51448536",
"text": "def before *actions, &proc\n actions = ['*'] if actions.size == 0\n actions.each { |a| @callbacks[:a][a] = proc }\n end",
"title": ""
},
{
"docid": "faddd70d9fef5c9cd1f0d4e673e408b9",
"score": "0.5142863",
"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": "c594a0d7b6ae00511d223b0533636c9c",
"score": "0.51412",
"text": "def code_action_provider; end",
"title": ""
},
{
"docid": "2fcff037e3c18a5eb8d964f8f0a62ebe",
"score": "0.5139861",
"text": "def setup(params)\n end",
"title": ""
},
{
"docid": "111fd47abd953b35a427ff0b098a800a",
"score": "0.5134318",
"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.51167125",
"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.5115634",
"text": "def setup\n transition_to(:setup)\n end",
"title": ""
},
{
"docid": "4c7a1503a86fb26f1e4b4111925949a2",
"score": "0.51111007",
"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": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5109693",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5109693",
"text": "def action\n end",
"title": ""
},
{
"docid": "975ecc8d218b62d480bbe0f6e46e72bb",
"score": "0.5109693",
"text": "def action\n end",
"title": ""
},
{
"docid": "63849e121dcfb8a1b963f040d0fe3c28",
"score": "0.5106379",
"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.510497",
"text": "def block_actions options ; end",
"title": ""
},
{
"docid": "0d1c87e5cf08313c959963934383f5ae",
"score": "0.51013684",
"text": "def on_action(action)\n @action = action\n self\n end",
"title": ""
},
{
"docid": "916d3c71d3a5db831a5910448835ad82",
"score": "0.5096925",
"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": "35b302dd857a031b95bc0072e3daa707",
"score": "0.5093146",
"text": "def config(action, *args); end",
"title": ""
}
] |
b9f425e8c69559150792c51a6b8d90c5
|
if the key is present, return func(key), else default
|
[
{
"docid": "d9704350b1a69a3df5954146deab0cde",
"score": "0.7535849",
"text": "def get_arg_func(key, func, default) \n if (@args == nil) \n return default\n elsif @args[0].instance_of? Hash\n if @args[0][key]\n return func.call(@args[0][key])\n else\n return default\n end\n else \n return default\n end\n end",
"title": ""
}
] |
[
{
"docid": "63bffd5393a260d3974acc425f913757",
"score": "0.7376692",
"text": "def default(key) end",
"title": ""
},
{
"docid": "d395347ecf552fc34390e0750ff11702",
"score": "0.68715024",
"text": "def get_with_default(hash, key, default)\n hash.key?(key) ? hash[key] : default\n end",
"title": ""
},
{
"docid": "6a442c2056a35ee4886ec8bbab25c36a",
"score": "0.67637426",
"text": "def get(key, default=nil)\n\t\t\tval = self.send(key)\n\t\t\tval || default\n\t\tend",
"title": ""
},
{
"docid": "8746743e0f1472c262ecda0619d96bec",
"score": "0.6663355",
"text": "def fetch_or_default(key, &block)\n @hash[key] = @hash.fetch(key, &block)\n end",
"title": ""
},
{
"docid": "d9ee3c54544b52326bc6ab340cd2e68f",
"score": "0.66113496",
"text": "def default(key = nil) \n if key.is_a?(Symbol) && key?(key) \n self[key] \n else \n key ? super : super()\n end \n end",
"title": ""
},
{
"docid": "0b75472dc7541eaea8f797f16ca6697e",
"score": "0.6611002",
"text": "def default(key = nil)\n @default_proc ? @default_proc.call(tree, key) : @default\n end",
"title": ""
},
{
"docid": "00356654fb425cf035cbe95e53c9d60e",
"score": "0.6590161",
"text": "def get(key, default = nil)\n include?(key) ? @data[key.to_sym] : default\n end",
"title": ""
},
{
"docid": "ec04eaa0ff3a71a77b0c062d04b2a853",
"score": "0.6559939",
"text": "def get(key_or_constant = nil)\n if key_or_constant\n if key_or_constant.is_a?(Symbol)\n timing_functions[key_or_constant] || timing_functions[:default]\n else\n CAMediaTimingFunction.functionWithName(key_or_constant)\n end\n else\n timing_functions[:default]\n end\n end",
"title": ""
},
{
"docid": "24ffbfaabfff03f22975430b07af57f7",
"score": "0.64786327",
"text": "def fetch(key, *default)\n result =\n if key?(key)\n self[key]\n elsif block_given?\n yield(self)\n end\n unless result\n raise KeyError, \"key not found \\\"#{key}\\\"\" if default.empty?\n result = default.first\n end\n result\n end",
"title": ""
},
{
"docid": "170d819d0fc4d6f912c5d72db54c47ae",
"score": "0.6470039",
"text": "def [](key)\n result = default(key)\n result ? result.value : nil\n end",
"title": ""
},
{
"docid": "08edd51dabb63d43d1f16766bd26c102",
"score": "0.6377021",
"text": "def cached_lookup(key, default, &block)\n if cache_has_key(key)\n retval = cached_value(key)\n else\n retval = yield key, default\n cache(key, retval)\n end\n retval\nend",
"title": ""
},
{
"docid": "ab9c59b59d1aac9277421c63f452847d",
"score": "0.6350466",
"text": "def default_or_inferred_for(key_name)\n @defaults[key_name] || send(\"default_value_for_#{key_name}\") || \\\n raise(\"No default value for: #{key_name}\")\n end",
"title": ""
},
{
"docid": "d5ba4d02c4b9f46d21213b9e60576938",
"score": "0.6305499",
"text": "def default(key = nil)\n if key.is_a?(Symbol) && include?(key = key.to_s)\n self[key]\n else\n super\n end\n end",
"title": ""
},
{
"docid": "bebce7a5ac5e84db0c60aa1812ebd73a",
"score": "0.62716687",
"text": "def [](key)\n self.get(key) || default.get(key)\n end",
"title": ""
},
{
"docid": "787173181b469203263cdec8b18341c2",
"score": "0.6187489",
"text": "def get(key, default=nil, &block)\n value = options[key]\n value = default if value.nil?\n value = block.call if value.nil? && block\n return value\n end",
"title": ""
},
{
"docid": "078f6e81c38f8a3d9e905458b0511ae1",
"score": "0.6182732",
"text": "def config_or_default(config,key,default)\n (config && config[key] ? config[key] : default)\n end",
"title": ""
},
{
"docid": "afb278c1f00294eea86f1da317efe29e",
"score": "0.6138042",
"text": "def or_default( key, defaultValue )\n raise \"key must be a Symbol or String\" unless key.is_a?( Symbol ) || key.is_a?( String )\n\n if self.of(@section).has_key?( key ) # ToDo: Nicer: create Conf::has_key?\n res = self[key]\n else\n self[key]= defaultValue\n res = defaultValue\n self.save ## if @instant_save # 2009-06-11\n end\n\n res\n end",
"title": ""
},
{
"docid": "63f2652d04ec1a5b35c96b31151d091b",
"score": "0.6118418",
"text": "def [](key)\n hash = to_h\n if hash.has_key?(key)\n hash[key]\n else\n default(key)\n end\n end",
"title": ""
},
{
"docid": "3cea532974b4cfada8532c988527fcdd",
"score": "0.61106926",
"text": "def default key\n @defaults[String(key).to_sym]\n end",
"title": ""
},
{
"docid": "10bf3453cac7dc48807c7dcc220f2da3",
"score": "0.6057545",
"text": "def param_or_default(key)\n return params[key] unless params[key].nil?\n if (alt_key = alternative_key(key)) && params[alt_key]\n return params[alt_key]\n end\n\n user_params_model[key].default_value\n end",
"title": ""
},
{
"docid": "759b969506685ac663b96f097af7d940",
"score": "0.6019106",
"text": "def get(key, default=nil)\n raise(ArgumentError, \"Argument 'key' must be a String or Symbol.\") unless key.is_a?(String) || key.is_a?(Symbol)\n # Alternative ways can be implemented here. (reading individual registry keys etc.)\n key = key.to_sym unless key.is_a?(Symbol)\n return (@options.include?(key)) ? @options[key] : default\nend",
"title": ""
},
{
"docid": "2dbafa0f4c75d4689657f8bcb2da6f23",
"score": "0.6002902",
"text": "def get_key(key, default: nil, error: false)\n if(has_key?(key))\n return self[key]\n end\n \n raise ArgumentError.new(\"Value #{key} not found.\") unless !error\n return default\n end",
"title": ""
},
{
"docid": "9c784426d00bae7e0e107e2c61681c5f",
"score": "0.59925866",
"text": "def value_for(key, params, default_value = nil)\n params.values_at(key, key.to_sym, underscore(key), underscore(key).to_sym).compact.first || default_value\n end",
"title": ""
},
{
"docid": "c0239b6e08f0e1aa0f895d5de2821888",
"score": "0.5963328",
"text": "def get(key, default=nil)\n find = KeyValue.find_by_key(key)\n find ? find.value : default\n end",
"title": ""
},
{
"docid": "5598fec652fe9be037c77465211ec300",
"score": "0.5936631",
"text": "def call_if_exists(obj, method, default_value = true)\n if obj.respond_to?(method)\n return obj.send(method)\n else\n return default_value\n end\n end",
"title": ""
},
{
"docid": "a8ec316d930cf97fd62db57e75fecf69",
"score": "0.5911127",
"text": "def hash_default(hash, key, def_val)\r\n hash[key] = hash.key?(key) ? hash[key] : def_val\r\n end",
"title": ""
},
{
"docid": "80d42b1533466ee7f1d8bc48357dfc78",
"score": "0.59055465",
"text": "def lookup_method_to_call( default_value=nil )\n @_method ||= nil\n @_method.nil? ? default_value.to_s : @_method\n end",
"title": ""
},
{
"docid": "8bd7df4e8e15e610419cf13100fcd894",
"score": "0.58974886",
"text": "def method_missing(key, *args, &block)\n if key.to_s =~ /\\A(.+)=\\z/\n self[$1] = args.first\n return args.first\n end\n if key.to_s =~ /\\A(.+)\\?\\z/\n return !!self[$1]\n end\n return self[key] if has_key?(key)\n nil\n end",
"title": ""
},
{
"docid": "805a168a234698386e42199576c27af9",
"score": "0.5836869",
"text": "def get!(key, default=nil, &block)\n value = get key, default, &block\n raise \"Nil value found for option: #{key}, #{default}\" if value.nil?\n return value\n end",
"title": ""
},
{
"docid": "4b8abe7b457de743e057898db6013e31",
"score": "0.58359015",
"text": "def with_default(default, key)\n assert_explanation(key)\n configured?(key) ? self[key] : default\n end",
"title": ""
},
{
"docid": "95570a68d8bc727483d2ae912288a857",
"score": "0.581602",
"text": "def default? key\n @defaults.key? String(key).to_sym\n end",
"title": ""
},
{
"docid": "2eef9c1db7c2b84f82de9be759650236",
"score": "0.58117294",
"text": "def [](key)\n return @@functions[key]\n end",
"title": ""
},
{
"docid": "63253bf9c24ec3803d420c34b91307e6",
"score": "0.5804378",
"text": "def default(key)\n @defaults[key]\n end",
"title": ""
},
{
"docid": "ec6e243faff250feeba033e58eed7574",
"score": "0.5804103",
"text": "def get key; call key; end",
"title": ""
},
{
"docid": "79f38ab570b3c29ad5a54a6f760c7d04",
"score": "0.5796771",
"text": "def make_getter( key )\n\t\treturn Proc.new { self.namespaced_hash[key.to_sym] }\n\tend",
"title": ""
},
{
"docid": "8144138afbc6c204832b94100fb3778a",
"score": "0.5784559",
"text": "def method_missing(sym, *args, &block)\n if key?(sym)\n self[sym]\n elsif sym.to_s[-1..-1] == \"?\"\n key? sym.to_s[0..-2].to_sym\n else\n super sym, *args, &block\n end\n end",
"title": ""
},
{
"docid": "175c7de161169babd8631e00997255ba",
"score": "0.57822096",
"text": "def fetch_if(key_or_proc, key, &block)\n if get(key)\n key_or_proc = key_or_proc.call if key_or_proc.is_a?(Proc)\n value = fetch(key_or_proc, &block)\n else\n value = block.call\n key_or_proc = key_or_proc.call if key_or_proc.is_a?(Proc)\n set(key_or_proc, Marshal.dump(value))\n end\n value\n end",
"title": ""
},
{
"docid": "763740f33da8d1fcea720095b4e3bc08",
"score": "0.5710467",
"text": "def test_Hash_InstanceMethods_default_proc=\n\t\th = { 'a'=>100, 'b'=>200 }\n\t\th.default = \"Go fish\"\n\t\tassert_equal(100, h['a'])\n\t\tassert_equal(\"Go fish\", h[\"z\"])\n\n\t\th.default_proc = lambda { |hash, key| hash[key]=key+key }\n\t\tassert_equal(4, h[2])\n\t\tassert_equal(\"catcat\", h[\"cat\"])\n\tend",
"title": ""
},
{
"docid": "544e67e3edf0477676d9ec84ae695113",
"score": "0.57102877",
"text": "def option_or_default(key, default)\n options? ? options.fetch(key, default) : default\n end",
"title": ""
},
{
"docid": "a068bf42cafed807eae50db3d568d381",
"score": "0.56856483",
"text": "def get_value(item, key, default: nil, **)\n return if key.blank?\n if key.is_a?(Array)\n key.find { |k| (v = get_value(item, k)) and break v }\n elsif item.respond_to?(key)\n item.send(key)\n elsif item.respond_to?(:emma_metadata) # Upload, etc.\n item.emma_metadata&.dig(key.to_sym)\n elsif item.is_a?(Hash)\n item[key.to_sym] || item[key.to_s]\n end.presence || default\n end",
"title": ""
},
{
"docid": "a3125e92d390f9639ee941da77a3765f",
"score": "0.5677889",
"text": "def get(key); end",
"title": ""
},
{
"docid": "a3125e92d390f9639ee941da77a3765f",
"score": "0.5677889",
"text": "def get(key); end",
"title": ""
},
{
"docid": "a3125e92d390f9639ee941da77a3765f",
"score": "0.5677889",
"text": "def get(key); end",
"title": ""
},
{
"docid": "a3125e92d390f9639ee941da77a3765f",
"score": "0.5677889",
"text": "def get(key); end",
"title": ""
},
{
"docid": "3983f70f42535d7f7f87271b974bcdc2",
"score": "0.5661325",
"text": "def [](key)\n return nil unless key\n @data[key.to_s] || @data[key.to_sym]\n end",
"title": ""
},
{
"docid": "058367ac0a285bd68ac1fb406f19af25",
"score": "0.5620668",
"text": "def get_function(type, name, function)\n func = function\n\n unless function\n func = case type\n when :key then \"(#{Misc::DOCUMENT_OFFSET}#{name} || #{Misc::ID_OFFSET}#{name})\"\n #when :value then \"(#{Misc::DOCUMENT_OFFSET}#{name} || #{name})\"\n when :value then \"(typeof #{name} != 'undefined' ? #{name} : #{Misc::DOCUMENT_OFFSET}#{name})\"\n end\n end\n\n return func\n end",
"title": ""
},
{
"docid": "f183c868877a0d5fb8b96cf6a6ef6266",
"score": "0.560052",
"text": "def key(name, fallback = Undefined, &block)\n if Undefined.equal?(fallback)\n name_key_map.fetch(name, &block)\n else\n name_key_map.fetch(name, fallback)\n end\n end",
"title": ""
},
{
"docid": "c22dbbefb51230f0793970f2b4c2276c",
"score": "0.5590454",
"text": "def key_for_name(name, default = true)\n name = name.to_s.strip\n result =\n case name\n when KEY_PATH_HINT\n name.underscore\n .sub(%r{^.*/([^/]+)$}, '\\1') # \"devise/catalog\" -> \"catalog\"\n .sub(/^config/, '') # \"config_video\" -> \"_video\"\n .sub(/^[:_]*/, '') # \"_catalog\" -> \"catalog\"\n .sub(/^([^:_]+).*$/, '\\1') # \"music_suggest_controller\" -> \"music\"\n .sub(/^article$/, '\\0s') # \"article\" -> \"articles\"\n .to_sym\n when DOC_ID_HINT\n key_for_doc(name, false)\n end\n if valid_key?(result)\n result\n elsif default.is_a?(TrueClass)\n default_key\n elsif !default.is_a?(FalseClass)\n default\n end\n end",
"title": ""
},
{
"docid": "7b641d98c2b6f1987e76386bcf3a1335",
"score": "0.55877364",
"text": "def get_function(key, options = { bubble_up?: true })\n return @parent.get_function(key, options) unless holds_data?\n\n function = @functions[key] || (options[:bubble_up?] ? @parent&.get_function(key) : nil)\n\n # return a duplicate to avoid polluting parent scopes during recursion\n function&.dup\n end",
"title": ""
},
{
"docid": "21ca88e2c9e4572a69335f2580e8bbe6",
"score": "0.5582582",
"text": "def [](key)\n send(\"#{key}\") rescue nil\n end",
"title": ""
},
{
"docid": "694186a9b601a96be44568bff0e80369",
"score": "0.5577468",
"text": "def lookup_or_default(arg)\n instance = detect { |property| property.name.to_sym == arg.to_sym }\n instance ||= new(:value => default(arg))\n end",
"title": ""
},
{
"docid": "885380beee95876bdb979c58bdfde637",
"score": "0.5567802",
"text": "def get(key)\n return nil unless @items.key?(key)\n @items[key].call\n end",
"title": ""
},
{
"docid": "c591e2ade7861792402d33446fd4fb00",
"score": "0.55642235",
"text": "def method_missing(*args)\n default\n end",
"title": ""
},
{
"docid": "fd2bedca3d9d6872d659a8af5842e99a",
"score": "0.556041",
"text": "def default_if_not_specified(opt,default_opt)\n opt ? opt : default_opt\nend",
"title": ""
},
{
"docid": "b2699fd2f0811da06ba0788f35e3aa14",
"score": "0.5542412",
"text": "def fetch(key, default = :_fetch_default_, &block)\n if Dottie.dottie_key?(key)\n if default != :_fetch_default_\n Dottie.fetch(wrapped_object_or_self, key, default, &block)\n else\n Dottie.fetch(wrapped_object_or_self, key, &block)\n end\n else\n if default != :_fetch_default_\n wrapped_object_or_self.fetch(key, default, &block)\n else\n wrapped_object_or_self.fetch(key, &block)\n end\n end\n end",
"title": ""
},
{
"docid": "ad8453c6a52a0b6d968b725a70df27f9",
"score": "0.5528071",
"text": "def callback_method(key) #:nodoc:\r\n data_key = key.gsub('_', '-') # convert _ to -\r\n callback = case\r\n when params['data'] && params['data'][data_key] then params['data'][data_key]\r\n # dc_ + key method is present then call it automatically\r\n when @form.dig('permissions', key) then @form['permissions'][key]\r\n when respond_to?('dc_' + key) then 'dc_' + key\r\n when respond_to?(key) then key\r\n when params[data_key] then params[data_key]\r\n else nil\r\n end\r\n\r\n ret = case\r\n when callback.nil? then callback # otherwise there will be errors in next lines\r\n when callback.match('eval ') then callback.sub('eval ','')\r\n when callback.match('return_to ')\r\n params[:return_to] = callback.sub('return_to ','')\r\n return nil\r\n else callback\r\n end\r\n ret\r\nend",
"title": ""
},
{
"docid": "dc0b2c629945f4168cc8f091a2f2eeda",
"score": "0.55186355",
"text": "def method_missing(mid, *args)\n if mid.to_s =~ /(.+)\\?$/\n return $1 == self.key.to_s\n else\n super\n end\n end",
"title": ""
},
{
"docid": "e1d3d9beef450419f8ce62d10c4f9081",
"score": "0.5507184",
"text": "def fetch key, deft=nil\n @map.fetch(key, deft)\n end",
"title": ""
},
{
"docid": "fa67c147850efb9328b55f0c91c30669",
"score": "0.5502909",
"text": "def get_key(key)\n return self.has_key?(key) ? self[key] : nil\n end",
"title": ""
},
{
"docid": "73e804beebeb78eae50ec609137ad70e",
"score": "0.5496942",
"text": "def method_missing(method, *args) # {{{\n return @data[method.to_sym] if @data[method.to_sym]\n end",
"title": ""
},
{
"docid": "20efd76449af09d3aa3a265b1ca42683",
"score": "0.54966205",
"text": "def [](key)\n super(key) or super(alternate_key(key))\n end",
"title": ""
},
{
"docid": "11f901cee411270c6501a155c4cd4067",
"score": "0.5492607",
"text": "def method_missing(key)\n @data.key?(key.to_s) ? @data[key.to_s] : super\n end",
"title": ""
},
{
"docid": "c18e388891d24b1d35a86e6fa6ee1acc",
"score": "0.54855144",
"text": "def _default_config_method(config_key, *args)\n if args.length.positive?\n # Set the value\n @settings[config_key].value = args[0]\n else\n # Get the value\n setting = @settings[config_key]\n if setting.default_proc && setting.value.nil?\n setting.value = setting.default_proc.call\n end\n setting.value\n end\n end",
"title": ""
},
{
"docid": "7962e6b1e57293bf8bf1e75e70e40009",
"score": "0.5478144",
"text": "def [](key, default=nil)\n attributes.has_key?(key) ? attributes[key] : default\n end",
"title": ""
},
{
"docid": "93732fd1881a036c93f6e1d0f45577b8",
"score": "0.54736155",
"text": "def method_missing(method, *args, &block)\n if has_key?(method)\n self[method]\n else\n begin\n super\n rescue NoMethodError => e\n raise NoKey, method.to_s\n end\n end\n end",
"title": ""
},
{
"docid": "64c095ccc6fb96b4720f959ba4a9483e",
"score": "0.54676414",
"text": "def get(key, default=nil)\n rv = nil\n\n [*key].each do |k|\n # Lets check for this key\n rv = @config.get(k.to_s)\n break unless rv.nil?\n\n # If it doesn't exist, check with env\n rv = @config.get(KnoxBoxWeb::Application.environment.to_s << '.' << k.to_s)\n break unless rv.nil?\n end\n\n return default if rv.nil?\n return rv\n end",
"title": ""
},
{
"docid": "0496fcaee01a096c0c9ebe741d5c05d5",
"score": "0.54492635",
"text": "def get_attribute(dict_name, key, default_value = nil)\n end",
"title": ""
},
{
"docid": "b80e652b00d7095bdf4673a1983dc9a4",
"score": "0.54442436",
"text": "def fetch(key, optional = {} )\n\n # self[key]\n if self.has_key?(key)\n self[key]\n else\n if optional.empty?\n raise KeyError\n else\n optional\n end\n end\n end",
"title": ""
},
{
"docid": "95f5e1319b0e78f785631ae441ea3be4",
"score": "0.5440241",
"text": "def [](key)\n ruby_get(key&&key.to_s)\n end",
"title": ""
},
{
"docid": "3b955a0ea006aa1ce30171a152bb6eb3",
"score": "0.5438571",
"text": "def test_Hash_InstanceMethods_default=\n\t\th = {'a'=>100, 'b'=>200}\n\t\th.default = \"Go fish\"\n\t\tassert_equal(100, h['a'])\n\t\tassert_equal(\"Go fish\", h[\"z\"])\n\n\t\t# This doesn't do what you might hope... (but see default_proc=)\n\t\th.default = lambda { |hash, key| hash[key] = key + key }\n\tend",
"title": ""
},
{
"docid": "11aa24a4ee4a856b97ee743d37231090",
"score": "0.54282445",
"text": "def method_missing(m, *args, &block)\n if has? m.to_s\n get(m.to_s)\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "12abe796d41d2b0a8532803e556a2eeb",
"score": "0.5427776",
"text": "def get(key)\n end",
"title": ""
},
{
"docid": "69f353b0ebdd59bc4117264fc327695f",
"score": "0.5419879",
"text": "def lookup(key, default = nil, scope = self.scope, *rest)\n super(key.to_s, default, scope, *rest)\n end",
"title": ""
},
{
"docid": "2f01a951598608cabf1e9ded1652f9af",
"score": "0.54172176",
"text": "def defines_default?(key)\n @defaults.key?(key)\n end",
"title": ""
},
{
"docid": "c2700a324a6975cd6350f42408b2c7d3",
"score": "0.54156226",
"text": "def cache_fetch(key, default = nil)\n value = @store[key]\n value.nil? ? default : value\n rescue ::MemCache::MemCacheError => e\n Log.error(e)\n nil\n end",
"title": ""
},
{
"docid": "c2030728eff46f76bc0e740aca2d0807",
"score": "0.54052484",
"text": "def get_option(options, key, default_value = \"\")\n result = options.has_key?(key) ? options[key] : nil\n result = default_value if result.nil? || result == \"\"\n result \n end",
"title": ""
},
{
"docid": "bf407a3eb3b7ad3b24aa2a82fab8cef2",
"score": "0.5402781",
"text": "def get(key, default = nil)\n return default unless servers?\n if key.kind_of? Array\n @cache.get_multi(key_in_ns(key))\n else\n @cache.get(key_in_ns(key)) || default \n end\n end",
"title": ""
},
{
"docid": "56f9e5f85fbfb164fe8465cee338d30a",
"score": "0.53874165",
"text": "def _fetch(key, options = {})\n value = params.key?(key) ? params[key] : options[:default]\n options[:required] ? _ensure(value, options) : value\n end",
"title": ""
},
{
"docid": "fdc06bdb17de3c2c98f432188a30f23c",
"score": "0.538524",
"text": "def fetch(*args)\n fail ArgumentError, \"Expected 1-2 arguments, got #{args.length}\" \\\n unless (1..2).cover?(args.length)\n\n key, default = args\n\n all(key) do |value|\n return value\n end\n\n if block_given?\n yield key\n elsif default\n default\n else\n fail KeyError, \"key not found: #{key.inspect}\"\n end\n end",
"title": ""
},
{
"docid": "9cce7c2427727da2f398131296cb0420",
"score": "0.5371857",
"text": "def [](key)\n\t\t\t\treturn(lookup(key))\n\t\t\tend",
"title": ""
},
{
"docid": "9cce7c2427727da2f398131296cb0420",
"score": "0.5371857",
"text": "def [](key)\n\t\t\t\treturn(lookup(key))\n\t\t\tend",
"title": ""
},
{
"docid": "22321f6cf1427729e9ff5e09eb960da1",
"score": "0.53666",
"text": "def method_missing sym, key=nil\n get if data.empty?\n\n sym,key = sym.to_s,key.to_s\n\n if data.has_key?(sym)\n \n return data[sym] if key.empty?\n \n if data[sym].is_a?(Hash) && data[sym].has_key?(key)\n return data[sym][key]\n else\n return nil\n end\n else\n super sym.to_sym, key\n end \n end",
"title": ""
},
{
"docid": "058535e04704d5e18a0cdefc2ae79b20",
"score": "0.53596675",
"text": "def get_property(key, default_value = nil)\n end",
"title": ""
},
{
"docid": "c2d274a2bbb6c577807891724f11c7b7",
"score": "0.53574395",
"text": "def method_missing(method, *args)\n if defines_default?(method) && args.empty?\n self[method]\n elsif method.to_s =~ /^(\\w+)=$/ && args.size == 1\n self[Regexp.last_match(1).to_sym] = args[0]\n else\n super\n end\n end",
"title": ""
},
{
"docid": "3e277e1ac65d0ce762c38e3cef176494",
"score": "0.53516984",
"text": "def fetch(key, default = nil)\n return default unless entry = @cache[\"#{@cache_name}:#{key}\"]\n return entry[:value] if entry[:expires].nil? || entry[:expires] > Time.now\n @cache.delete(\"#{@cache_name}:#{key}\")\n default\n end",
"title": ""
},
{
"docid": "67b35348fed5a376bc91dddaa32933f0",
"score": "0.5349323",
"text": "def fetch_or_store(namespaces, key, default_value = nil)\n provided_value = block_given? ? yield(key) : default_value\n\n # We first check in the `@fast_lookup` store to see if we have already see that metrics before,\n # This give us a `o(1)` access, which is faster than searching through the structured\n # data store (Which is a `o(n)` operation where `n` is the number of element in the namespace and\n # the value of the key). If the metric is already present in the `@fast_lookup`, the call to\n # `#put_if_absent` will return the value. This value is send back directly to the caller.\n #\n # BUT. If the value is not present in the `@fast_lookup` the value will be inserted and\n # `#puf_if_absent` will return nil. With this returned value of nil we assume that we don't\n # have it in the `@metric_store` for structured search so we add it there too.\n if found_value = @fast_lookup.put_if_absent(namespaces.dup << key, provided_value)\n return found_value\n else\n @structured_lookup_mutex.synchronize do\n # If we cannot find the value this mean we need to save it in the store.\n fetch_or_store_namespaces(namespaces).fetch_or_store(key, provided_value)\n end\n return provided_value\n end\n end",
"title": ""
},
{
"docid": "e9aa6c4c0157993e61b3d5fb42757548",
"score": "0.5348328",
"text": "def [](key)\n begin\n rv = self.fetch(key)\n rescue IndexError\n rv = nil\n end\n if (rv == nil)\n begin\n rv = self.dcase_hash[key.downcase]\n rescue IndexError\n rv = nil\n end\n end\n\n return rv\n end",
"title": ""
},
{
"docid": "77bb94053a202f74c0c61eea435e952c",
"score": "0.5342368",
"text": "def default_proc() end",
"title": ""
},
{
"docid": "3dcd02a7c32c10c4cd6b3eea1e54ebd7",
"score": "0.5334958",
"text": "def get(key)\n end",
"title": ""
},
{
"docid": "97c5505d0732b4ad195f1036fa644fa3",
"score": "0.53344077",
"text": "def get_data key, default = nil\n init_data\n\n Bot::DB[my_name][key] or default\n end",
"title": ""
},
{
"docid": "8f2fee12fbbd8299d3cdb6220399c491",
"score": "0.5334298",
"text": "def key?(*) end",
"title": ""
},
{
"docid": "1ce990391b2384025ef7fa05f26df794",
"score": "0.5331364",
"text": "def method_missing(m)\n key = m.to_s\n return self[key] if self.has_key? key\n super\n end",
"title": ""
},
{
"docid": "47797d37f2b268bfc30dd0083a12c92c",
"score": "0.53305644",
"text": "def find_helper(node, key)\n if node.nil?\n return nil\n elsif node.key == key\n return node.value\n elsif key < node.key\n return find_helper(node.left, key)\n elsif key > node.key\n return find_helper(node.right, key)\n end\nend",
"title": ""
},
{
"docid": "959542ea8911523477351823f1c2d318",
"score": "0.5329485",
"text": "def generic_get(key)\n data[key]\n end",
"title": ""
},
{
"docid": "9d40a5a8376dc0e2fb665728070e1e24",
"score": "0.53288996",
"text": "def value_by_key(hash, key)\n hash[key.to_s] || hash[key.to_sym]\n end",
"title": ""
},
{
"docid": "9c1604333d8287533d53fef14fac8994",
"score": "0.5327578",
"text": "def [](key)\n table[key] || table[String === key ? key.to_sym : key.to_s]\n end",
"title": ""
},
{
"docid": "39f9133591a4018f45c8a3500db86398",
"score": "0.5325245",
"text": "def from_setting_or_image_info(key, val=nil, default=nil)\n @settings[key] = val unless val.nil?\n return @settings[key] if @settings.include?(key)\n return image_info[key] unless image_info.nil?\n return default # otherwise\n end",
"title": ""
},
{
"docid": "4cc5c933fef6afe9caa0f5d332aaea76",
"score": "0.5319455",
"text": "def [](key)\n if self.class.key_transformer\n @hash[self.class.key_transformer.call(key)]\n else\n @hash[key]\n end\n end",
"title": ""
},
{
"docid": "042020d5308cf9dedfb3e2232f624479",
"score": "0.53190756",
"text": "def cache_fetch(key, default = nil)\n # Retrieve the data and return it\n record = @store[:key => namespaced(key)]\n record.value rescue default\n end",
"title": ""
},
{
"docid": "b1f0d7871d7b0d8e43da11586bfb4c37",
"score": "0.5317942",
"text": "def read(key, default=nil)\n document = @dao.collection.find_one(selector(key))\n if !document.nil?\n document['v']\n else\n default\n end\n end",
"title": ""
}
] |
fdbe101b82dda9ca5391ea21c29191d6
|
I worked on this challenge with William Pangestu. 1. Solution Write your comments on what each thing is doing. If you have difficulty, go into IRB and play with the methods.
|
[
{
"docid": "5b19b3252b545521165c724afc854479",
"score": "0.0",
"text": "def north_korean_cipher(coded_message) # Creating the method with a string as parameter.\n input = coded_message.downcase.split(\"\") # Takes inputted string and downcases all letters and splits each element into an array.\n decoded_sentence = [] # Creating an empty array.\n cipher = {\"e\" => \"a\", # This is technically a shift of four letters...Can you think of a way to automate this? Is a hash\n \"f\" => \"b\", # The best data structure for this problem? What are the pros and cons of hashes?\n \"g\" => \"c\", \n \"h\" => \"d\", # alphabet = (\"a\"..\"z\").to_a can be used to create an array rather than a hash. You could then iterate\n \"i\" => \"e\", \n \"j\" => \"f\", \n \"k\" => \"g\", # One pro of the hash is easily understood. i.e., \"e\" shifts to \"a\"\n \"l\" => \"h\", # A con is the size with 26 different keys and hard coded.\n \"m\" => \"i\",\n \"n\" => \"j\",\n \"o\" => \"k\",\n \"p\" => \"l\",\n \"q\" => \"m\",\n \"r\" => \"n\",\n \"s\" => \"o\",\n \"t\" => \"p\",\n \"u\" => \"q\",\n \"v\" => \"r\",\n \"w\" => \"s\",\n \"x\" => \"t\",\n \"y\" => \"u\",\n \"z\" => \"v\",\n \"a\" => \"w\",\n \"b\" => \"x\",\n \"c\" => \"y\",\n \"d\" => \"z\"}\n \n input.each do |x| # Iterating over each element of the input array.\n found_match = false # This is establishing that none of the input elements have been evaluated.\n cipher.each_key do |y| # This loops through the cipher hash keys.\n if x == y # Comparing each character from input array to the cipher key. x = element of input, y = hash key\n puts \"I am comparing x and y. X is #{x} and Y is #{y}.\" # Outputting a string identifying what was matched.\n decoded_sentence << cipher[y] # Pushed the cipher value to empty array.\n found_match = true # This is establishing that this particular element has now been evaluated.\n break # Exiting out of the cipher loop.\n elsif x == \"@\" || x == \"#\" || x == \"$\" || x == \"%\"|| x == \"^\" || x == \"&\"|| x ==\"*\" # Checking if the input element is a special character.\n decoded_sentence << \" \" # If it is, it pushes a space into the new array.\n found_match = true # This is establishing that this particular element has now been evaluated.\n break #Exiting out of the cipher loop.\n elsif (0..9).to_a.include?(x) # Checking if the input element is a number\n decoded_sentence << x #Keeps the number and pushes it into the new decoded array\n found_match = true # This is establishing that this particular element has now been evaluated.\n break # Exiting out of the cipher loop.\n end \n end # This ends th cipher loop.\n if not found_match # If found_match is true, i.e., the element has already been evaluated.\n decoded_sentence << x #Push that already evaluated element into the decoded array.\n end\n end # This ends the input loop.\n decoded_sentence = decoded_sentence.join(\"\") # Join the decoded array into a string.\n \n if decoded_sentence.match(/\\d+/) # This is looking to see if there are any numbers in the decoded string.\n decoded_sentence.gsub!(/\\d+/) { |num| num.to_i / 100 } # This is substituting the original number to a fraction of that number.\n end \n return decoded_sentence # Output the final decoded string. \nend",
"title": ""
}
] |
[
{
"docid": "6979036015fac47c519d3834b2c5c971",
"score": "0.6463458",
"text": "def sort_string(string)\r\n # your code here\r\n a = string.split(\" \")\r\n b = a.sort{|x,y| x.length <=> y.length}\r\n b[0]<<' '<<b[1]<<' '<<b[2]\r\nend\r\n\r\n\r\n# Select random elements from an array\r\n\r\ndef random_select(array, n)\r\n # your code here\r\n len = array.size\r\n result = []\r\n n.times do \r\n result = result << array[rand(len)] \r\n end\r\n return result\r\nend\r\n\r\n\r\n# Find the length of strings in an array\r\n\r\ndef length_finder(input_array)\r\n out_arr = []\r\n input_array.each do |i|\r\n out_arr = out_arr << i.length\r\n end\r\n return out_arr\r\nend\r\n\r\n\r\n# Hiring Programmers - Boolean Expressions in Ruby\r\n\r\nis_an_experienced_programmer = (\r\n (candidate.years_of_experience >= 2 || candidate.github_points >= 500) && candidate.languages_worked_with.include?(\"Ruby\") && candidate.age >= 15 && !candidate.applied_recently?\r\n )\r\n \r\n \r\n# Palindromes \r\n\r\ndef palindrome?(sentence)\r\n # Write your code here\r\n sentence = sentence.downcase.gsub(' ','')\r\n reverse = ''\r\n i = 1\r\n sentence.length.times do\r\n reverse = reverse << sentence[-i]\r\n i = i.next\r\n end\r\n return reverse == sentence\r\nend\r\n\r\n\r\n# Compute sum of cubes for given range\r\n\r\ndef sum_of_cubes(a, b)\r\n # Write your code here\r\n i = a\r\n result = i**3\r\n loop do\r\n if i == b \r\n break\r\n else\r\n i = i + 1\r\n result = result + i**3\r\n end\r\n end\r\n return result\r\nend\r\n \r\n \r\n# Find non-duplicate values in an Array\r\n\r\ndef non_duplicated_values(values)\r\n # Write your code here\r\n out_arr = values\r\n values.each do |x|\r\n n = values.select {|y| y == x}\r\n if n.length > 1\r\n out_arr.delete_if {|y| y == x}\r\n end\r\n end\r\n return out_arr\r\nend\r\n\r\n\r\n# Check if all elements in an array are Fixnum\r\n\r\ndef array_of_fixnums?(array)\r\n # Write your code here\r\n n = 0\r\n n = array.select {|x| x.is_a?(String) }\r\n if n.length == 0\r\n return true\r\n else \r\n return false\r\n end \r\nend\r\n\r\n\r\n# Kaprekar's Number\r\n\r\ndef kaprekar?(k)\r\n k2 = k**2\r\n n = \"#{k}\".length\r\n num_digits_k2 = \"#{k2}\".length\r\n right_n = k2 % (10**n)\r\n left = k2 / (10**n)\r\n k == (right_n + left)\r\nend\r\n\r\n\r\n# Number shuffle\r\n\r\ndef number_shuffle(number)\r\n # your code here\r\n len = \"#{number}\".length\r\n arr = []\r\n i = 0\r\n num = 1\r\n len.times do \r\n x = number % 10**(i+1)\r\n arr[i] = x / (10**i)\r\n i = i + 1\r\n num = num * i\r\n end\r\n result = []\r\n loop do \r\n if result.length == num\r\n break\r\n else\r\n x = arr.shuffle\r\n y = 0\r\n i = 10**(arr.length-1)\r\n x.each do |k|\r\n y = y + (k * i)\r\n i = i / 10\r\n end\r\n result.push(y)\r\n result = result.uniq\r\n end\r\n end\r\n return result.sort\r\nend\r\n\r\n\r\n# Time to run code\r\n\r\ndef exec_time(proc)\r\n # your code here\r\n h = Time.now\r\n puts proc.call\r\n n = Time.now\r\n return n - h \r\nend\t\r\n\r\n\r\n# Your sum\r\n\r\nclass MyArray\r\n attr_reader :array\r\n\r\n def initialize(array)\r\n @array = array\r\n end\r\n\r\n def sum(initial_value = 0)\r\n if block_given?\r\n res = initial_value\r\n array.each do |i|\r\n res = res + yield(i)\r\n end\r\n return res\r\n else\r\n res = initial_value\r\n array.each do |i|\r\n res = res + i\r\n end\r\n return res\r\n end\r\n end\r\nend\r\n\r\n\r\n# Orders and costs\r\n\r\nclass Restaurant\r\n def initialize(menu)\r\n @menu = menu\r\n end\r\n\r\n def cost(*orders)\r\n # your code here\r\n total = 0\r\n orders.each do |ord|\r\n ord.each do |i, q|\r\n p = @menu[i]\r\n c = p * q\r\n total = total + c\r\n end\r\n end\r\n return total\r\n end\r\nend\r\n\r\n\r\n# Enough Contrast?\r\n\r\nclass Color\r\n attr_reader :r, :g, :b\r\n def initialize(r, g, b)\r\n @r = r\r\n @g = g\r\n @b = b\r\n end\r\n\r\n def brightness_index\r\n # your code here\r\n return ( 299 * r + 587 * g + 114 * b) / 1000\r\n end\r\n\r\n def brightness_difference(another_color)\r\n #your code here\r\n return (brightness_index - another_color.brightness_index).abs\r\n end\r\n\r\n def hue_difference(another_color)\r\n #your code here\r\n return ((r - another_color::r).abs + (g - another_color::g).abs + (b - another_color::b).abs)\r\n end\r\n\r\n def enough_contrast?(another_color)\r\n # your code here\r\n if brightness_difference(another_color) > 125 && hue_difference(another_color) > 500 \r\n true\r\n else\r\n false\r\n end\r\n end\r\nend\r\n\r\n\r\n",
"title": ""
},
{
"docid": "03b21faf8f85eca86d55fbcd89fd6d97",
"score": "0.6217382",
"text": "def problem_six\n\t# Square first 100 numbers\n\tsquare = [ ]\n\t1.upto(100).each do |x|\n\t\tsquare << x ** 2 \n\tend\n\n\t# Add those square numbers\n\tsquare_sum = 0\n\tsquare.each do |y|\n\t\tsquare_sum += y\n\tend\n\t\n\t# Add first 100 numbers\n\tsum = 0\n\t1.upto(100).each do |n|\n\t\tsum += n\n\tend\n\n\t# Square sum of 100 numbers\n\tsum_square = sum ** 2\n\n\t# Find the difference\n\tdifference = sum_square - square_sum\n\treturn difference\n\nend",
"title": ""
},
{
"docid": "ae10f5e1641f5047aa611f426748fe1d",
"score": "0.62112933",
"text": "def solution(s)\n # write your code in Ruby 2.2\n len = s.length\n return 0 if len == 1\n return -1 if len % 2 == 0\n \n mid = s.length / 2\n (0...mid).each do |i|\n j = len - 1 - i\n return -1 if s[i] != s[j]\n end \n \n mid\nend",
"title": ""
},
{
"docid": "61a5aa5387d7586d627164f40eaf623a",
"score": "0.61987305",
"text": "def solution6(input)\n end",
"title": ""
},
{
"docid": "b9960478999684c2b536f76e22f6fc63",
"score": "0.61631036",
"text": "def solution4(input)\n end",
"title": ""
},
{
"docid": "e64ab9041d127fd863cb8cc14dea830e",
"score": "0.61602473",
"text": "def solve_challenge(input)\n sum = 0\n last_index = input.length - 1\n char1 = ''\n char2 = ''\n input.split('').each_with_index do |ch, i|\n char1 = ch\n # circle around list if index is at the end\n if i == last_index\n char2 = input[0]\n # otherwise just grab the next character\n else\n char2 = input[i+1]\n end\n # add to sum if the 2 characters match\n sum += char1.to_i if char1 == char2\n end\n sum\nend",
"title": ""
},
{
"docid": "4871d41491c1924c30e4fb427988073d",
"score": "0.61518574",
"text": "def solution(s)\n result = 'Funny'\n s = s.codepoints\n r = s.reverse\n\n for i in (1..s.length - 1)\n sum1 = (s[i] - s[i-1]).abs\n sum2 = (r[i]- r[i-1]).abs\n if sum1 != sum2\n result = 'Not Funny'\n break\n end\n end\n\n result\nend",
"title": ""
},
{
"docid": "7a007b872ce37620e3363cea2761da98",
"score": "0.60844034",
"text": "def solution(a)\n # write your code in Ruby 2.2\n sum = a.inject(0, :+)\n n = a.length\n expected = n * (n+1)/2\n diff = sum - expected\n missing = n + 1 - diff\nend",
"title": ""
},
{
"docid": "d72ccae3f326a4e3222492869096fb16",
"score": "0.60488844",
"text": "def day_one_part_one(input)\n n = input.strip.split('')\n\n\n # ------- SOL 1 ------\n # puts \"n is #{n}\"\n # puts \"n.rotate(1) is #{n.rotate(1)}\"\n # puts \"n.zip(n.rotate(1)) is #{n.zip(n.rotate(1))}\"\n puts n.zip(n.rotate(1))\n .select { |x, y| x == y }\n .map(&:first)\n .map(&:to_i)\n .inject(:+)\n # ------- SOL 2 ------\n # puts \"n.each_cons(2).to_a is #{n.each_cons(2).to_a}\"\n # puts \"n.each_cons(2).to_a.select { |x, y| x == y } is #{n.each_cons(2).to_a.select { |x, y| x == y }}\"\n # puts \"n.each_cons(2).to_a.select { |x, y| x == y }.map(&:first) is #{n.each_cons(2).to_a.select { |x, y| x == y }.map(&:first)}\"\n # puts \"n.each_cons(2).to_a.select { |x, y| x == y }.map(&:first).map(&:to_i) is #{n.each_cons(2).to_a.select { |x, y| x == y }.map(&:first).map(&:to_i)}\"\n # n << n.first\n # puts n.each_cons(2).to_a\n # .select { |x, y| x == y }\n # .map(&:first)\n # .map(&:to_i)\n # .inject(:+)\n #\n # ------- SOL 3 ------\n # sum = 0\n # digits = input.strip.split('')\n # digits.each_index do |i|\n # if i == digits.size - 1\n # sum += digits.last.to_i if digits.last == digits.first\n # elsif digits[i] == digits[i + 1]\n # sum += digits[i].to_i\n # end\n # end\n # puts sum\nend",
"title": ""
},
{
"docid": "c3cb3e948c27b241ea4299b2df1fa4b3",
"score": "0.6048114",
"text": "def solution5(input)\n end",
"title": ""
},
{
"docid": "c3cb3e948c27b241ea4299b2df1fa4b3",
"score": "0.6048114",
"text": "def solution5(input)\n end",
"title": ""
},
{
"docid": "4a21fd90da81a02895a7e32078bf0946",
"score": "0.60400885",
"text": "def solution(a)\r\n # write your code in Ruby 2.2\r\n \r\n i=0;\r\n l=a.count\r\n arr=[]\r\n p=0\r\n loop do\r\n arr[a[i]-1] = a[i]\r\n i+=1\r\n \r\n if(i==l)\r\n k=1;\r\n \r\n for j in arr\r\n if(k!=j)\r\n p=k\r\n break\r\n end\r\n k+=1\r\n end\r\n \r\n break\r\n end\r\n end\r\n \r\n \r\n p\r\nend",
"title": ""
},
{
"docid": "f8b13ae90c3f70410bf86714d6d49eef",
"score": "0.6025021",
"text": "def solution(n)\n # write your code in Ruby 2.2\n s = n.to_s(2) \n zeroes = s.split('1') \n zeroes.pop if !n.odd? \n return 0 if zeroes.empty? \n zeroes.map { |x| x.length}.max\nend",
"title": ""
},
{
"docid": "5f8f7bef44de8c5fbf543c1650f70262",
"score": "0.6015002",
"text": "def problem_9(sum)\n array = []\n # Divide the number by two and then subtract one \n # to ensure there are no zeros in the triplet.\n ((sum / 2) - 1).downto(1) { |n| array << n }\n\n # Iterate through possible c values. \n array.each do |c|\n remainder = sum - c\n # Create and iterate another array to run through the \n # difference of the sum and c. \n array2 = (1..remainder).to_a\n array2.each do |a|\n b = remainder - a\n if (a**2 + b**2 == c**2)\n return puts a, b, c\n end\n end\n end\nend",
"title": ""
},
{
"docid": "c3a6c4ddb76579e45e3cbe80fba426be",
"score": "0.59938425",
"text": "def solution(a)\r\n # write your code in Ruby 2.2\r\n\r\n l=a.count-1\r\n arr=[]\r\n \r\n \r\n loop do\r\n arr[a[l]-1] = a[l]\r\n \r\n l-=1\r\n break if l<0\r\n end\r\n \r\n if arr.count == a.count\r\n return 1\r\n else\r\n return 0\r\n end\r\n \r\n \r\nend",
"title": ""
},
{
"docid": "15a47b49e9abd1e4a0e1f3149d80bbf9",
"score": "0.59926385",
"text": "def solution(s, p, q)\n # write your code in Ruby 2.2\n letters = { 'A' => 1, 'C' => 2, 'G' => 3, 'T' => 4 }\n n = s.size\n res = []\n\n p_sums = Hash.new { |k,v| k[v] = Array.new(n + 1, 0) }\n\n letters.keys.each do |letter|\n for i in 1..n do\n p_sums[letter][i] = p_sums[letter][i -1]\n p_sums[letter][i] += 1 if s[i-1] == letter\n end\n end\n # puts \"#{p_sums}\"\n\n i = 0\n for i in i..p.size-1 do\n # puts \"== #{i}\"\n letters.keys.each do |k|\n # puts \"#{k} | P: #{p[i]} Q: #{q[i]} | #{p_sums[k][p[i]]} #{p_sums[k][q[i]+1]}\"\n if p_sums[k][p[i]] != p_sums[k][q[i]+1]\n res << letters[k]\n break\n end\n end\n end\n res\n\n \nend",
"title": ""
},
{
"docid": "805c8cc74901b435978c0b0c45390593",
"score": "0.59810376",
"text": "def main()\n number = '73167176531330624919225119674426574742355349194934\n\t96983520312774506326239578318016984801869478851843\n\t85861560789112949495459501737958331952853208805511\n\t12540698747158523863050715693290963295227443043557\n\t66896648950445244523161731856403098711121722383113\n\t62229893423380308135336276614282806444486645238749\n\t30358907296290491560440772390713810515859307960866\n\t70172427121883998797908792274921901699720888093776\n\t65727333001053367881220235421809751254540594752243\n\t52584907711670556013604839586446706324415722155397\n\t53697817977846174064955149290862569321978468622482\n\t83972241375657056057490261407972968652414535100474\n\t82166370484403199890008895243450658541227588666881\n\t16427171479924442928230863465674813919123162824586\n\t17866458359124566529476545682848912883142607690042\n\t24219022671055626321111109370544217506941658960408\n\t07198403850962455444362981230987879927244284909188\n\t84580156166097919133875499200524063689912560717606\n\t05886116467109405077541002256983155200055935729725\n\t71636269561882670428252483600823257530420752963450'\n number = number.split('')\n result = 0\n\n (0..(number.size()-6)).each { |i|\n comp = 1\n for x in 0..4\n comp = comp * number[i+x].to_i\n end\n if comp > result\n puts 'Found new result! ===> ' + comp.to_s\n result = comp\n end\n }\n\nend",
"title": ""
},
{
"docid": "4f7342b3592ec209d29fa49774767bb7",
"score": "0.59766024",
"text": "def solve\n d = %w(1 2 3 4 5 6 7 8 9).permutation.map {|i| i.join}.select {|i| i >= '918273645'}.reverse\n \n d.each do |i|\n 1.upto( 4 ) do |j|\n s = i[0, j]\n n = s.to_i\n\n 2.upto( 5 ) do |k|\n s += (k * n).to_s\n return i.to_i if i == s # puts \"%s (1..%d x %d)\" % [i, k, n]\n\n break if !i.start_with?( s )\n end\n end\n end\n end",
"title": ""
},
{
"docid": "fcdc7a5e867d3db0a4e4c61dc4d4da37",
"score": "0.59755945",
"text": "def solution(a)\n # write your code in Ruby 1.9.3\n go_east = 0\n pass = 0\n a.each do |x|\n if x == 0\n go_east += 1\n else\n pass += go_east\n if pass > 100000\n return -1\n end\n end\n end\n\n return pass\n\nend",
"title": ""
},
{
"docid": "af5213168e0ee82b120bec44b2735af5",
"score": "0.59724987",
"text": "def solution(a)\n size = 0\n value = -1\n (0..(a.length-1)).each do |i|\n if(size == 0)\n size = 1\n value = a[i]\n else\n if(value != a[i])\n size = size - 1\n else\n size = size + 1\n end\n end\n end\n\n candidate = -1\n leader = -1\n count = 0\n leader_indices = []\n\n if(size > 0)\n candidate = value\n end\n\n (0..(a.length-1)).each do |i|\n if a[i] == candidate\n count = count + 1\n end\n leader_indices << count\n end\n\n if count > (a.length/2)\n leader = candidate\n end\n\n leaders_count = 0\n\n if(leader != -1)\n (0..(a.length-1)).each do |i|\n a_1 = a[0..i]\n a_2 = a[(i+1)..(a.length-1)]\n\n count_2 = leader_indices[i]\n\n # puts \"count_2 #{count_2} , count #{a_1.length/2}\"\n # puts \"count_2 #{count_2} , (count-count_2) #{(count-count_2)}, count #{(a_2.length/2)}\"\n\n if count_2 > (a_1.length/2) && (count-count_2) > (a_2.length/2)\n leaders_count = leaders_count + 1\n end\n\n # puts leaders_count\n # puts\n end\n end\n\n leaders_count\nend",
"title": ""
},
{
"docid": "0f120547cc68edff651bf2d0a8bdfa95",
"score": "0.5972187",
"text": "def a_or_b(n)\n if n%2 == 0\n print \"B\"\n else\n print \"A\"\n end\nend \n\na_or_b(3)\n\n#while n <=10 do\n\n #for n in 1..10 do\n # while \n # if n%2 == 0\n # print \"B\"\n # else\n # print \"A\"\n # end\n # puts ''\n # end\n #end\n\n#puts ''\n#n += 1\n#end\n# k += 1\n# end\n# puts ''\n# number += 1\n#end\n#1ずつ改行が増える\n#AB交互で偶数奇数\n\n#i = 10\n#while \n#for j in 0..i\n#puts (\"*\" * (j-i))\n#end\n#puts \"\\n\"\n\n#素数(位置とそれ以外の数で割れないかず)\n#p = 5 \n#k = 1..\n#if p>k\n# if (p%k == 0).count == 2\n# put \"true\"\n# \n# else\n# put\"false\"\n# end\n#else\n\n#def sosu(n)\n# num = 2\n# n.times do \n# if((n%num) == 0 && (n != num))\n# puts \"#{n} false\"\n# break\n# else\n# \n# end\n# \n# num = num + 1\n# end\n#end\n#puts sosu(10)\n#puts sosu(2)\n#puts sosu(37)",
"title": ""
},
{
"docid": "2d1f5ffbab8c86bc000cce7ee42c2003",
"score": "0.5965384",
"text": "def solution(array)\n array.sort!\n return 0 if array.length == 1 && array.first != 1\n length = array.length\n start = 1\n length.times do |n|\n if array[start-1] != n + 1\n return 0\n end\n start += 1\n end\n return 1\nend",
"title": ""
},
{
"docid": "aa89b26c8848588848ff622b5d313173",
"score": "0.5960936",
"text": "def solution\n 31875000\nend",
"title": ""
},
{
"docid": "6aca174205d44a5a93db461cabeb310f",
"score": "0.59375787",
"text": "def factorial(n)\n # recursion here\n if n == 0\n return 1\n elsif n == -1\n raise ArgumentError, \"unable to calculate because of negative number\"\n else\n return n * factorial(n-1)\nend\n\n#------------------------------------------------------------------------\n# Time complexity: O(n) because n is = to number being passed\n# Space complexity: O(n) because n is = to number being passed\n\ndef reverse(s)\n if s.length <= 1\n return s\n else\n return s[-1] + reverse(s[0..-2])\n end\nend\n\n#------------------------------------------------------------------------\n# Time complexity: O(n) because n is number of characters based on the string\n# Space complexity: O(n) because n is number of characters based on the string\ndef reverse_inplace(s)\n #will need a helper method\n if s == \"\"\n return s\n end\n\n temp = s[0]\n s[0] = s[s.length - 1]\n s[s.length - 1] = temp\n\n if s.length > 1\n s[1..-2] = reverse_inplace(s[1..-2])\n end\n return s\nend\n\n#------------------------------------------------------------------------\n# Time complexity: O(n) because n is the number of bunnies\n# Space complexity: O(n) because n is the number of bunnies\ndef bunny(n)\n if n == 0\n return 0\n else\n return 2 + bunny(n - 1)\n end\nend\n\n#------------------------------------------------------------------------\n# Time complexity: ?\n# Space complexity: ?\ndef nested(s)\n if s == \"\" || s == \"()\"\n return true\n elsif s[0] == \"(\" && s[-1] == \")\" && nested(s[1..-2])\n return true\n else\n return false\n end\nend\n#------------------------------------------------------------------------\n# Time complexity: O(n)\n# Space complexity: O(n^2), creates a new string on each recursive call\ndef search(array, value)\n return false if array.empty?\n return true if array[0] == value\n return search(array[1..-1], value)\nend\n\n#------------------------------------------------------------------------\n# Time complexity: O(n)\n# Space complexity: O(n^2), creates a new string on each recursive call\ndef is_palindrome(s)\n return true if s.length <= 1\n return false if s[0] != s[-1]\n return is_palindrome(s[1...-1])\nend\n\n#------------------------------------------------------------------------\n# Time complexity: O(log10(n))\n# Space complexity: O(log10(n))\n# Would both complexities O(log10(n*m)) since both n and m are being divided by 10 on each recursive call?\ndef digit_match(n, m)\n return 1 if n == 0 && m == 0\n return 0 if n <= 1 || m <= 1 \n return n % 10 == m % 10 ? (1 + digit_match(n / 10, m / 10)) : digit_match(n / 10, m / 10)\nend",
"title": ""
},
{
"docid": "95c5d00f6fd8f5d6f4b7368744a1a4b6",
"score": "0.59356123",
"text": "def solution2(input)\n end",
"title": ""
},
{
"docid": "95c5d00f6fd8f5d6f4b7368744a1a4b6",
"score": "0.59356123",
"text": "def solution2(input)\n end",
"title": ""
},
{
"docid": "7d939c0685d8b9ddddf8d6219f187d1a",
"score": "0.593215",
"text": "def problem_8\n numbers = \"\n 73167176531330624919225119674426574742355349194934\n 96983520312774506326239578318016984801869478851843\n 85861560789112949495459501737958331952853208805511\n 12540698747158523863050715693290963295227443043557\n 66896648950445244523161731856403098711121722383113\n 62229893423380308135336276614282806444486645238749\n 30358907296290491560440772390713810515859307960866\n 70172427121883998797908792274921901699720888093776\n 65727333001053367881220235421809751254540594752243\n 52584907711670556013604839586446706324415722155397\n 53697817977846174064955149290862569321978468622482\n 83972241375657056057490261407972968652414535100474\n 82166370484403199890008895243450658541227588666881\n 16427171479924442928230863465674813919123162824586\n 17866458359124566529476545682848912883142607690042\n 24219022671055626321111109370544217506941658960408\n 07198403850962455444362981230987879927244284909188\n 84580156166097919133875499200524063689912560717606\n 05886116467109405077541002256983155200055935729725\n 71636269561882670428252483600823257530420752963450\"\n numbers = numbers.gsub(/\\s/m,\"\").split(//).map(&:to_i)\n numbers.each_cons(5).map {|a| p a; a.reduce(&:*) }.max\nend",
"title": ""
},
{
"docid": "0e4cda0adbc8b5aecd2938d89a067613",
"score": "0.59301305",
"text": "def solution(s)\n\nend",
"title": ""
},
{
"docid": "01d65f828880f2b3ce5cccb589374205",
"score": "0.5925154",
"text": "def problem30\n total = 0\n (10..1000000).each{|n|\n total += n if n == n.to_s.split(\"\").inject(0){|sum,d|sum+=d.to_i**5}\n }\n total\nend",
"title": ""
},
{
"docid": "d198ce6530d8641577166dd071790bfa",
"score": "0.5924586",
"text": "def hard(string)\n sum = 0\n steps = string.length / 2\n string.length.times do |i|\n j = (i + steps) % string.length\n sum += check(string[i], string[j])\n end\n sum\nend",
"title": ""
},
{
"docid": "200b676337f3c42b05ef229f1de10cfe",
"score": "0.59228545",
"text": "def solution(s)\n binary_digits = s.length\n sum = 0\n decimal = 0\n s.split(//).each do |digit|\n binary_digits -= 1\n decimal = digit.to_i*(2**binary_digits)\n sum += decimal\n end\n\n number_of_steps = 0\n\n while sum != 0 do\n if sum % 2 == 0\n (sum /= 2)\n number_of_steps += 1\n else\n sum -= 1\n number_of_steps += 1\n end\n end\n return number_of_steps\nend",
"title": ""
},
{
"docid": "ad39c7d5dc657f0494a8726850275ec6",
"score": "0.59210825",
"text": "def number_joy(n)\n\n@n = n\n@counter = 0\n@int_rev = 0\n\ndef integer_total \n arr = @n.to_s.split(\"\").map(&:to_i)\n arr.each do |a| @counter += a\n end \nend\n\ndef is_harshad\n@n%@counter == 0\nend \n\ndef integer_reversed\n@int_rev = @counter.to_s.reverse.to_i\nend\n\ndef joyful_number\nreturn @n == @counter*@int_rev && @n%@counter == 0\nend\n \n\ninteger_total\ninteger_reversed\nis_harshad\njoyful_number\n\nend",
"title": ""
},
{
"docid": "4ad68ebce1b425c551899d5fbdae814f",
"score": "0.5918349",
"text": "def solution(arr)\n\nend",
"title": ""
},
{
"docid": "71d1514d3b8b2c24c49ac56b6c9db518",
"score": "0.59125745",
"text": "def luck_check(str) # input is a string\n # validate your input\n # output flase if input is ''\n if str == ''\n return false\n end\n\n # output false if input is no all nums\n unless str =~ /\\A\\d+\\z/\n return false\n end\n\n # figure out the input's length\n length = str.length\n\n # figure out midpoint = length / 2 ---->\n # chars to tkae from each side\n midpoint = length/2\n\n #convert string to array of integers\n chars = str.chars.map { |c| c.to_i }\n\n #sum the left side\n left_sum = chars[0..midpoint-1].inject(:+) # ruby knows to use inject and add averything together\n\n puts \"***** left sum = #{left_sum}\"\n #sum the rigth side\n right_sum = chars[-midpoint+1..-1].inject(:+)\n\n puts \"***** right sum = #{right_sum}\"\n\nend",
"title": ""
},
{
"docid": "07a10d2fcc160a93377ffbd3e8801775",
"score": "0.5910875",
"text": "def solve(input)\n numbers = input.to_s.split(\"\").map(&:to_i)\n length = numbers.size\n first = numbers[0]\n\n total = 0\n\n step = length / 2\n numbers.each_with_index do |number, index|\n next_position = (index + step) % length\n if numbers[next_position] == number\n total += number\n end\n end\n\n total\nend",
"title": ""
},
{
"docid": "f712d49ec6c615538b2e2aa846391fda",
"score": "0.58938634",
"text": "def challenge; end",
"title": ""
},
{
"docid": "e1eaf9164fde5ff965529dfe5b458475",
"score": "0.58922946",
"text": "def reverse(s)\n if s.length == 1 #basecase\n return s \n else\n return reverse(s[1..-1]) + s[0]\nend\n\n\n# Time complexity: O(n)\n# Space complexity: O(n)\ndef reverse_inplace(s)\n if count == 0\n return false\n elsif s.even?\n s.reverse + s(count -1)\n else\n s + s(count - 1)\n end\nend\n\n# Time complexity: ?\n# Space complexity: ?\ndef bunny(n)\n raise NotImplementedError, \"Method not implemented\"\nend\n\n# Time complexity: ?\n# Space complexity: ?\ndef nested(s)\n raise NotImplementedError, \"Method not implemented\"\nend\n\n# Time complexity: ?\n# Space complexity: ?\ndef search(array, value)\n raise NotImplementedError, \"Method not implemented\"\nend\n\n# Time complexity: ?\n# Space complexity: ?\ndef is_palindrome(s)\n raise NotImplementedError, \"Method not implemented\"\nend\n\n# Time complexity: ?\n# Space complexity: ?\ndef digit_match(n, m)\n raise NotImplementedError, \"Method not implemented\"\nend",
"title": ""
},
{
"docid": "c47af476a1c9c548b894a4c7c45b09cc",
"score": "0.5875289",
"text": "def solution(a)\n # write your code in Ruby 2.2\n return a[0] if a.length == 1\n\n for i in 0..a.length\n unpaired = a[i + 2] if a[i+2] && a[i] != a[i+2] && a[i+2] % 2 == 0\n end\n\n return unpaired\nend",
"title": ""
},
{
"docid": "fdc30d52c9adc32c82e291f2f3bc3b99",
"score": "0.58696276",
"text": "def problem206\n Math.sqrt(1020304050607080900).floor.upto(m = Math.sqrt(1929394959697989990).ceil) do |x|\n if (s = x.to_s)[s.length - 1].to_i % 2 == 0\n puts \"#{x} of #{m}\"\n q = x**2\n if(s = q.to_s)[18].to_i == 0 && s[16].to_i == 9 && s[14].to_i == 8 && s[12].to_i == 7 && s[10].to_i == 6 && s[8].to_i == 5 && s[6].to_i == 4 && s[4].to_i == 3 && s[2].to_i == 2\n puts s\n break\n end\n end\n end\nend",
"title": ""
},
{
"docid": "a64e225ff27690e4334e4c789e82bae5",
"score": "0.58679664",
"text": "def solution(n)\r\n # write your code in Ruby 2.2\r\n # puts n\r\n binary = n.to_s(2)\r\n count = 0\r\n temp = 0\r\n \r\n for i in 0..(binary.size)\r\n if binary[i] == \"0\" and binary[i..-1].end_with?(\"1\")\r\n count += 1\r\n else\r\n temp = count if count > temp\r\n count = 0\r\n end\r\n end\r\n temp\r\nend",
"title": ""
},
{
"docid": "0961bc5e98dc02560a093b099e430eaa",
"score": "0.58617455",
"text": "def odds_and_evens(string, return_odds)\n# Creates new method with two arguments, 'string' and 'return_odds' boolean.\n\n to_return = \"\"\n# Creates new variable and assigns it an empty string.\n\n string.size.times do |index|\n# First applies the .size method to the string to calculate the size of the string and return the resulting number. E.g. if the string is \"Rare\", .size will applied to the string returns 4 because \"Rare\" has 4 letters.\n\n# Second applies the .times to the number returned after calculating the string size. E.g. if the string is \"Rare\", .times will execute the following loop x4 times.\n\n# Third the \"| index |\" means do for each indexed character the following steps. A string has an index, e.g. [[0, r], [1, a], [2, r], [3, e]], where the first character is the index number and the second is the corresponding character. Note '0' is considered an even number for coding purposes.\n\n next if return_odds && index.even?\n # First iteration iterates over index[0], i.e. \"r'\n # => next if true && r.even?\n # => next if true && true\n # => next if true\n # => therefore ends loop and skips \"r\", telling ruby to move on and iterate over the next item in the index, which is index[1], i.e. \"a\".\n\n # Second iteration iterates over index[1], i.e. \"a\".\n # => next if true && a.even?\n # => next if true && false\n # => next if false\n # => therefore tells ruby don't skip \"a\" and instead move on to complete next step using index[1] as the return value.\n\n # Third iteration iterates over index[2], i.e. the second letter \"r\".\n # => next if true && r.even?\n # => next if true && true\n # => next if true\n # => therefore ends loops and skips second letter \"r\", telling ruby to move on and iterate over the next item in the index, which is index[3], i.e. \"e\".\n\n # Fourth (and final) iteration iterates over index[3], i.e. \"e\".\n # => next if true && e.even?\n # => next if true && false\n # => next if false\n # => therefore tells ruby don't skip \"e\" and instead move on to complete next step using index[3] as the return value.\n\n puts \"#{index}\"\n\n # Second iteration puts current return value (i.e. index[1], \"a\") to screen.\n\n # Fourth iteration puts current return value (i.e. index[4], \"e\" to screen)\n\n next if !return_odds && index.odd?\n # Second iteration continues to iteratre this step over index[1], i.e. \"a\".\n # => next if false && a.even?\n # => next if false && false\n # => next if false\n # => therefore tells ruby to move on to the next steps using index[1], i.e. \"a\" as the return value.\n\n # Fourth iteration continues to iterate this step over index[3], i.e. \"e\".\n # => next if false && e.even?\n # => next if false && false\n # => next if false\n # => therefore tells ruby don't skip \"e\" and instead move on to complete next steps using index[3], i.e. \"e\".\n\n puts \"#{index}+x\"\n\n # Second iteration puts current value of return (index[1], i.e. \"a\") to screen.\n\n # Fourth iteration puts current value of return (index[3], i.e. \"e\") to screen.\n\n to_return << string[index]\n # Second interation continues to iteratre this step over index[1], i.e. \"a\".\n # => \"\" << string[1]\n # => \"\" << a\n # => to_return = \"a\"\n # In other words, ruby adds the current return value, index[1] (i.e. \"a\"), to the variable \"to_return\".\n # That ends the second iteration and we move on to the third iteration to iteratre index[2], i.e. the second letter \"r\".\n\n # Fourth iteration continues to iterate this steps over index[3], i.e. \"e\".\n # => \"a\" << string[3]\n # => \"a\" << \"e\"\n # => to_return = \"ae\"\n # In other words, ruby adds the current return value, index[3] (i.e. \"e\"), to the variable \"to_return\".\n # That ends the fourth and final iteration and closes the loop.\n end\n\n to_return\n# Return the final value of to_return after iterating each character in the chosen string. This does not get returned until the above loop has completed.\n\nend",
"title": ""
},
{
"docid": "28af4f93a91e45878228e29d0c8229c2",
"score": "0.58600485",
"text": "def solution(str)\n b = str.split(\"\")\n n = 0\n c = []\n\n p b\n\n if b.count.even?\n for i in 0..str.length/2\n c << b[i*2].to_s + b[i*2+1].to_s\n end\n else\n b << \"_\"\n b.each do |x|\n c << b[n].to_s + b[n+1].to_s\n n = n + 2\n end\n end\nc.delete(\"\")\nreturn c\nend",
"title": ""
},
{
"docid": "49552ab2769a4e7e83c75ae7c3fe0900",
"score": "0.58594936",
"text": "def solution(a)\n size = 0\n value = -1\n (0..(a.length-1)).each do |i|\n if(size == 0)\n size = 1\n value = a[i]\n else\n if(value != a[i])\n size = size - 1\n else\n size = size + 1\n end\n end\n end\n\n candidate = -1\n leader = -1\n count = 0\n index = -1\n\n if(size > 0)\n candidate = value\n end\n\n (0..(a.length-1)).each do |i|\n if a[i] == candidate\n count = count + 1\n index = i\n end\n end\n\n if count > (a.length/2)\n leader = candidate\n else\n index = -1\n end\n\n index\nend",
"title": ""
},
{
"docid": "75140bd92377e07bd7367ec852f43d4d",
"score": "0.5856514",
"text": "def solution(arr) end",
"title": ""
},
{
"docid": "0b7a616cc7822be314b767ef2b841fa3",
"score": "0.58564055",
"text": "def solution3(input)\n end",
"title": ""
},
{
"docid": "07819e3afdf5a27c3cfb64e3e0f2ce3a",
"score": "0.5852492",
"text": "def problem33\n num, den = 1, 1\n 10.upto(98) do |x|\n (x+1).upto(99) do |y|\n if (((simplestTerms(x,y)<=>simplestTerms((n = (a = x.to_s)[0].to_i), (d = (b = y.to_s)[1].to_i))) == 0 && a[1] == b[0]) ||\n ((simplestTerms(x,y)<=>simplestTerms((n = a[1].to_i), (d = b[0].to_i))) == 0 && a[0] == b[1]) &&\n (a[0] != b[0] && a[1] != b[1] && a[0] != a[1] && b[0] != b[1]))\n num, den = num * n, den * d\n puts \"#{x}/#{y} == #{n}/#{d}\"\n end\n end\n end\n puts \"#{(r = simplestTerms(num,den))[0]}/#{r[1]}\"\nend",
"title": ""
},
{
"docid": "22a12438f1c1fc5bbca224af53e738d8",
"score": "0.5833605",
"text": "def solution(a, b)\r\n @a = a\r\n @b = b\r\n \r\n if @a.length < @b.length\r\n return @a + @b + @a\r\n \r\n elsif @b.length < @a.length\r\n return @b + @a + @b\r\n \r\n else\r\n return @a + @b\r\n end\r\nend",
"title": ""
},
{
"docid": "72bb3b989efb9ec765190d8962bff157",
"score": "0.5828401",
"text": "def solution(a)\n # write your code in Ruby 1.9.3\n count = Array.new(a.length,0)\n a.each do |e|\n return 0 if e > a.length\n count[e-1] += 1 \n end\n \n (1..count.length-1).each do |i|\n return 0 if count[i]!=1 || count[i] > 1\n end\n \n return 1\nend",
"title": ""
},
{
"docid": "56e2f4c229d68e9d667cf5f5fe1d2177",
"score": "0.58240306",
"text": "def solution(a)\r\n # write your code in Ruby 2.2\r\n #a[0] = 1 [-1..1]\r\n #a[1] = 5 [-4..6]\r\n #a[2] = 2 [0..4]\r\n #a[3] = 1 [2..4]\r\n #a[4] = 4 [0..8]\r\n #a[5] = 0 [0]\r\n\r\n i=0\r\n arr=[]\r\n while(i<a.count) do\r\n \r\n arr[i] = (i-a[i].. i+a[i]).to_a\r\n i+=1 \r\n end\r\n \r\n \r\n \r\n l=arr.count\r\n i=0\r\n n=0\r\n while(i<l) do\r\n \r\n \r\n j=i+1\r\n while(j<l) do\r\n if(arr[i] != arr[j])\r\n \r\n if((arr[i] & arr[j]).empty? == false)\r\n n+=1\r\n end\r\n end\r\n j+=1\r\n end \r\n i+=1\r\n end\r\n n\r\nend",
"title": ""
},
{
"docid": "104712d8379b7721c9708b9ad8ec479e",
"score": "0.581699",
"text": "def solution(a)\n return 0\nend",
"title": ""
},
{
"docid": "b2d1c4efb0ce3d7f6e9ed6262fcfe11a",
"score": "0.58146024",
"text": "def solve(a)\n # Complete this function\n $sum_1=0\n for i in (0..a.size/2-1)\n \t#puts \"a->#{a[i]}\"\n \t$sum_1=$sum_1+a[i]\n\n end\n #puts $sum\n $sum_2=0\n for i in (a.size/2..a.size-1)\n \t#puts \"b->#{a[i]}\"\n $sum_2=$sum_2+a[i]\n end\n #puts $sum\n $temp=$sum_1-$sum_2\n if $temp < 0\n \treturn $temp*-1\n else\n \treturn $temp\n end\n\nend",
"title": ""
},
{
"docid": "d03588aa68750f6833edf819df1446ea",
"score": "0.58040524",
"text": "def get_challenge_answer(var1)\n string = '' + var1\n array = string.split('')\n array = array.reverse\n last_digit = array[0].to_i\n array = array.sort\n min_digit = array[0].to_i\n subvar1 = (2 * array[2].to_i) + (array[1].to_i)\n subvar2 = (2 * array[2].to_i).to_s + array[1]\n power = ((array[0].to_i * 1) + 2) ** array[1].to_i\n x = (var1.to_i * 3 + subvar1)\n y = Math.cos(Math::PI * subvar1)\n answer = x * y\n answer -= power\n answer += (min_digit - last_digit)\n answer = answer.floor.to_s + subvar2\n return answer\nend",
"title": ""
},
{
"docid": "24f189fd6b3cfc4aaa92f93d03441d85",
"score": "0.580116",
"text": "def solution(a)\n zeroes = 0\n passes = 0\n a.each do |c|\n zeroes += 1 if c == 0\n passes += zeroes if c == 1\n return -1 if passes > 1000000000\n end\n passes\nend",
"title": ""
},
{
"docid": "c678e24ba57401e9767d528691bd7aa1",
"score": "0.5792941",
"text": "def solution(a)\n n = a.length\n\n expected_sum = (1 + n) * ( n / 2 )\n if n % 2 != 0\n expected_sum += (n / 2.0).ceil\n end\n\n (expected_sum == a.sum) ? 1 : 0\nend",
"title": ""
},
{
"docid": "ce13cdc311c17978cf37cab76555386d",
"score": "0.5792211",
"text": "def challenge\n end",
"title": ""
},
{
"docid": "afb7c27a8561349d77eac5d9bd751021",
"score": "0.5790967",
"text": "def solution(a)\n # write your code in Ruby 2.2\n east = 0\n pass = 0\n \n a.each do |dir|\n if dir == 0\n east += 1\n else\n pass += east\n return -1 if pass > 1000000000\n end\n end\n \n pass\nend",
"title": ""
},
{
"docid": "285d2e49c760ed24f2673411b06f6a8c",
"score": "0.57891244",
"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": "8933c7f7863d440c3a20f00e217257a0",
"score": "0.5779861",
"text": "def solve\n\tcode = \"intblakernblaketsashleythblakeashleyall\"\n\tcode.gsub!(\"ashley\", \" \")\n\t#inteblakernblaket thblake all\n\tcode.gsub!(\"blake\", \"e\")\n\t#internets the all\n\tstring_password = code.split(\" \")\n\t#string_password = [\"internets\", \"the\", \"all\"]\n\tpassword_decoded = []\n\t#creates a new array\n\tpassword_decoded[2] = string_password[0]\n\t#makes the last thing in password_decoded (\"all\") the first thing in string_password\n\tpassword_decoded[0] = string_password[2]\n\t#makes the first thing in password_decoded (\"internets\") the last thing in string_password\n\tpassword_string = password_decoded.join(\"_\")\n\t#makes password_decoded into a string, separated by understcores and called password_string. \n\t#password_string = \"all_the_internets\"\n\tputs password_string\n\n\n\nend",
"title": ""
},
{
"docid": "2e9fefe8ce8757e331ca784acdfe3ebf",
"score": "0.57622564",
"text": "def problem1(n)\r\n\tsum = 0\r\n\t(0..n-1).each do |num|\r\n\t\tif (num % 3 == 0 or num % 5 == 0)\r\n\t\t\tsum += num\r\n\t\tend\r\n\tend\r\n\tsum\r\nend",
"title": ""
},
{
"docid": "2a39b32806655d53c64ca78880cebe8a",
"score": "0.57561815",
"text": "def solution3\n large_num = 600_851_475_143\n\n i = 2\n\n loop do\n large_num /= i if large_num % i == 0\n i += 1\n break if i > large_num / 2\n end\n\n large_num\nend",
"title": ""
},
{
"docid": "7c89b4b7aba1befe09b838aaf0f6814e",
"score": "0.57484704",
"text": "def solve(str)\n sub_strings_arr = sub_strings(str)\n odds = []\n sub_strings_arr.each do |string|\n odds << string if string.to_i.odd?\n end\n odds.size\nend",
"title": ""
},
{
"docid": "1f0955975a10a26277bd0d9fb51a00f1",
"score": "0.57425183",
"text": "def solution(s)\n t = 0\n (s.length / 3).times do |i|\n slice = s[(3 * i)..(3 * i + 2)]\n t += 1 if slice[0] != 'S'\n t += 1 if slice[1] != 'O'\n t += 1 if slice[2] != 'S'\n end\n t\nend",
"title": ""
},
{
"docid": "4c413e8b2cc7cb09014466191a73a3a9",
"score": "0.57169324",
"text": "def lucky_ticket(number)\n array = number.split('').map(&:to_i)\n if array.length % 2 != 0\n array.delete_at(array.length / 2)\n end\nlength = array.length / 2\nmy_first_array = array.slice(0, length)\nmy_second_array = array.drop(length)\nfirst_num = my_first_array.sum\nsecond_num = my_second_array.sum\n if first_num == second_num\n return true\n else\n return false\n end\n\nend",
"title": ""
},
{
"docid": "184978b34707e2c9d190e35b6305dd56",
"score": "0.571516",
"text": "def solution(n)\n a = n.to_s(2).split('')\n count, start, store = 0,0,0\n a.each do |i|\n start = 1 if i == '1' && count == 0\n count +=1 if i == '0' && start ==1\n if i=='1' && count > 0\n store = count if count > store\n count = 0\n end\n end\n store\nend",
"title": ""
},
{
"docid": "3441f5d1aacccdc4f3182bf058fe9ee2",
"score": "0.57128197",
"text": "def test_5\n assert_equal(solution('777', 0, 0), '777')\n end",
"title": ""
},
{
"docid": "0b38bb1ea09c2dee29f9a700d19ee5cd",
"score": "0.5709124",
"text": "def problem_6\n (1.upto(100).reduce(:+) ** 2 ) - (1..100).inject { |sum, n| sum += n**2 }\nend",
"title": ""
},
{
"docid": "366eb6968dc785625da21e390fe45fba",
"score": "0.5702517",
"text": "def solution(a)\n before_num = 1\n a.sort.each do |num|\n return 0 if before_num != num\n before_num = num + 1\n end\n return 1\nend",
"title": ""
},
{
"docid": "1c498ff5848b8ea7cad89ed3ead7eed4",
"score": "0.5695044",
"text": "def solution(a)\n max = a.length + 1\n (1 + max) * max / 2 - a.inject(0, &:+)\nend",
"title": ""
},
{
"docid": "4b2b30e235e0baf41954bc8fd2f8997e",
"score": "0.5690563",
"text": "def solution(s)\n s = s.codepoints\n r = s.reverse\n ops = 0\n for i in 0..s.length - 1\n if s[i] != r[i]\n ops += (s[i] - r[i]).abs\n break if s == s.reverse\n end\n end\n\n ops / 2\nend",
"title": ""
},
{
"docid": "fbbbcb3b0e2fef3847603a76fc2312d6",
"score": "0.568873",
"text": "def day_1_part_2(sequence)\n sequence_digits = sequence.chars.map(&:to_i)\n sequence_digits_reference = sequence_digits * 2\n\n sum = 0\n\n sequence_digits.each.with_index do |digit, i|\n sum += digit if digit == sequence_digits_reference[i + sequence.length / 2]\n end\n\n sum\nend",
"title": ""
},
{
"docid": "40cb9f8c3ff102d8b58881d3ed326bd7",
"score": "0.5684117",
"text": "def problem_8\n num = \"7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450\"\n greatest_product = 1\n new_product = 1\n index = 0\n while index <= num.length - 5\n num[index, 5].chars.each { |z| new_product *= z.to_i }\n if new_product >= greatest_product\n greatest_product = new_product\n new_product = 1\n index += 1\n else\n new_product = 1\n index += 1\n end\n end\n greatest_product\nend",
"title": ""
},
{
"docid": "6125bfd7debc7af3d6a8a4bffb8ddc0a",
"score": "0.56833047",
"text": "def solution(n)\n # write your code in Ruby 2.2\n b = n.to_s(2)\n a = []\n incr = 0\n s = false\n b.each_char do |char|\n if char == '1'\n if s\n a.push(incr)\n incr = 0\n\n else\n s = true\n end\n else\n incr += 1\n end \n end\n a.max || 0\nend",
"title": ""
},
{
"docid": "59b3a4fb496142746f44dbd9148e3ed6",
"score": "0.5682422",
"text": "def find_palindrome(string)\n #\\s, space and comma. \\! exclamation mark. \\- hyphen\n #replace to \"\" meaning no space, comma, ! and hyphen\n str = string.gsub(/[\\s,\\!\\-]/ ,\"\").downcase\n\n #divide string to two and compare first and second half of string.\n #preperation\n median = str.length / 2\n #get the first half of string. slice(index,length)\n first_half_str = str.slice(0,median)\n #get second half\n second_half_str = str.slice(median, str.length)\n revised_second_half_str = second_half_str.reverse\n\n #change strig to array and split to character to compare if there are duplicate character (we use uniq to get unique character)\n arr1 = first_half_str.split(\"\").to_a\n arr2 = first_half_str.split(\"\").to_a.uniq\n\n #check if first_half_str & second_half_str have same character.\n #if character is duplicate, output error message\n\n #when string.length is even number\n if str.length.even?\n if first_half_str == revised_second_half_str\n if arr1 != arr2\n puts \"#{string} has more than two same characters!\"\n else\n puts \"Yes, #{string} is a palindrome.\"\n end\n\n\n #if the above is incorrect, output error message\n elsif first_half_str != revised_second_half_str\n puts \"#{string} is not palindrome!\"\n end\n\n #when string is odd. *if odd, string.length is rounddown\n elsif str.length.odd?\n #get last character *str[start, length]. -1 means last character\n last_char = revised_second_half_str[-1, 1]\n #remove last character\n second = revised_second_half_str.chomp(last_char)\n #now compare if first half and new second half has same character\n if first_half_str == second\n if arr1 != arr2\n puts \"#{string} has more than two same characters!\"\n else\n puts \"Yes, #{string} is a palindrome.\"\n end\n\n #if the above is incorrect, output error message\n elsif first_half_str != second\n puts \"#{string} is not palindrome!\"\n end\n\n end\n\nend",
"title": ""
},
{
"docid": "eda747fe4aa95ca303208ac6cbacfbab",
"score": "0.56813604",
"text": "def solution\n\n d8_10s = []\n d7_10s = []\n d6_10s = []\n d5_10s = []\n d4_10s = []\n d3_10s = []\n d2_10s = []\n d1_10s = []\n 17.step(987, 17) do |n| \n n = n.to_s.split(\"\").to_a\n n = [\"0\"] + n if n.count == 2\n d8_10s << n if n.count == n.uniq.count\n end\n \n d8_10s.uniq.each do |d8_10|\n d8_10[0..1].join.to_i.step(987, 100) do |n|\n d7 = (n/100).to_s\n if n % 13 == 0 && !d8_10.include?(d7)\n d7_10s << [d7] + d8_10\n end\n end\n end\n\n \n d7_10s.uniq.each do |d7_10|\n d7_10[0..1].join.to_i.step(987, 100) do |n|\n d6 = (n/100).to_s\n if n % 11 == 0 && !d7_10.include?(d6)\n d6_10s << [d6] + d7_10\n end\n end\n end\n \n d6_10s.uniq.each do |d6_10|\n d6_10[0..1].join.to_i.step(987, 100) do |n|\n d5 = (n/100).to_s\n if n % 7 == 0 && !d6_10.include?(d5)\n d5_10s << [d5] + d6_10\n end\n end\n end\n \n d5_10s.uniq.each do |d5_10|\n d5_10[0..1].join.to_i.step(987, 100) do |n|\n d4 = (n/100).to_s\n if n % 5 == 0 && !d5_10.include?(d4)\n d4_10s << [d4] + d5_10\n end\n end\n end\n \n d4_10s.uniq.each do |d4_10|\n d4_10[0..1].join.to_i.step(987, 100) do |n|\n d3 = (n/100).to_s\n if n % 3 == 0 && !d4_10.include?(d3)\n d3_10s << [d3] + d4_10\n end\n end\n end\n \n d3_10s.uniq.each do |d3_10|\n d3_10[0..1].join.to_i.step(987, 100) do |n|\n d2 = (n/100).to_s\n if n % 2 == 0 && !d3_10.include?(d2)\n d2_10s << [d2] + d3_10\n end\n end\n end\n\n d2_10s.uniq.each do |d2_10|\n 10.times do |d1|\n if !d2_10.include?(d1.to_s)\n d1_10s << ([d1] + d2_10).join.to_i\n end\n end\n end\n \n d1_10s\nend",
"title": ""
},
{
"docid": "537891b880848a8f972781ece5050924",
"score": "0.56786215",
"text": "def part2(input)\n sum = 0\n input.split('').each_index do |i|\n next_i = (input.length / 2) + i\n if next_i > input.length-1\n next_i -= input.length\n end\n\n if input[i] == input[next_i]\n sum += input[i].to_i\n end\n end\n puts sum\nend",
"title": ""
},
{
"docid": "41d8272b7c7b14be391f11bb61b8cafe",
"score": "0.56707454",
"text": "def solution(a)\n # write your code in Ruby 2.2\n \n counter = 0\n\ttotal = 0\n\t\n\ta.each do |car|\n\t\tcar == 0 ? counter += 1 : total += counter\n\tend\n\t\n\treturn total > 1_000_000_000 ? -1 : total\nend",
"title": ""
},
{
"docid": "243595c427d1899b0e72093e3e77655e",
"score": "0.56683004",
"text": "def problem_13\n n = %w{\n 37107287533902102798797998220837590246510135740250\n 46376937677490009712648124896970078050417018260538\n 74324986199524741059474233309513058123726617309629\n 91942213363574161572522430563301811072406154908250\n 23067588207539346171171980310421047513778063246676\n 89261670696623633820136378418383684178734361726757\n 28112879812849979408065481931592621691275889832738\n 44274228917432520321923589422876796487670272189318\n 47451445736001306439091167216856844588711603153276\n 70386486105843025439939619828917593665686757934951\n 62176457141856560629502157223196586755079324193331\n 64906352462741904929101432445813822663347944758178\n 92575867718337217661963751590579239728245598838407\n 58203565325359399008402633568948830189458628227828\n 80181199384826282014278194139940567587151170094390\n 35398664372827112653829987240784473053190104293586\n 86515506006295864861532075273371959191420517255829\n 71693888707715466499115593487603532921714970056938\n 54370070576826684624621495650076471787294438377604\n 53282654108756828443191190634694037855217779295145\n 36123272525000296071075082563815656710885258350721\n 45876576172410976447339110607218265236877223636045\n 17423706905851860660448207621209813287860733969412\n 81142660418086830619328460811191061556940512689692\n 51934325451728388641918047049293215058642563049483\n 62467221648435076201727918039944693004732956340691\n 15732444386908125794514089057706229429197107928209\n 55037687525678773091862540744969844508330393682126\n 18336384825330154686196124348767681297534375946515\n 80386287592878490201521685554828717201219257766954\n 78182833757993103614740356856449095527097864797581\n 16726320100436897842553539920931837441497806860984\n 48403098129077791799088218795327364475675590848030\n 87086987551392711854517078544161852424320693150332\n 59959406895756536782107074926966537676326235447210\n 69793950679652694742597709739166693763042633987085\n 41052684708299085211399427365734116182760315001271\n 65378607361501080857009149939512557028198746004375\n 35829035317434717326932123578154982629742552737307\n 94953759765105305946966067683156574377167401875275\n 88902802571733229619176668713819931811048770190271\n 25267680276078003013678680992525463401061632866526\n 36270218540497705585629946580636237993140746255962\n 24074486908231174977792365466257246923322810917141\n 91430288197103288597806669760892938638285025333403\n 34413065578016127815921815005561868836468420090470\n 23053081172816430487623791969842487255036638784583\n 11487696932154902810424020138335124462181441773470\n 63783299490636259666498587618221225225512486764533\n 67720186971698544312419572409913959008952310058822\n 95548255300263520781532296796249481641953868218774\n 76085327132285723110424803456124867697064507995236\n 37774242535411291684276865538926205024910326572967\n 23701913275725675285653248258265463092207058596522\n 29798860272258331913126375147341994889534765745501\n 18495701454879288984856827726077713721403798879715\n 38298203783031473527721580348144513491373226651381\n 34829543829199918180278916522431027392251122869539\n 40957953066405232632538044100059654939159879593635\n 29746152185502371307642255121183693803580388584903\n 41698116222072977186158236678424689157993532961922\n 62467957194401269043877107275048102390895523597457\n 23189706772547915061505504953922979530901129967519\n 86188088225875314529584099251203829009407770775672\n 11306739708304724483816533873502340845647058077308\n 82959174767140363198008187129011875491310547126581\n 97623331044818386269515456334926366572897563400500\n 42846280183517070527831839425882145521227251250327\n 55121603546981200581762165212827652751691296897789\n 32238195734329339946437501907836945765883352399886\n 75506164965184775180738168837861091527357929701337\n 62177842752192623401942399639168044983993173312731\n 32924185707147349566916674687634660915035914677504\n 99518671430235219628894890102423325116913619626622\n 73267460800591547471830798392868535206946944540724\n 76841822524674417161514036427982273348055556214818\n 97142617910342598647204516893989422179826088076852\n 87783646182799346313767754307809363333018982642090\n 10848802521674670883215120185883543223812876952786\n 71329612474782464538636993009049310363619763878039\n 62184073572399794223406235393808339651327408011116\n 66627891981488087797941876876144230030984490851411\n 60661826293682836764744779239180335110989069790714\n 85786944089552990653640447425576083659976645795096\n 66024396409905389607120198219976047599490197230297\n 64913982680032973156037120041377903785566085089252\n 16730939319872750275468906903707539413042652315011\n 94809377245048795150954100921645863754710598436791\n 78639167021187492431995700641917969777599028300699\n 15368713711936614952811305876380278410754449733078\n 40789923115535562561142322423255033685442488917353\n 44889911501440648020369068063960672322193204149535\n 41503128880339536053299340368006977710650566631954\n 81234880673210146739058568557934581403627822703280\n 82616570773948327592232845941706525094512325230608\n 22918802058777319719839450180888072429661980811197\n 77158542502016545090413245809786882778948721859617\n 72107838435069186155435662884062257473692284509516\n 20849603980134001723930671666823555245252804609722\n 53503534226472524250874054075591789781264330331690}.reduce(0) do |a,v|\n a + v.to_i\n end.to_s[0,10]\nend",
"title": ""
},
{
"docid": "a16e6337362dc31c74a4ecaa69504cdd",
"score": "0.56677634",
"text": "def solution(a, b)\r\n p a+b+a if b.length > a.length\r\n p b+a+b if a.length > b.length \r\n \r\nend",
"title": ""
},
{
"docid": "ebe5a0091303805783ef29b8c45ffb08",
"score": "0.5664327",
"text": "def pe43()\ntotal = 0\narr = [0,1,2,3,4,5,6,7,8,9].permutation\narr.each do |e|\n\tif(e[1..3].join.to_i % 2 != 0) then next end\n\tif(e[2..4].join.to_i % 3 != 0) then next end \n\tif(e[3..5].join.to_i % 5 != 0) then next end \n\tif(e[4..6].join.to_i % 7 != 0) then next end \n\tif(e[5..7].join.to_i % 11 != 0) then next end \n\tif(e[6..8].join.to_i % 13 != 0) then next end \n\tif(e[7..9].join.to_i % 17 != 0) then next end\n\tprintf \"answer %s\\n\", e\n\ttotal += e.join.to_i\n\t#p e\n\tend\n\tprintf \"the total is %d\\n\", total\nend",
"title": ""
},
{
"docid": "5a509be2774579f47c484b2f6b4bc489",
"score": "0.5663501",
"text": "def poker_hand(cards)\n cards_array = cards.delete(\" \").split(\"\")\n # Convert Jack, Queen, King and Ace into numbers and changes 10 from \"1\", \"0\" to \"10\"\n pictures = { \"T\" => \"10\",\n \t\t\t\t\"J\" => \"11\",\n \t\t\t\t\"Q\" => \"12\",\n \t\t\t\t\"K\" => \"13\",\n \t\t\t\t\"A\" => \"14\" }\n cards_array = cards_array.map do |i|\n if pictures[i]\n if pictures[i] == \"0\"\n nil\n end\n pictures[i]\n else\n i\n end\n end\n # Deletes spare \"0\" emanating from the \"10\"\n cards_array.delete(\"0\")\n# p cards_array\n \n # Finds highest card\n highest = 0\n (0..8).step(2) do |i|\n if cards_array[i].to_i > highest then highest = cards_array[i].to_i end\n end\n \n # Test \"Straight Flush\" and does check for \"Straight\" and \"Flush\"\n straight = false\n flush = false\n \n# Flush part \n check = []\n (1..9).step(2) do |i|\n if cards_array[i] == cards_array[1]\n if i == 9 then flush = true end\n else\n break\n end\n end\n\n# Straight part \n last_card = 0\n (0..8).step(2) do |i|\n if i == 0\n last_card = cards_array[i]\n puts last_card\n next\n end\n if cards_array[i].to_i != last_card.to_i + 1\n break\n end\n last_card = cards_array[i]\n if i == 8 then straight = true end\n end\n \n if straight == true and flush == true \n return \"Straight Flush\" + \"-\" + highest.to_s\n end\n \n # Test \"Four of a kind\"\n check = []\n (0..8).step(2) do |i|\n check << cards_array[i]\n if check.count(cards_array[i]) == 4\n return \"Four of a kind\" + \"-\" + cards_array[i]\n end\n end\n \n # Test \"Full House\" - First tests \"Three of a kind\", if true, tests the other two cards\n # if they are a pair.\n check = []\n toak = false\t# toak is Three Of A Kind\n toak_i = 0\n (0..8).step(2) do |i|\n check << cards_array[i]\n if check.count(cards_array[i]) == 3\n toak_i = cards_array[i]\n toak = true\n end\n end\n \n if toak == true\n check.delete(toak_i.to_s)\n if check[0] == check[1]\n return \"Full House\" + \"-\" + highest.to_s\n end\n end\n \n # Test \"Flush\" - checks that the cards are all same as first card\n if flush == true \n return \"Flush\" + \"-\" + highest.to_s\n end\n \n # Test \"Straight\"\n if straight == true \n return \"Straight\" + \"-\" + highest.to_s\n end\n \n # Test \"Three of a kind\"\n if toak == true\n return \"Three of a kind\" + \"-\" + toak_i.to_s\n end\n \n # Test \"Two Pair\"\n check = []\n n = 0\n (0..8).step(2) do |i|\n check << cards_array[i]\n if check.count(cards_array[i]) == 2\n n += 1\n if n == 2\n return \"Two Pair\" + \"-\" + cards_array[i]\n end\n end\n end\n \n # Test \"Pair\"\n check = []\n (0..8).step(2) do |i|\n check << cards_array[i]\n if check.count(cards_array[i]) == 2\n return \"Pair\" + \"-\" + cards_array[i]\n end\n end\n \n # Default is high card\n \"High Card\" + \"-\" + highest.to_s\nend",
"title": ""
},
{
"docid": "4dfe50426435b1cf94c032b24eb333cc",
"score": "0.5663256",
"text": "def solution(n)\n n = n >> 1 while n % 2 == 0\n n.to_s(2).split('1').push('').max_by(&:size).size \nend",
"title": ""
},
{
"docid": "ead8d32b70be82868d2fbe2a8e6641f9",
"score": "0.5661925",
"text": "def problem_4(digits = 3)\n s = 10**digits - 1\n t = s/10 + 1\n s.downto(t) do |n|\n r = (n.to_s + n.to_s.reverse).to_i\n s.downto(t) do |div|\n break if (r / div) > s\n return(r) if (r % div).zero?\n end\n end\n return(0)\nend",
"title": ""
},
{
"docid": "f510e17a48225d5927d1023e11c95c83",
"score": "0.5658788",
"text": "def problem55\n count = 0\n 10000.downto(1) do |x|\n isLychrel = true\n num = x\n 50.downto(1) do |n|\n num += num.to_s.reverse.to_i\n if isPalindrome(num)\n isLychrel = false\n break\n end\n end\n count += 1 if isLychrel\n count\n end\n count\nend",
"title": ""
},
{
"docid": "fc35b048eb13fc75ee083d79e84ff6a6",
"score": "0.56534916",
"text": "def thirt(n)\n # your code\n remainders = [1, 10, 9, 12, 3, 4]\n rlen = 6\n num = n\n result = 0\n result_arr = []\n loop do \n num_arr = num.to_s.split('').map { |i| i.to_i}\n while remainders.length <= num_arr.length do \n remainders << (10 ** rlen) % 13\n rlen += 1\n end\n x = 0\n y = num_arr.length - 1\n temp = []\n while x < remainders.length && y >= 0 do \n temp_num = remainders[x] * num_arr[y]\n temp << temp_num\n x += 1\n y -= 1\n end\n num = temp.reduce(:+)\n if num == result_arr[-1]\n result = num \n break\n end\n result_arr << num\n end\n result \nend",
"title": ""
},
{
"docid": "48f6ccd13854a541bfcb18ff7c741f02",
"score": "0.56514347",
"text": "def part1(input)\n twos = threes = 0\n\n # For each ID, bucket each char and count their instances within the ID.\n # Originally, I'd tried to sort the chars and use a regex, but getting\n # around the awkwardness of backtracking and detecting the twos that aren't\n # also threes (or more) wasn't worth the effort on this exercise.\n input.each do |id|\n counts = id.chars.group_by(&:to_s).values.map(&:size)\n\n twos += 1 if counts.include?(2)\n threes += 1 if counts.include? (3)\n end\n\n return twos * threes\nend",
"title": ""
},
{
"docid": "dc068d858bf0570d30ec6c9f4f8f3b8c",
"score": "0.5650425",
"text": "def problem14\n starter, high = 3, 0\n 3.upto(999999) { |x|\n if !( x % 2 == 0 )\n temp = x\n count = 0\n until x == 1\n if x % 2 == 0\n x /= 2\n else\n x = x * 3 + 1\n end\n count += 1\n end\n if count > high\n starter, high = temp, count\n end\n end\n }\n starter\nend",
"title": ""
},
{
"docid": "cef825fbfb3afa754f79670aa333d6ef",
"score": "0.56484234",
"text": "def solution(a)\n east = 0\n west = 0\n passing = 0\n for i in a\n case i\n when 0\n east += 1\n when 1\n west += 1\n passing += east\n end\n return -1 if passing > 1_000_000_000\n end\n passing\nend",
"title": ""
},
{
"docid": "e2bd40c8e8e96a24f7c5942dfe8a4e02",
"score": "0.564707",
"text": "def solution(str)\n arr = str.split(\"\")\n new_arr = []\n if arr.length % 2 == 0\n z = arr.length / 2\n for x in (0...z) do\n new_arr << arr.shift(2).join\n end\n else\n z = arr.length / 2\n for x in (0...z) do\n new_arr << arr.shift(2).join\n end\n new_arr << \"#{arr[0]}_\"\n end\n new_arr\nend",
"title": ""
},
{
"docid": "4a4eefe9eb4327fd1f51637a3d87b34e",
"score": "0.56443906",
"text": "def solution(a)\n a2 = (1..(a.size+1)).to_a\n r = a2-a\n return r.join(\"\").to_i\nend",
"title": ""
},
{
"docid": "dd37cbf0e30ea40cbc34d6ebf39feefe",
"score": "0.56394213",
"text": "def solve(s)\n letters = s.split(/[aeiou]/)\n alphabet = ('a'..'z')\n letters_and_numbers = Hash.new\n \n alphabet.each_with_index do |letter, index|\n letters_and_numbers[letter] = index + 1\n end\n \n letters.map! do |letter|\n if letter.length.eql?(1)\n letters_and_numbers[letter.downcase]\n else\n letter.chars.map do |split_letter|\n letters_and_numbers[split_letter]\n end.sum\n end\n end\n \n letters.sort.pop\n \nend",
"title": ""
},
{
"docid": "082f71904c5f076c9ac9f24d2e615d6e",
"score": "0.56349105",
"text": "def find(digits)\n # Generated by gen14.rb\n # 371010124515891677925107\n prefixes = [\n [3, 1, 1, 4, 9], # 0\n [7, 5, 6, 0], # 1\n [1, 1, 1, 4, 9], # 2\n [0, 1, 1, 4, 9], # 3\n [1, 1, 4, 9], # 4\n [0, 1, 4, 9], # 5\n [1, 4, 9], # 6\n [2, 1, 8, 1], # 7\n [4, 9], # 8\n [5, 6, 0], # 9\n ].map(&:freeze).freeze\n suffix = [7]\n\n # first starts at 4\n first_on_suffix = false\n first_track = prefixes[0]\n first_pos = 1\n # second starts at 13\n second_on_suffix = false\n second_track = prefixes[0]\n second_pos = 4\n\n size = 24\n next_write = 31\n\n # state_transitions: good_digits -> new_digit -> Integer (new_good_digits)\n # It's expected that we'll then index into state_transitions with new_good_digits.\n #\n # Let's skip that extra indexing and precompute it, with:\n # next_state: good_digits -> new_digit -> Array (new_digit -> Array)\n #\n # As can be seen, this will be a self-referential structure.\n # When the result is nil, we have all the digits.\n next_state = Array.new(digits.size) { [] }\n next_state.zip(state_transitions(digits)) { |dst, src|\n src.each_with_index { |new_good_digits, i|\n dst[i] = next_state[new_good_digits]\n }\n }\n next_state.each(&:freeze).freeze\n state = next_state[0]\n\n score1 = first_track[first_pos]\n score2 = second_track[second_pos]\n\n # while true is faster than loop\n # https://github.com/JuanitoFatas/fast-ruby#loop-vs-while-true-code\n while true\n new_score = score1 + score2\n\n # Normally, you'd write new_scores = new_score >= 10 ? new_score.divmod(10) : [new_score]\n # and then iterate over new_scores.\n # Instead, here we manually unroll that loop.\n # Unfortunately, the fastest way was code duplication.\n\n if new_score >= 10\n new_score -= 10\n return size + 1 - digits.size unless (state = state[1])\n if size == next_write\n suffix << 1\n next_write += 2\n end\n size += 1\n end\n\n return size + 1 - digits.size unless (state = state[new_score])\n if size == next_write\n suffix << new_score\n next_write += 1 + new_score\n end\n size += 1\n\n unless (score1 = first_track[first_pos += 1])\n first_pos = 0\n if first_on_suffix\n first_track = prefixes[next_write - size]\n first_on_suffix = false\n else\n first_track = suffix\n first_on_suffix = true\n end\n score1 = first_track[0]\n end\n unless (score2 = second_track[second_pos += 1])\n second_pos = 0\n if second_on_suffix\n second_track = prefixes[next_write - size]\n second_on_suffix = false\n else\n second_track = suffix\n second_on_suffix = true\n end\n score2 = second_track[0]\n end\n end\nend",
"title": ""
},
{
"docid": "e4bf969521382732ac79be40ffa78c87",
"score": "0.56339926",
"text": "def solution(a)\r\n ones=0\r\n temp=0\r\n ans=0\r\n for i in 0...a.size\r\n if a[i]==1\r\n ones+=1\r\n end\r\n end\r\n \r\n for i in 0...a.size\r\n if a[i]==1\r\n temp+=1\r\n else\r\n ans+=(ones-temp)\r\n end\r\n end\r\n \r\n if ans>1000000000\r\n return -1\r\n else\r\n return ans\r\n end\r\n \r\n \r\nend",
"title": ""
},
{
"docid": "a24452c1df10eea474e37de3cf864148",
"score": "0.56295246",
"text": "def solution_8\n digits = \n \"73167176531330624919225119674426574742355349194934 \n 96983520312774506326239578318016984801869478851843 \n 85861560789112949495459501737958331952853208805511 \n 12540698747158523863050715693290963295227443043557 \n 66896648950445244523161731856403098711121722383113 \n 62229893423380308135336276614282806444486645238749 \n 30358907296290491560440772390713810515859307960866 \n 70172427121883998797908792274921901699720888093776 \n 65727333001053367881220235421809751254540594752243 \n 52584907711670556013604839586446706324415722155397 \n 53697817977846174064955149290862569321978468622482 \n 83972241375657056057490261407972968652414535100474 \n 82166370484403199890008895243450658541227588666881 \n 16427171479924442928230863465674813919123162824586 \n 17866458359124566529476545682848912883142607690042 \n 24219022671055626321111109370544217506941658960408 \n 07198403850962455444362981230987879927244284909188 \n 84580156166097919133875499200524063689912560717606 \n 05886116467109405077541002256983155200055935729725 \n 71636269561882670428252483600823257530420752963450\" \n digits.gsub!(/[\\t\\n]/, '')\n \n elements = []\n digits = digits.split(//)\n digits.each_index do |i|\n product = 1\n digits[i..i+4].each { |e| product *= e.to_i }\n elements.push(product)\n end\n \n elements.max\n end",
"title": ""
},
{
"docid": "f149630ed06e7f3087e493b8c95e555b",
"score": "0.5627782",
"text": "def funny string\n count, arr = 0, string.chars\n arr.each_with_index do |x,xi|\n if xi > 0\n s1 = (x.ord - arr[xi-1].ord).abs\n s2 = (arr[-(xi+1)].ord - arr[-xi].ord).abs\n s1 == s2 ? count +=1 : break\n end\n end\n puts count == arr.size - 1 ? 'Funny' : 'Not Funny'\nend",
"title": ""
},
{
"docid": "66d495e07fdd58c7531e7240bd3ffb30",
"score": "0.5623667",
"text": "def problem92\n count = 0\n 10000000.downto(1) do |n|\n #puts n\n ds = n\n stop = false\n while !stop\n sum = 0\n ds.to_s.split('').each do |d|\n sum += d.to_i*d.to_i\n end\n ds = sum\n if ds == 89\n puts \"89\"\n count += 1\n stop = true\n elsif ds == 1\n puts \"1\"\n stop = true\n end\n end\n end\n count\nend",
"title": ""
},
{
"docid": "cac98559ca8f0df3931c4ffcabb41db7",
"score": "0.56218296",
"text": "def solution(s)\n if s.size.odd?\n s.scan(/../) + [s[-1]+'_'] # .. returns an array that each element is 2 chars of string\n else\n s.scan(/../)\n end\nend",
"title": ""
},
{
"docid": "aaf33a3cff1b10cbb9449e7797d14a1e",
"score": "0.56193304",
"text": "def problem_4\n def palindrome?(n)\n n.to_s == n.to_s.reverse\n end\n\n max = 0 \n 100.upto(999).each do |a|\n a.upto(999).each { |b| max = a * b if palindrome?(a * b) && (a * b) > max }\n end\n max\nend",
"title": ""
},
{
"docid": "7dde28350a3c2b5e3358467f6ee2d9e0",
"score": "0.56182873",
"text": "def solution(n)\n # Code here...\n str = []\n (1..n).each { |a| str << a } \n \n a = str.join(\"\")\n \n b = a.split(\"\")\n \n int_array = b.map(&:to_i)\n \n return int_array.sum \nend",
"title": ""
},
{
"docid": "578a4c2088c4d8ec64fbe2465745ad9e",
"score": "0.56158066",
"text": "def solution(a)\r\n # write your code in Ruby 2.2\r\n #0 -east\r\n #1 - west\r\n \r\n\r\n\r\n arr=[]\r\n n=0\r\n a.each_with_index{|el,i|\r\n \r\n if(el==0)\r\n j=i\r\n loop do\r\n if (a[j] == 1)\r\n n+=1\r\n end\r\n \r\n j+=1 \r\n break if j==a.count \r\n end\r\n \r\n end\r\n \r\n }\r\n \r\n n\r\nend",
"title": ""
},
{
"docid": "597abb7cfee605592beed9f2aebab238",
"score": "0.5611049",
"text": "def solution(n)\n total = 0\n\n i = 1\n while i * i < n\n total += 2 if n % i == 0\n i += 1\n end\n total += 1 if i * i == n\n\n total\nend",
"title": ""
},
{
"docid": "756762389eed8ab63adfac2a2bb4011a",
"score": "0.55982256",
"text": "def solution(number)\r\n num= (1..number-1).to_a\r\n arry=[]\r\n for i in num \r\n if i % 3 == 0 or i % 5 == 0\r\n arry << i \r\n end\r\n end\r\n p arry.sum \r\nend",
"title": ""
}
] |
e1ced019a5dc1836fc65dd435d40fdac
|
Return the array of account box items
|
[
{
"docid": "9ee6db05f25fce4f36eb3defcd7d6636",
"score": "0.786853",
"text": "def sidebar_account_box_items()\n sidebar_box_items_by_id(\"account\")\n end",
"title": ""
}
] |
[
{
"docid": "6a599e611231f762be7ea25f8b4e1fdf",
"score": "0.67195636",
"text": "def accounts\n []\n end",
"title": ""
},
{
"docid": "dd3a946f21d0cfeae107637c7b9c9c65",
"score": "0.6557076",
"text": "def items\n Item.where(box: name)\n end",
"title": ""
},
{
"docid": "745000d6f62757893b374155dcce230b",
"score": "0.6197681",
"text": "def getAccounts\n return @accounts\n\n end",
"title": ""
},
{
"docid": "33761e8a893bd1d6e6d0181b96eeecc9",
"score": "0.6171958",
"text": "def accounts\n return @accounts if @accounts\n @accounts = []\n\n begin\n # lots of spaces, tabs and the #00A0 characters, so extract\n # text with this extraneous junk suppressed.\n tables = accounts_summary_document.xpath(\"//table\")\n account_tables = tables.map do |table|\n rows = table.xpath(\".//tr\").map{|row| row.xpath(\".//td|.//th\").\n map{|cell| cell.text.strip.gsub(/\\s+|\\t/, \" \")}}\n end.reject{|table| promo_table? table }\n\n # Turn tablular data into Account classes\n account_tables.map do |table|\n\n # the header row tells us what kind of account we're looking at\n header = table.shift\n account_type = decipher_account_type header[0]\n has_account_number = header[1] =~ /Account/\n\n # ignore balance rows at bottom of tables\n rows = table.reject{|row| balance_row? row }\n\n # turn those rows into accounts\n rows.each do |row|\n name = sanitize(row.shift)\n number = (has_account_number ? sanitize(row.shift) : nil)\n if number.nil? || name =~ /(\\.{4})(\\d+)\\Z/\n number = name.match(/(\\.{4})(\\d+)\\Z/).captures.join\n name = name.gsub(number,'')\n end\n balance = row.shift\n available = row.shift || balance\n @accounts << Account.new(account_type, name, number, balance, available)\n end\n end\n rescue Exception => error\n connection.save_screenshot('log/accounts.png')\n error.backtrace.each { |line| puts line }\n raise\n end\n\n return @accounts\n end",
"title": ""
},
{
"docid": "01cd0a35483fdab2bb74f20cb6ece540",
"score": "0.6171892",
"text": "def get_accounts\n @accts\n end",
"title": ""
},
{
"docid": "9e3548359979717ea321036aef349fa4",
"score": "0.6145811",
"text": "def fetch_items_of(account_id)\r\n fail \"No account with id #{account_id}\" unless self.accounts.member?(account_id)\r\n self.items.values.select {|item| item.owner.id == account_id}\r\n end",
"title": ""
},
{
"docid": "426e24fe20cedf378466e188faad98b7",
"score": "0.6098866",
"text": "def accounts\n make_promise(@core.web3.JS[:personal], 'getListAccounts')\n end",
"title": ""
},
{
"docid": "9e81650e3c43c77211cd5320f5edc699",
"score": "0.6094074",
"text": "def accounts\n @accounts ||= []\n end",
"title": ""
},
{
"docid": "9e55c1b8224c6fcc05965cae3ab35c07",
"score": "0.60751873",
"text": "def get_item_list\n arr = []\n @transaction.items.each do |item|\n # activate this later\n # arr << { name: item.name, price: item.price, currency: item: currency, quantity: item.quantity }\n end\n end",
"title": ""
},
{
"docid": "ceb845aad36d76a614d9a86ac8775ab3",
"score": "0.6071388",
"text": "def items\n invoice_items.map { |invoice_item| invoice_item.item }\n end",
"title": ""
},
{
"docid": "09cb3e56b7c2da490d983eef373be490",
"score": "0.6066959",
"text": "def get_account_list\n account_list = api(\"GetAccountList\")\n account_list.split(\";\")\n end",
"title": ""
},
{
"docid": "bfe296c7f7dafd101c9ab29d099242bc",
"score": "0.6064755",
"text": "def get_all_item_borrowers\n @all_item_borrowers = Array.new\n item_transactions = @item.transactions\n item_transactions.each do |transaction|\n if(transaction.isApproved == 1 && transaction.isReturned == 1)\n @all_item_borrowers << transaction.borrower\n end\n end\n return @all_item_borrowers\n end",
"title": ""
},
{
"docid": "deee040e2a42650aa1cb99f11306120c",
"score": "0.6062502",
"text": "def accounts\n get_collection 'accounts', :class => Buxfer::Account\n end",
"title": ""
},
{
"docid": "6afacf27b8e54230d300b643ca0e3dda",
"score": "0.604652",
"text": "def box_names\n response = RestClient.get \"https://vagrantcloud.com/api/v1/user/#{@name}\",\n 'access_token' => @token\n\n names = []\n obj = JSON.parse(response)\n for box in obj['boxes']\n names << { name: box['name'], tag: box['tag'] }\n end\n\n return names\n end",
"title": ""
},
{
"docid": "5ba3b00cc361ed1f224039dc096e84fa",
"score": "0.60270995",
"text": "def sidebar_account_box()\n sidebar_box_by_id(\"account\")\n end",
"title": ""
},
{
"docid": "5ba3b00cc361ed1f224039dc096e84fa",
"score": "0.60270995",
"text": "def sidebar_account_box()\n sidebar_box_by_id(\"account\")\n end",
"title": ""
},
{
"docid": "7c750a9b0696040ac4d6ea7b89e50189",
"score": "0.6008481",
"text": "def items\n @items\n end",
"title": ""
},
{
"docid": "7c750a9b0696040ac4d6ea7b89e50189",
"score": "0.6008481",
"text": "def items\n @items\n end",
"title": ""
},
{
"docid": "7c750a9b0696040ac4d6ea7b89e50189",
"score": "0.6008481",
"text": "def items\n @items\n end",
"title": ""
},
{
"docid": "7c750a9b0696040ac4d6ea7b89e50189",
"score": "0.6008481",
"text": "def items\n @items\n end",
"title": ""
},
{
"docid": "202edaeb7898864c967fa27c6a45c2d5",
"score": "0.5991609",
"text": "def index\n authorize Box, :index?\n @boxes = current_user.boxes\n end",
"title": ""
},
{
"docid": "d9d1b77518640d8e13f428d9f184129b",
"score": "0.59672886",
"text": "def get_accounts\n response = access_token.get(\"https://launchpad.37signals.com/authorization.json\")\n JSON.parse(response.body)[\"accounts\"].select { |account| account[\"product\"] == \"bcx\" }\n rescue => ex\n Basecamp::Error.new(ex.message).raise_exception\n end",
"title": ""
},
{
"docid": "c75cf2ebaf7a1d99ab1997bdf416a0f5",
"score": "0.595897",
"text": "def items_array\n array = []\n self.excerpts.each do |object|\n array.push object\n end\n self.quotes.each do |object|\n array.push object\n end\n self.terms.each do |object|\n array.push object\n end\n self.people.each do |object|\n array.push object\n end\n return array\n end",
"title": ""
},
{
"docid": "c75cf2ebaf7a1d99ab1997bdf416a0f5",
"score": "0.595897",
"text": "def items_array\n array = []\n self.excerpts.each do |object|\n array.push object\n end\n self.quotes.each do |object|\n array.push object\n end\n self.terms.each do |object|\n array.push object\n end\n self.people.each do |object|\n array.push object\n end\n return array\n end",
"title": ""
},
{
"docid": "20a5a94c507b92d4bfc2a9260ab32c4e",
"score": "0.5957092",
"text": "def index\n @boxes = Box.where(user_id: current_user.id)\n end",
"title": ""
},
{
"docid": "f840b9badc071afe76472299544b222a",
"score": "0.59204113",
"text": "def index\n @ebay_accounts = current_user.ebay_accounts.all\n end",
"title": ""
},
{
"docid": "45f504fceda3decb47d81987b6ae4b2c",
"score": "0.5909176",
"text": "def get_account_info\n c = Box.client(BASE_URL)\n sign_connexion(c)\n response = c.get \"users/me\"\n res = Box.format_response(response)\n [res[:space_used], res[:space_amount]]\n end",
"title": ""
},
{
"docid": "f0045adc7e0698e875205420d478b759",
"score": "0.58978766",
"text": "def get_items\n\t\t@list_array\n\tend",
"title": ""
},
{
"docid": "b8503391c14674c6754ce5dd4067f854",
"score": "0.5882158",
"text": "def items\n []\n end",
"title": ""
},
{
"docid": "b8503391c14674c6754ce5dd4067f854",
"score": "0.5882158",
"text": "def items\n []\n end",
"title": ""
},
{
"docid": "99113d4269916dbf068835b9839b7033",
"score": "0.5874983",
"text": "def items\n return @items\n end",
"title": ""
},
{
"docid": "99113d4269916dbf068835b9839b7033",
"score": "0.5874983",
"text": "def items\n return @items\n end",
"title": ""
},
{
"docid": "99113d4269916dbf068835b9839b7033",
"score": "0.5874983",
"text": "def items\n return @items\n end",
"title": ""
},
{
"docid": "99113d4269916dbf068835b9839b7033",
"score": "0.5874983",
"text": "def items\n return @items\n end",
"title": ""
},
{
"docid": "1dd3dabe738d899ced0aa577351eb5d9",
"score": "0.58639604",
"text": "def get_item_list\n arr = []\n @transaction[:items].each do |item|\n arr << { name: item[:name], price: item[:price], currency: item[:currency], quantity: item[:quantity] }\n end\n end",
"title": ""
},
{
"docid": "ccc555c48308b0b89cdc0a2996f85a97",
"score": "0.58428085",
"text": "def items\n return @items\n\n end",
"title": ""
},
{
"docid": "1ffaa844492dbdc454ccb68178b84656",
"score": "0.58343655",
"text": "def account_list(name, pin)\n list = db.execute(\"SELECT * FROM accounts\")\n return list if verify_pin(name, pin, \"managers\")\n end",
"title": ""
},
{
"docid": "0b342b2442e2f923d18dfa5760eb36a9",
"score": "0.58000183",
"text": "def visible_items\n customer_item_list[:visible_items] || []\n end",
"title": ""
},
{
"docid": "f1fa72a815b89f704f969b0dac82f685",
"score": "0.579899",
"text": "def items\n @items\n end",
"title": ""
},
{
"docid": "f1fa72a815b89f704f969b0dac82f685",
"score": "0.579899",
"text": "def items\n @items\n end",
"title": ""
},
{
"docid": "f1fa72a815b89f704f969b0dac82f685",
"score": "0.579899",
"text": "def items\n @items\n end",
"title": ""
},
{
"docid": "f1fa72a815b89f704f969b0dac82f685",
"score": "0.579899",
"text": "def items\n @items\n end",
"title": ""
},
{
"docid": "f1fa72a815b89f704f969b0dac82f685",
"score": "0.579899",
"text": "def items\n @items\n end",
"title": ""
},
{
"docid": "1bb61f42f96a8cd78501e3100a3cdc31",
"score": "0.5794098",
"text": "def items\n @@all_item\n end",
"title": ""
},
{
"docid": "6ab1a2efd874a7ca93c1d5dd50dba68b",
"score": "0.57846093",
"text": "def load_accounts\n Account.all.map{|u| [ u.account_name, u.account_name ]}\n end",
"title": ""
},
{
"docid": "cdc8c23b6a95834ace9868b9d2afe764",
"score": "0.57798064",
"text": "def items\n @cart_items.values\n end",
"title": ""
},
{
"docid": "323489986858d6de9d24632b28055a0f",
"score": "0.57725096",
"text": "def accounts\n transactions.map { |t| t.account }\n end",
"title": ""
},
{
"docid": "c4cbd67cb5d65d8669b0e78a0831c071",
"score": "0.57702965",
"text": "def items\n return @items if @items\n\n @items = check_items.map do |item_fields|\n Item.new(item_fields)\n end\n end",
"title": ""
},
{
"docid": "41997e40d2a2bc19e48597caccb474fb",
"score": "0.5767847",
"text": "def items\n @item\n end",
"title": ""
},
{
"docid": "bf6c4d0fe5a2a2128f264270bfb5d4b6",
"score": "0.5759489",
"text": "def get_accounts\n\t\t@accounts = []\n\t\tfor club in self.get_clubs\n\t\t\tp club.current_account\n\t\t\tunless club.current_account.nil?\n\t\t\t\t@accounts << club.current_account\n\t\t\tend\n\t\tend\n\t\treturn @accounts\n\tend",
"title": ""
},
{
"docid": "336ce606fbec2a29d77b66aaebf2349d",
"score": "0.57546633",
"text": "def items\n items_scanned\n end",
"title": ""
},
{
"docid": "746216276e9edd405cde386b1876815f",
"score": "0.57338685",
"text": "def items\n @items || []\n end",
"title": ""
},
{
"docid": "64d810eca5c8047f5ba9d1521db81c77",
"score": "0.57330346",
"text": "def accounts\n return @accounts if @accounts\n\n @accounts = account_table_rows.map do |row|\n acct_type = :bank\n name = row.xpath(\".//h4\").text\n number = row.xpath(\".//span[@class='account-number truncate']\").text.strip\n\n amount = row.xpath(\".//span[@class='bal available']\").text\n balance = amount.strip.scan(NUMERIC_REGEXP).join\n available = balance\n\n Account.new(acct_type, name, number, balance, available)\n end\n end",
"title": ""
},
{
"docid": "b270a491a250a49aeb6dc79da180e576",
"score": "0.5730439",
"text": "def accounts\n make_promise(@core.web3.JS[:eth], 'getAccounts') do |result|\n Native(`result`)\n end\n end",
"title": ""
},
{
"docid": "d5b7615a6e10896e2f5ddd1bfaa27a56",
"score": "0.57254136",
"text": "def bank_accounts\n Monkey.config.accounting.bank_accounts.map { |name|\n account name\n }\n end",
"title": ""
},
{
"docid": "c53e06d70d4bf3efe85d720c84ec6fba",
"score": "0.57226783",
"text": "def items(mailbox)\n raise UnknownMailbox.new(mailbox) unless @list[mailbox]\n return @list[mailbox]\n end",
"title": ""
},
{
"docid": "b011dba1026dcfc3b52c54cc59dc7b87",
"score": "0.57191795",
"text": "def all_items\n\n end",
"title": ""
},
{
"docid": "87360f14ea20248b59c08b9b02fad710",
"score": "0.57166255",
"text": "def get_items\n return self.items.collect {|i| \n i.to_a \n } \n end",
"title": ""
},
{
"docid": "3848d7221d8ae1ed4c0a16b5fc4b723b",
"score": "0.571212",
"text": "def getItems\n\t\treturn @stuff\n\tend",
"title": ""
},
{
"docid": "8c89a80f793fd8cc6e14e6940aa2a064",
"score": "0.57119775",
"text": "def items \n items = [\"eggs\", \"tomato\", \"tomato\", \"tomato\"]\n end",
"title": ""
},
{
"docid": "6981977ab1fc86515d25800990f5709f",
"score": "0.5710459",
"text": "def accounts\n\t\t\[email protected](0, true).map do |acct_info|\n\t\t\t\tget_account(acct_info.fetch('account'))\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "bd505ca14fc063443c56fc44211cb3a2",
"score": "0.57080096",
"text": "def _accounts\n accounts = []\n \n page = navigate_to_accounts_index\n\n if page.content =~ /Saldo y movimientos/\n name = page.search(\"table\").first.search(\"tr\").search(\"td:nth-of-type(2)\").text\n number = page.search(\"table.detalle\").search(\"tr:nth-of-type(2)\").search(\"td\").text.delete(\" \").delete(\"-\")[0,20]\n balance = normalize_amount(page.search(\"form\").search(\"div:nth-of-type(2)\").search(\"table:nth-of-type(2)\").search(\"td:nth-of-type(2)\").text)\n accounts << Account.new(:name => name, :number => number, :balance => balance)\n else\n page.search('div:nth-of-type(2)').search('table:nth-of-type(2)').search('tr').each do |node|\n if node.search('td').length == 2 && !node.search('td:first a').text.empty?\n name = node.search('td:first a').text\n account_page = agent.click page.link_with(:text => name)\n number = account_page.search(\"form:nth-of-type(1) div.negritagris\").text.gsub(/\\D/,'')\n\n accounts << Account.new(:name => name,\n :number => number,\n :balance => normalize_amount(node.search('td:last').text))\n end\n end\n end\n accounts\n end",
"title": ""
},
{
"docid": "9482aef779f01dda81bda7e7fec02270",
"score": "0.5699622",
"text": "def listings\n @items = current_user.items\n end",
"title": ""
},
{
"docid": "6688405088f77f5908580b8a11a82942",
"score": "0.56994975",
"text": "def get_account_list\n account_list = fetch_account_list\n\n account_list.each do |account| \n account['app_list'] = fetch_app_list(account['account_id'])\n end\n\n account_list\n end",
"title": ""
},
{
"docid": "ae835060ffd94b22d5d19e38a9c803de",
"score": "0.56963474",
"text": "def items \n @all_items \n end",
"title": ""
},
{
"docid": "e4a4197d6dc9a0268da9c7cf839f2f3a",
"score": "0.56876665",
"text": "def get_all_accounts_data\n \n accounts_array = Array.new\n\n self.accounts.each do |account|\n \n account_hash = Hash.new\n account_hash[:email] = account.email\n account_hash[:profiles] = Array.new\n account_hash[:credit_cards] = Array.new\n account_hash[:password] = account.password\n \n account.profiles.each do |profile|\n profile_hash = Hash.new\n profile_hash[:first_name] = profile.first_name\n profile_hash[:last_name] = profile.last_name\n profile_hash[:date_of_birth] = profile.date_of_birth\n profile_hash[:favorite_genre] = profile.favorite_genre\n account_hash[:profiles] << profile_hash\n end\n\n account.credit_cards.each do |credit_card|\n credit_cards_hash = Hash.new\n credit_cards_hash[:number] = credit_card.number\n credit_cards_hash[:holder_name] = credit_card.holder_name\n credit_cards_hash[:issuing_bank] = credit_card.issuing_bank\n credit_cards_hash[:expiration_date] = credit_card.expiration_date\n credit_cards_hash[:security_code] = credit_card.security_code\n account_hash[:credit_cards] << credit_cards_hash\n end\n \n accounts_array << account_hash\n end\n \n accounts_array\n\n end",
"title": ""
},
{
"docid": "6ea68a16accb67c31e0effd0ed32b710",
"score": "0.56801647",
"text": "def accounts_for media_type='FacebookAccount'\n begin\n accounts.map{|a| [a.id,a.object_name] if a.media_type_name == media_type}.compact\n rescue \n []\n end\n end",
"title": ""
},
{
"docid": "0d2e62fefe4fa7418c2688309e9675c3",
"score": "0.56753564",
"text": "def accounts\n period.accounts\n end",
"title": ""
},
{
"docid": "e6fed506c228b8438e7108ad9e80bcaa",
"score": "0.5669825",
"text": "def items\n @items || []\n end",
"title": ""
},
{
"docid": "9cfb2e748eeefdead3f7756477ceb3b5",
"score": "0.56693447",
"text": "def items\n @@all\n end",
"title": ""
},
{
"docid": "0ab38da29284482ed4f687da0ba5ee08",
"score": "0.56691426",
"text": "def list_items\n self.items.map {|item| item.name}\n end",
"title": ""
},
{
"docid": "b0fc36e450be937a44cd23a07d9714c6",
"score": "0.5668337",
"text": "def inboxes\r\n (@archived_inboxes, @active_inboxes) = @user.inboxes.partition{|i| i.archived?}\r\n end",
"title": ""
},
{
"docid": "dc42bdf5dc46484f99f85169aec21504",
"score": "0.56671417",
"text": "def asset_accounts\n Monkey.config.accounting.asset_accounts.map { |name|\n account name\n }\n end",
"title": ""
},
{
"docid": "66018dbfb6079b65ab543ba4c9e26c77",
"score": "0.5663642",
"text": "def index_user\n @items = Array.new()\n current_user.owners.each do |owner|\n @items.concat(owner.items)\n end\n end",
"title": ""
},
{
"docid": "8c4b02096ff0311f30ababbb4eb3855d",
"score": "0.56635654",
"text": "def items\n @items ||= (1..number_of_mass_pay_items).map do |item_number|\n MassPayItem.new(\n params[\"masspay_txn_id_#{item_number}\"],\n params[\"mc_gross_#{item_number}\"],\n params[\"mc_fee_#{item_number}\"],\n params[\"mc_currency_#{item_number}\"],\n params[\"unique_id_#{item_number}\"],\n params[\"receiver_email_#{item_number}\"],\n params[\"status_#{item_number}\"]\n )\n end\n end",
"title": ""
},
{
"docid": "0e1612b599ab3f373adf23ce32cdd10e",
"score": "0.56602705",
"text": "def items\n @item\n end",
"title": ""
},
{
"docid": "582241104a232a6be1101ce6c9697ce0",
"score": "0.56598777",
"text": "def items\n result = []\n each_item { |item| result.push(item) }\n result\n end",
"title": ""
},
{
"docid": "dd79219312313e4ec04d272336ca88e3",
"score": "0.5654298",
"text": "def items\n #sets an empty array, item_names\n item_names = []\n #to return an array containing all items\n #that have been added\n @cart.each do |item_info|#iterates\n #@cart array\n #block instruction\n for qty in 1..item_info[:quantity]\n #for quanity in range 1 to hash,\n #item_info[:quantity]\n #where did the qty come from?\n item_names << item_info[:name]\n #shovel hash values from :name\n #into item_names array\n end\n end\n item_names#implicit return array item_names\n end",
"title": ""
},
{
"docid": "c6077e0ecadc95ee7b0aa99a630b857a",
"score": "0.5650513",
"text": "def get_team_inboxes\n data = [{id: 'nobody', name: 'Unassigned'}]\n intercom.teams.all.each {|team| data << {id: team.id, name: team.name}}\n data\nend",
"title": ""
},
{
"docid": "b60f90c12988fb5db5d3c7962ccb5182",
"score": "0.5645168",
"text": "def index\n @top_menu_page = :account\n @boxes = Box.find_all_by_assigned_to_user_id(current_user.id, :order => \"created_at ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @boxes }\n end\n end",
"title": ""
},
{
"docid": "25de3a2dfb9855c848cdd04b1aa0a1cd",
"score": "0.5641694",
"text": "def items; end",
"title": ""
},
{
"docid": "25de3a2dfb9855c848cdd04b1aa0a1cd",
"score": "0.5641694",
"text": "def items; end",
"title": ""
},
{
"docid": "25de3a2dfb9855c848cdd04b1aa0a1cd",
"score": "0.5641694",
"text": "def items; end",
"title": ""
},
{
"docid": "25de3a2dfb9855c848cdd04b1aa0a1cd",
"score": "0.5641694",
"text": "def items; end",
"title": ""
},
{
"docid": "25de3a2dfb9855c848cdd04b1aa0a1cd",
"score": "0.5641694",
"text": "def items; end",
"title": ""
},
{
"docid": "25de3a2dfb9855c848cdd04b1aa0a1cd",
"score": "0.5641694",
"text": "def items; end",
"title": ""
},
{
"docid": "b2f491ea19531b9c0e764150240d100d",
"score": "0.5636493",
"text": "def invoices_for_account_group(_account_group = nil)\n invs = []\n invoices.each { |inv| \n invs << inv if _account_group == inv.client.account.account_group\n }\n invs \n end",
"title": ""
},
{
"docid": "0e072e8906f59cc16eed96ad70a26cc8",
"score": "0.5635789",
"text": "def items\n @items ||= record.items\n rescue\n []\n end",
"title": ""
},
{
"docid": "8a9c791d45214938cbc9ff06dc55cb10",
"score": "0.56347024",
"text": "def get_checkout_items\n\n end",
"title": ""
},
{
"docid": "3a27d4b821bbf50c63c8f216a7b1cda3",
"score": "0.5609725",
"text": "def get_items\n\t\t@list\n\tend",
"title": ""
},
{
"docid": "b1a0f34ca6089cbf7db363979c4c3550",
"score": "0.55945283",
"text": "def accounts\n ensure_ready!(:authorization)\n response = connection.get('accounts')\n checked_response_body(response)\n end",
"title": ""
},
{
"docid": "77e0dab9f7fc314eb4f328a21f3343df",
"score": "0.5590704",
"text": "def invoice_items\n invoice_line_items_by_type('invoiceitem')\n end",
"title": ""
},
{
"docid": "f9bce34d40d32ae64cb97b99331fad9e",
"score": "0.55899787",
"text": "def index\n @accounts_invoice_items = AccountsInvoiceItem.all\n end",
"title": ""
},
{
"docid": "4d358c7f210001eccf277d3106ebd6c4",
"score": "0.558714",
"text": "def items\n @ws.get_list_items(@guid)\n end",
"title": ""
},
{
"docid": "ca793300878f0ad391e5821baf0e33ee",
"score": "0.5584803",
"text": "def generate_item_list(user)\n user[\"checkout\"][\"line_items\"].map do |item|\n \"#{item[\"quantity\"]}x #{item[\"title\"]}\"\n end.join('\\n')\nend",
"title": ""
},
{
"docid": "aa77884dcac7a18946dc7b6d228c7b14",
"score": "0.55763346",
"text": "def fetch_accounts\n log 'fetch_accounts'\n\n # Even if the required method is an HTTP POST\n # the API requires a funny header that says is a GET\n # otherwise the request doesn't work.\n response = with_headers('BBVA-Method' => 'GET') do\n post(BASE_ENDPOINT + PRODUCTS_ENDPOINT, {})\n end\n\n json = JSON.parse(response)\n json['accounts'].map { |data| build_account(data) }\n end",
"title": ""
},
{
"docid": "1aa63144b5f1094a567617746b09b76d",
"score": "0.5563842",
"text": "def get_items\n render json: current_user.items.where(flag: params[:bill_type_id])\n end",
"title": ""
},
{
"docid": "3592a791ca19747b8e832ee716fb3884",
"score": "0.55573475",
"text": "def find_all_accounts(authorizer)\n # OMF::SFA::Resource::Account.all() - get_default_account()\n MISS\n end",
"title": ""
}
] |
38598beb670b978c755314d4d0e9b434
|
Formats name for display by capitalizing the first word and using space instead of ''
|
[
{
"docid": "3ac3f3f7f988d87a668f530ad89415ff",
"score": "0.8639868",
"text": "def display_name(name)\n name.gsub('-', ' ').capitalize\n end",
"title": ""
}
] |
[
{
"docid": "dae18b9f70d4bb621dff422de76d5cc9",
"score": "0.8377745",
"text": "def name_text_formatted\n h.simple_format(name.capitalize)\n end",
"title": ""
},
{
"docid": "e13d6b81a76f995be2cee3a4167ac2a9",
"score": "0.8117585",
"text": "def format_name\n self.name = self.name.titlecase\n end",
"title": ""
},
{
"docid": "e13d6b81a76f995be2cee3a4167ac2a9",
"score": "0.8117585",
"text": "def format_name\n self.name = self.name.titlecase\n end",
"title": ""
},
{
"docid": "e13d6b81a76f995be2cee3a4167ac2a9",
"score": "0.8117585",
"text": "def format_name\n self.name = self.name.titlecase\n end",
"title": ""
},
{
"docid": "3aa21d0ed6894034ba6491d3a736d393",
"score": "0.80896044",
"text": "def formatted_name\n \"#{user_data['first_name']&.downcase&.capitalize} #{user_data['last_name']&.downcase&.capitalize}\"\n end",
"title": ""
},
{
"docid": "2d4b1312cd6f0c867310517601d29b10",
"score": "0.8007344",
"text": "def format_name(name)\n name.split(\" \").map { |word| word[0].upcase + word[1..-1].downcase }.join(\" \")\nend",
"title": ""
},
{
"docid": "5a884dbc55b98df57a829062241d8cda",
"score": "0.7991697",
"text": "def titleize_name\n name.split.map(&:capitalize).join(' ')\n end",
"title": ""
},
{
"docid": "49210978e4ddc8b9b8bfc800fb7ae149",
"score": "0.7975775",
"text": "def human_name\n \"#{full_name.downcase.split.map { |x| x.split('-').map { |y| y.split('\\'').map { |z| z.capitalize }.join('\\'') }.join('-') }.join(' ')}\"\n end",
"title": ""
},
{
"docid": "6b5d9863c0705bb323d5037eefa6953b",
"score": "0.7973559",
"text": "def format_name\n name.strip!\n end",
"title": ""
},
{
"docid": "4441edb8a0a4a1a9c65d4a322269dae0",
"score": "0.7941503",
"text": "def format_name(word)\n new_word = []\n word.split.each { |word| new_word << properly_capitalized(word)}\n new_word.join(\" \")\nend",
"title": ""
},
{
"docid": "d7c9f6fa27452db210e3bfdaa1efae91",
"score": "0.79373306",
"text": "def titleize_name(character)\n names_array = character.split(\" \")\n names_array.collect { |name| name[0] = name[0].upcase}\n capital_name = names_array.join(\" \")\n if capital_name.include?(\"-\")\n capital_name.gsub(/-[a-z]/) {|letter| letter.upcase}\n else\n capital_name\n end\n # binding.pry\nend",
"title": ""
},
{
"docid": "3b14a17d30a48afce763872201ea495e",
"score": "0.7917697",
"text": "def capitalize_name\n self.name = self.name.downcase.split.collect(&:capitalize).join(' ') if self.name && !self.name.blank?\n end",
"title": ""
},
{
"docid": "3f78e8cb0f120d809ae0eced57014c0f",
"score": "0.7915094",
"text": "def format_name(first, last)\n \n first.delete(' ')[0].downcase + last.delete(' ').downcase\n \n \nend",
"title": ""
},
{
"docid": "b0fb6485b4032761e3f931c322f19aa1",
"score": "0.7913051",
"text": "def capitalize_name\n self.name = self.name.split.map(&:capitalize).join(' ')\n end",
"title": ""
},
{
"docid": "159e0d93dcba2c0be8eb7d447f397db1",
"score": "0.7899269",
"text": "def name\n \"#{(first_name || '').split(/\\s+/).map(&:capitalize).join(' ')} #{(last_name || '').capitalize}\".strip\n end",
"title": ""
},
{
"docid": "7ed9aa18e7dfd8af7fa0d28048e64938",
"score": "0.78540355",
"text": "def name_format\n self.name.gsub!(/[^0-9a-z\\-_ ]/i, '_') unless self.name.nil?\n self.name.gsub!(/\\s+/, '-') unless self.name.nil?\n self.name = self.name.downcase unless self.name.nil?\n end",
"title": ""
},
{
"docid": "988b58bf1301ab880475439b1fce93a8",
"score": "0.7852084",
"text": "def format_name\n self.first_name.gsub!(/\\b[a-z]/) { |w| w.capitalize } if self.first_name\n self.last_name.gsub!(/\\b[a-z]/) { |w| w.capitalize } if self.last_name\n self.middle_name.gsub!(/\\b[a-z]/) { |w| w.capitalize } if self.middle_name \n self.first_name.strip! if self.first_name\n self.last_name.strip! if self.last_name\n self.middle_name.strip! if self.middle_name\n\n true\n end",
"title": ""
},
{
"docid": "a8aeff2c84b8a4d789a9edad4257ab4e",
"score": "0.7821973",
"text": "def name_capitalize\n \tname.slice(0,1).capitalize + name.slice(1..-1)\n end",
"title": ""
},
{
"docid": "2e6a0ab112e2b10c44de546f85c873d8",
"score": "0.7820865",
"text": "def name_clean\n self.name.gsub(/_/, \" \").titleize\n end",
"title": ""
},
{
"docid": "80160bbf76a1063ebd972e4c1da67993",
"score": "0.78203446",
"text": "def abbreviated_name\n i = self.name.index(/[\\s][a-zA-Z]+$/)\n if (i.nil?)\n self.name\n else\n self.name[0..i+1] + \".\"\n end\n end",
"title": ""
},
{
"docid": "817b0d06bda98f7bdd001f8b394dd24a",
"score": "0.7814821",
"text": "def format_name(first, last)\n if last != \"\" and first != \"\"\n cleanFirst = \"#{first}\".gsub(/[^a-z ]/i, '').delete(\" \")\n cleanLast = \"#{last}\".gsub(/[^a-z ]/i, '').delete(\" \")\n \"#{cleanFirst[0]}#{cleanLast}\".downcase\n else\n nil\n end\nend",
"title": ""
},
{
"docid": "4fe8d64ab9b3bebbdd6d64748d21318a",
"score": "0.78145903",
"text": "def format_names\n self.name = self.short_name.strip.downcase.underscore.gsub(\" \", '_') unless self.short_name.blank? or self.name.present?\n self.short_name = self.short_name.strip if self.short_name.present?\n end",
"title": ""
},
{
"docid": "977d406c7f596807a67b4243aa8f0f05",
"score": "0.7799423",
"text": "def display_name\n\t\t\"#{firstname.titleize} #{lastname.titleize}\"\n\tend",
"title": ""
},
{
"docid": "3b5929fdeb63bd730fa1dde41b1b1262",
"score": "0.7793819",
"text": "def format_name(str)\n return str.downcase.split(\" \").each {|word| word[0] = word[0].upcase }.join(\" \")\nend",
"title": ""
},
{
"docid": "28133af1e73480ce378463e5bbea7982",
"score": "0.77871937",
"text": "def abbrev_name(name)\n string = ''\n last_name = name.split\n p last_name[1]\n split_last_name = name.split[1].chr.capitalize\n p split_last_name\n first_name = name.chr.split.join.capitalize\n p first_name\n string.prepend(split_last_name)\n string.prepend('.')\n string.prepend(first_name)\n return string\n\nend",
"title": ""
},
{
"docid": "2731e92b0b18e11a6054dcb30358642a",
"score": "0.7780036",
"text": "def titlecase_name\n if !merchant || merchant.unedited?\n self.display_name.titlecase.gsub(/\\s+/,\" \")\n else\n self.display_name\n end\n end",
"title": ""
},
{
"docid": "5172e43052189d37944438872f78a999",
"score": "0.7746338",
"text": "def capitalize_name\n capitalized_words = name.split(\" \").each do |word|\n word.capitalize!\n end\n self.name = capitalized_words.join(\" \")\n end",
"title": ""
},
{
"docid": "0df753bf3de969ff1301495e33c9f9bc",
"score": "0.7743899",
"text": "def clean_full_name(first_name, last_name)\n puts \"#{first_name.downcase.capitalize}#{last_name.downcase.capitalize}\"\nend",
"title": ""
},
{
"docid": "06e6ab8298c026c27b7569713e4027ec",
"score": "0.77142745",
"text": "def format_names\n self.name = self.short_name.strip.downcase.underscore.gsub(\" \", '_') unless self.short_name.blank? or self.name.present?\n self.short_name = self.short_name.strip if self.short_name.present?\n self.long_name = self.short_name unless self.long_name.present?\n end",
"title": ""
},
{
"docid": "1e8a8023d76b19b8eba6a945bab064ec",
"score": "0.7713892",
"text": "def format_name(first, last)\n if first == \"\" || last == \"\"\n nil\n else\n new_first = first.gsub(/[\\s+]/, \"\")\n new_last = last.gsub(/[\\s+]/, \"\")\n name = new_first[0] + new_last\n name.downcase\n end\n\nend",
"title": ""
},
{
"docid": "5460a6fa960cb6e66112aacbdabcdf92",
"score": "0.77089936",
"text": "def name\n \"#{first_name}\".titleize\n end",
"title": ""
},
{
"docid": "e624155c912f4a3c296e51c0f58bcf9b",
"score": "0.76942146",
"text": "def display_name( name )\n name.downcase\n end",
"title": ""
},
{
"docid": "3fa3742726861aa46ba24b5a330eaf27",
"score": "0.7689954",
"text": "def capitalize_name(name)\n name_array = name.split\n formatted_user_name = name_array.map(&:capitalize)\n formatted_user_name.join(' ')\nend",
"title": ""
},
{
"docid": "df7a102680c65a19cf5a68ac62b9a256",
"score": "0.76897144",
"text": "def uppercase_name\n\t self.name = name.split.map(&:capitalize).join(' ')\n\t end",
"title": ""
},
{
"docid": "aa5fc4830bb64dc6d3fde316be8b9139",
"score": "0.7682591",
"text": "def format_name(first, last)\n if last==\"\" || first==\"\"\n return nil\n end\n first1=first.strip.downcase\n last1=last.strip.downcase\n first1=first1.gsub(/[^a-z]/,\"\")\n last1=last1.gsub(/[^a-z]/,\"\")\n name = first1[0]+last1\n name = name.downcase.delete(\" \")\n name\nend",
"title": ""
},
{
"docid": "020fe5a7fa61b9cbfac17624f6fe7c0e",
"score": "0.76816213",
"text": "def format_name(name)\n names = name.split(' ')\n formatted_names = []\n names.each do |namae|\n formatted_names << namae[0].upcase + namae[1..-1].downcase\n end\n return formatted_names.join(' ')\nend",
"title": ""
},
{
"docid": "4ccb5ceba978ba145b077b0aa69277d1",
"score": "0.7678776",
"text": "def to_s\n return self.name.split.map(&:capitalize)*' '\n end",
"title": ""
},
{
"docid": "8035fce30388c702718c6006518d4a50",
"score": "0.7672224",
"text": "def display_name\n (name =~ /\\s/) ? \"\\\"#{name}\\\"\" : name\n end",
"title": ""
},
{
"docid": "cd8ff6c2647fb8034864ae5f7ee59c62",
"score": "0.766017",
"text": "def format_name(first, last)\n if last == \"\" || first == \"\"\n nil\n else\n first = first.gsub(/\\s+/, '')\n last = last.gsub(/\\s+/, '')\n (first[0] + last).downcase\n end\nend",
"title": ""
},
{
"docid": "60b14b751c09af551165d960609d219f",
"score": "0.76491195",
"text": "def display_name\n # Format the name components\n f = first_name and first_name.downcase.capitalize || \"\"\n l = last_name and last_name.downcase.capitalize || \"\"\n\n # put it together\n \"#{f} #{l}\"\n end",
"title": ""
},
{
"docid": "265547221a6ff814ac2c50279c4ccdcc",
"score": "0.76477987",
"text": "def full_name\n display_name.blank? ? \"#{first_name} #{last_name}\".titleize : display_name.titleize\n end",
"title": ""
},
{
"docid": "bfd54a78c29c83b6b4744b569eb90005",
"score": "0.7641669",
"text": "def display_name(name = self.name)\n if (name =~ /\\s/)\n %{\"#{name}\"}\n else\n name\n end\n end",
"title": ""
},
{
"docid": "bfd54a78c29c83b6b4744b569eb90005",
"score": "0.7641669",
"text": "def display_name(name = self.name)\n if (name =~ /\\s/)\n %{\"#{name}\"}\n else\n name\n end\n end",
"title": ""
},
{
"docid": "9c97f2c42236a1fc82ad3c2ca58b2498",
"score": "0.7640317",
"text": "def format_name(first, last)\n\tfirst.gsub!(/[^a-z]/i, \"\")\n\tlast.gsub!(/[^a-z]/i, \"\")\n if last == \"\" or first == \"\"\n \treturn nil\n else\n \t(first[0] + last).downcase\n end\nend",
"title": ""
},
{
"docid": "0f4fa0e2b8bec07b81058e4913014005",
"score": "0.7621368",
"text": "def format_name(str)\n arr = str.split(' ')\n format_name = ' '\n\n arr.each do |word|\n format_name += capitalizseName(word)\n end\n format_name\nend",
"title": ""
},
{
"docid": "77645171633fd73cacd0ade6a4d64ac7",
"score": "0.76198196",
"text": "def titleize_name \n self.name = name.titleize\n end",
"title": ""
},
{
"docid": "ebe562e4e6d1603e399ccf51c3bfac15",
"score": "0.7619693",
"text": "def titlize_name\n self.name = name.titleize\n end",
"title": ""
},
{
"docid": "e7ce732391a7a1a08787e56e263fe38e",
"score": "0.76170224",
"text": "def capitalize_name\n parts = self.strip.split(/[^A-Za-z]/, 2)\n first = parts.first.send(:capitalize_name_part)\n return first if parts.length == 1\n rest = parts.last.capitalize_name\n [first, rest].join($&)\n end",
"title": ""
},
{
"docid": "962379e7563b578fc04b1f651bb7de29",
"score": "0.7616724",
"text": "def name\n [ first_name, last_name ].compact.join(' ').titleize\n end",
"title": ""
},
{
"docid": "2a78dac9489669d13556f967b61e5b9a",
"score": "0.7602654",
"text": "def format_name(str)\n\tnew = str.downcase\n \tarry = new.split(\" \")\n \tarry.each do |word|\n word[0] = word[0].upcase\n end\n return arry.join(\" \")\nend",
"title": ""
},
{
"docid": "830be263213e1b5582540e5dfac925fb",
"score": "0.75851643",
"text": "def format_name(str)\n \tarr = []\n\twords = str.split(\" \")\n words.each { |word| arr << capitalize(word) }\n \treturn arr.join(\" \")\nend",
"title": ""
},
{
"docid": "3cc982287ffb0dd6ff950b70ec3ea027",
"score": "0.7584919",
"text": "def capitalize\n self.name = self.name.titleize()\n self.country_of_origin = self.country_of_origin.titleize()\n end",
"title": ""
},
{
"docid": "c18b9df57e25ad4ebaf0f12a9f93e9ed",
"score": "0.7581115",
"text": "def proper_name\n name.titleize\n end",
"title": ""
},
{
"docid": "12afff29473c485d7f7f17ded2fa2b9b",
"score": "0.7578826",
"text": "def full_name\n major.title.gsub(/\\s{2,}/, ' ') rescue major_abbr\n end",
"title": ""
},
{
"docid": "e2fed954a97a45d652cc81273cbabe6e",
"score": "0.75744796",
"text": "def first_name\n name.to_s.split(/\\s/).first.to_s.capitalize #to_s if the name is blank by chance\n end",
"title": ""
},
{
"docid": "cd44b23ece63ef33fe48fb32682d44d8",
"score": "0.7560639",
"text": "def display_name\n return \"\" if name.nil?\n\n # converts \"The Clash\" to \"Clash, The\"\n return name unless name[0,4] == \"The \"\n # name is a method provided by an accessor that rails provides\n\n name.gsub(/^The\\s+/, '') + ', The'\n end",
"title": ""
},
{
"docid": "2a11f830ef44ff71212647ea69e412d9",
"score": "0.75576526",
"text": "def display_name\n name = self.name.split\n last_initial = name.last[0] + \".\"\n \"#{name.first} #{last_initial}\"\n end",
"title": ""
},
{
"docid": "2a11f830ef44ff71212647ea69e412d9",
"score": "0.75576526",
"text": "def display_name\n name = self.name.split\n last_initial = name.last[0] + \".\"\n \"#{name.first} #{last_initial}\"\n end",
"title": ""
},
{
"docid": "fa567b0aa00f51d5ece90cef00b5af63",
"score": "0.7553102",
"text": "def normalize_name\n hyphens_to_spaces = name.tr('-', ' ')\n capitalised = hyphens_to_spaces.split.map(&:capitalize).join(' ')\n self.name = capitalised.delete(\"'\")\n end",
"title": ""
},
{
"docid": "b58e8f99827c6988943215cc4f1c4973",
"score": "0.75444406",
"text": "def capitalize_names(name)\n\tfirst_and_last = name.partition(' ')\n\tfirst = first_and_last[0].capitalize\n\tlast = first_and_last[2].capitalize\n\tfirst << ' ' << last\nend",
"title": ""
},
{
"docid": "6d401b92b9ae8b89422dec0ffc76a3fc",
"score": "0.7538043",
"text": "def full_name\n \"#{given_name} #{family_name}\"\n #\"#{given_name} #{family_name}\".split(/\\s+/).map{|n| n.capitalize}.join(' ')\n end",
"title": ""
},
{
"docid": "02ecb972c5549ac304dae18fa492cc59",
"score": "0.7532287",
"text": "def titleize\n downcase.gsub(/\\b\\S/u).each { _1.upcase }\n end",
"title": ""
},
{
"docid": "5a5b60c0695c1d72e38b3fe5708b1b83",
"score": "0.7525445",
"text": "def capitalize_name(name)\r\n\tcapital = name.split(\" \")\r\n\tcapital.each do |word|\r\n\t\tword[0] = word[0].capitalize\r\n\tend\r\n\tname = capital.join(\" \")\r\nend",
"title": ""
},
{
"docid": "1d673ab299b874bb7dbdf57147bf7657",
"score": "0.7520627",
"text": "def capitalized_name(name)\n\n\t\tname.capitalize\n\tend",
"title": ""
},
{
"docid": "ce8225cbeaf6f5b258ee3e85852138e2",
"score": "0.75119656",
"text": "def format_name(first, last)\n\tif (first == \"\" || last == \"\")\n\tnil \n\telse \nfirst_name = (first.gsub /\\s/, '')[0] + last\n\tfirst_name.downcase.gsub /\\s/, ''\n\tfirst_name.downcase.gsub(/[^0-9A-Za-z]/, '')\n\tend \nend",
"title": ""
},
{
"docid": "82c976dd1c701808c958607f8073405c",
"score": "0.7505648",
"text": "def format_name(str)\n names = str.downcase.split(' ')\n\n names.each do |name|\n name[0] = name[0].upcase\n end\n\n return names.join(\" \")\nend",
"title": ""
},
{
"docid": "740d5f040d0dbc8bb1b0f196767e6079",
"score": "0.75012904",
"text": "def full_name(first, last)\n name = \"#{first.capitalize} #{last.capitalize}\"\n return name\nend",
"title": ""
},
{
"docid": "eac582b2464adeffec2cc72258512cd5",
"score": "0.7487942",
"text": "def format_name(first, last)\n if first.empty? || last.empty?\n nil\n else\n name = first.split.join.downcase[0] + last.split.join.downcase\n name.gsub(/[^a-zA-Z]/,\"\")\n end\nend",
"title": ""
},
{
"docid": "c99d20cbd28c6e37df1f0aac45e82d0b",
"score": "0.7484478",
"text": "def clean_full_name(first_name, last_name)\n\nputs \"#{first_name.downcase.capitalize} #{last_name.downcase.capitalize} \"\n\nend",
"title": ""
},
{
"docid": "e9f72dd4b2f4dafe9680ad07a866d7ef",
"score": "0.74695486",
"text": "def format_name(str)\n\tparts = str.split(\" \")\n \tproperlyCapArr = []\n\tparts.each do |part|\n \tproperlyCapArr << part[0].upcase + part[1..-1].downcase\n end\n \treturn properlyCapArr.join(\" \")\nend",
"title": ""
},
{
"docid": "cc78bae17cf3e2966d46057034432fd1",
"score": "0.7463478",
"text": "def clean_full_name(first_name, last_name)\n puts \"This is the full name: #{first_name.downcase.capitalize} #{last_name.downcase.capitalize}\"\nend",
"title": ""
},
{
"docid": "5eb9cc14cbcd9c31e73b4608b49e5e5f",
"score": "0.7461254",
"text": "def abbrev_name\n \"#{self.last_name}, #{self.first_initial}.\"\n end",
"title": ""
},
{
"docid": "5eb9cc14cbcd9c31e73b4608b49e5e5f",
"score": "0.7461254",
"text": "def abbrev_name\n \"#{self.last_name}, #{self.first_initial}.\"\n end",
"title": ""
},
{
"docid": "2a4be07e1e5901d0f8d066cc9d54ef8a",
"score": "0.7460482",
"text": "def full_name_for (first_name, last_name)\n # first=\"raghu\"\n # last=\"betina\"\n full=\"- \"+first_name.capitalize+\" \"+last_name.capitalize\n\n puts full\n\nend",
"title": ""
},
{
"docid": "15d57912d34a08cb733ac999d5f6ac65",
"score": "0.7455304",
"text": "def uppercase_name\n\t self.name = name.split.map(&:capitalize).join(' ')\n\t self.location = location.split.map(&:capitalize).join(' ')\n\t end",
"title": ""
},
{
"docid": "1efdb281067800633af37fa56ba36238",
"score": "0.74497455",
"text": "def format_name(str)\n new_str = []\n str.split.each { |word| new_str << word[0].upcase + word[1..-1].downcase }\n return new_str.join(\" \")\nend",
"title": ""
},
{
"docid": "9c577ec35428d4ce472c09dbc261cc30",
"score": "0.74465036",
"text": "def display_name\n full_name.join(\" \")\n end",
"title": ""
},
{
"docid": "13379731a535b5dc81922ac00165105d",
"score": "0.7446206",
"text": "def titleized(starting_case = :upper)\n value = self.gsub(/[a-z0-9][A-Z]/) { |match| \"#{match[0..0]} #{match[-1..-1]}\" }\n value = value.gsub(/[_| ][a-z]/) { |match| \" #{match[-1..-1].upcase}\" }\n return value[0..0].upcase + value[1..-1]\n end",
"title": ""
},
{
"docid": "15d5e43c45f29c5d9bed9c4db129bab8",
"score": "0.74434835",
"text": "def humanize\n name.capitalize + ' ' + surname.capitalize\n end",
"title": ""
},
{
"docid": "6b5599fb58e422f68eefeac45ea058d0",
"score": "0.7442353",
"text": "def human_name\n name.capitalize.to_s\n end",
"title": ""
},
{
"docid": "7d3ec2eb3416aa03fe6810853870f7e1",
"score": "0.743991",
"text": "def to_s\n name.capitalize.gsub(/_/,' ')\n end",
"title": ""
},
{
"docid": "c769c2a6fe326826a10f10e9365a4e2b",
"score": "0.74353164",
"text": "def fake_name(name)\n name = successive_letter(name).join(\"\")\n name = capitalize(name)\nend",
"title": ""
},
{
"docid": "5389092b071e2f9f72ac4f8fdcbcce34",
"score": "0.74306226",
"text": "def name\n \"#{self.first_name.titlecase} #{self.last_name.titlecase}\"\n end",
"title": ""
},
{
"docid": "7feba07045dde4c95b40c965a5b8a048",
"score": "0.74266756",
"text": "def abbrev_name(name)\n \"#{name.split[0][0]}.#{name.split[1][0]}\".upcase\nend",
"title": ""
},
{
"docid": "b8c50fb148054272fd8f52ac65af1651",
"score": "0.741972",
"text": "def capitalize_field(str); end",
"title": ""
},
{
"docid": "ef3384521b5a9cff517bfcdfc8d1b006",
"score": "0.74178416",
"text": "def name\n \"#{first_name.capitalize} #{last_name.capitalize}\"\n end",
"title": ""
},
{
"docid": "6695d0415d8c2c949d02392cb279186e",
"score": "0.7415763",
"text": "def display_name\n\t\t\"#{city.titleize} #{name.titleize}\"\n\tend",
"title": ""
},
{
"docid": "83d3fb10e6026dc33d98e5f45dcca23f",
"score": "0.7410377",
"text": "def capitalize_data\n self.first_name = self.first_name.downcase.titleize\n self.last_name = self.last_name.downcase.titleize\n end",
"title": ""
},
{
"docid": "1256762ad681e85d90c22095293bd179",
"score": "0.7407293",
"text": "def clean_full_name(first_name,last_name)\n puts \"Your clean full name is: #{first_name.downcase.capitalize} #{last_name.downcase.capitalize}\"\nend",
"title": ""
},
{
"docid": "bdb41b505931e282b34aad17b4d8ce4f",
"score": "0.7404153",
"text": "def format_name(str)\n parts = str.split(\" \")\n new_parts = []\n\n parts.each do |part|\n new_parts << part[0].upcase + part[1..-1].downcase\n end\n\n new_name = new_parts.join(\" \")\n return new_name\n\n\nend",
"title": ""
},
{
"docid": "9499521a531a659e9e856a972cc86127",
"score": "0.74007094",
"text": "def titlecase_title\n self.name=(name().titlecase())\n end",
"title": ""
},
{
"docid": "70c6dff30da8f13054a5b08a118efc34",
"score": "0.74001944",
"text": "def titleize(up)\n\n sw = %w[and in the of a an]\n\n up.capitalize.gsub( /\\S+/ ) { |w| sw.include?(w) ? w : w.capitalize }\nend",
"title": ""
},
{
"docid": "dcc44877ac9ca7aa2f8ebba13a3d38a3",
"score": "0.7399238",
"text": "def name\n return first_name.capitalize+' '+surname.capitalize\n end",
"title": ""
},
{
"docid": "576d1bd52ca0b4e3edcf17fb6a1fb9ef",
"score": "0.7397358",
"text": "def to_s\n !human_name.empty? ? human_name : name.capitalize\n end",
"title": ""
},
{
"docid": "2e901209b2515f29a1e192be006b11bc",
"score": "0.7397165",
"text": "def titleize_with_caps\n strings = split\n strings.each do |str|\n str[0] = str[0].capitalize\n end\n strings.join(\" \")\n end",
"title": ""
},
{
"docid": "798e0eb243f835b52cd38d1f8b390261",
"score": "0.73931336",
"text": "def format_name(first, last)\n first = first.gsub(/[^a-z]/i, '')\n last = last.gsub(/[^a-z]/i, '')\n return nil if first.empty? || last.empty?\n (first[0] << last).downcase\nend",
"title": ""
},
{
"docid": "e41e1a7ea14d542a3a841364ed786f96",
"score": "0.73847944",
"text": "def abbrev_name(name)\n name.split(\" \").map { |elem| elem.slice(0, 1) }.join(\".\").upcase\nend",
"title": ""
},
{
"docid": "998d436af930cb024289783c09c29024",
"score": "0.73758996",
"text": "def display_name(name = \"\")\n name.truncate(30, :omission => \"...\").html_safe\n end",
"title": ""
},
{
"docid": "22e5be1c70cc878943ce099ee16e1d37",
"score": "0.73656946",
"text": "def first_name\n\t self.name.split[0].capitalize\n\tend",
"title": ""
},
{
"docid": "3d1f902838f938cb553e3d5f95ca7567",
"score": "0.7361077",
"text": "def adapt_name\n (0..1).each do |j|\n if(j == 0)\n r = self.first_name\n else\n r = self.last_name\n end\n previousLetter = false\n \n (0..(r.size-1)).each do |i|\n if(r[i] =~/[[:alpha:]]/)\n if(previousLetter)\n r[i] = r[i].downcase\n end\n previousLetter = true\n else\n previousLetter = false\n end\n end\n \n while(r[0] == ' ')\n r = r.slice(1..-1)\n end\n \n while(r[r.size-1] == ' ')\n r = r.slice(0..-2)\n end\n \n if(r.size == 1)\n r = r + \".\"\n end\n \n if(j == 0)\n self.first_name = r\n else\n self.last_name = r\n end\n end\n end",
"title": ""
}
] |
ee5b7305a8fe96c9cd18c6a8c390a322
|
AUTHENTICATE Authenticates a subscriber's userid and password
|
[
{
"docid": "6ef1f872f9909cbd19e3e018b9d755de",
"score": "0.6719387",
"text": "def authenticate\n\n @transcriber_id = params[:transcriberid]\n @transcriber_password = Devise::Encryptable::Encryptors::Freereg.digest(params[:transcriberpassword],nil,nil,nil)\n @user = UseridDetail.where(:userid => @transcriber_id).first\n #this is a cludge as it seems that WinFreeReg cannot currently handle the replies\n \n @user.userid_feedback_replies = Hash.new\n if @user.nil? then\n render(:text => { \"result\" => \"unknown_user\" }.to_xml({:root => 'authentication'}))\n else\n if @transcriber_password == @user.password then\n render(:text => {\"result\" => \"success\", :userid_detail => @user}.to_xml({:dasherize => false, :root => 'authentication'}))\n else\n render(:text => { \"result\" => \"no_match\" }.to_xml({:root => 'authentication'}))\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "5fd9c46620eda9f0d2544d89b9027813",
"score": "0.6884524",
"text": "def receive_plain_auth(user, password); end",
"title": ""
},
{
"docid": "94a37fe1eef1c235292311433dfb9407",
"score": "0.6748565",
"text": "def authenticate_inviter!\n end",
"title": ""
},
{
"docid": "9d2a5b9bb3bd4911c7cffef1a210c5b6",
"score": "0.657458",
"text": "def receive_plain_auth user, password\n user == @@params[:username] && password == @@param[:password]\n end",
"title": ""
},
{
"docid": "529794b64c9038cbb578714b4ce097b3",
"score": "0.6459692",
"text": "def authenticate_user(req)\r\n # This method is the main part of this authentication server.\r\n\r\n # If the end-user performed social login.\r\n if req.sns != nil\r\n # This demo implementation always regards the end-user as\r\n # valid when he/she was authenticated by an SNS, and uses\r\n # the subject of the end-user in the SNS as the subject of\r\n # this service.\r\n return req.id\r\n end\r\n\r\n # The end-user input his/her credentials to the input fields of\r\n # the form which was displayed at the authorization endpoint.\r\n\r\n # This demo implementation regards the credentials of the end-user\r\n # as valid when the value of ID and that of password are equal.\r\n if req.id == req.password\r\n # Use the ID as the unique identifier (subject) of the end-user.\r\n # Note that this is not always true on actual services.\r\n return req.id\r\n end\r\n\r\n # The credentials of the end-user are invalid.\r\n nil\r\n end",
"title": ""
},
{
"docid": "10d8448e7e187686b24c8149e322a5a9",
"score": "0.6404692",
"text": "def authenticate_user; end",
"title": ""
},
{
"docid": "e2f81e330801929fd07b36716ea83474",
"score": "0.6387982",
"text": "def two_factor_auth\n end",
"title": ""
},
{
"docid": "e9a8d3a2f9e77e404dc12ef2db074ef3",
"score": "0.6351021",
"text": "def authenticated(password)\n authenticate(password)\n end",
"title": ""
},
{
"docid": "5a51e973c44c8d4e1cb6f8c9abe21164",
"score": "0.6318721",
"text": "def authenticate(*args); end",
"title": ""
},
{
"docid": "d341c208cc3cfae72ccc5450eb32b064",
"score": "0.6302706",
"text": "def authenticate\n user = AuthenticateUser.new(auth_params[:email], auth_params[:password]).user\n\n session[:user_id] = user.id\n session[:expiration_time] = Time.now + 6*60*60 # 6 hours until expiration\n\n response = { message: Message.logged_in_successfully }\n json_response(response)\n end",
"title": ""
},
{
"docid": "989bf074e827af4f9d941d16abb182ff",
"score": "0.6288437",
"text": "def authenticate; end",
"title": ""
},
{
"docid": "ba46f68b71856585ae84c5cc9a6628d1",
"score": "0.62691057",
"text": "def login_from_pubcookie(require_identity = nil)\n #logger.info { \"login_from_pubcookie() -- required_identity: #{require_identity}\" }\n uwnetid, passwd = get_auth_data\n #logger.info \"uwnetid #{uwnetid} detected in HTTP_AUTHORIZATION -- required identity: #{require_identity}\" if uwnetid\n LoginHistory.login(PubcookieUser.authenticate(uwnetid, passwd, require_identity), (request.env[\"HTTP_X_FORWARDED_FOR\"] || request.env[\"REMOTE_ADDR\"]), session.session_id) if uwnetid\n self.current_user = PubcookieUser.authenticate(uwnetid, passwd, require_identity) if uwnetid \n end",
"title": ""
},
{
"docid": "cd99d0142a9d89ecb7ae94972eca6bba",
"score": "0.62511915",
"text": "def authenticate\n\t\tcredentials = credential_params\n\t\tuser_candidate = User.where(email: credentials[:email], password: User.hash_password(credentials[:password])).first\n\n\t\tredirect_to user_login_path if user_candidate.nil? \n\n\t\tsession[:user_id] = user_candidate.id\n\n\t\tredirect_to dashboard_index_path\n\tend",
"title": ""
},
{
"docid": "c8cce276f57229d3cba372f278108202",
"score": "0.6238211",
"text": "def authenticate_user!\n authenticate_customer!\n end",
"title": ""
},
{
"docid": "1bc2c1673d47e276341d11e46adb033b",
"score": "0.62197655",
"text": "def invoke_auth; end",
"title": ""
},
{
"docid": "0434a09494de6f3fc1887081409aaadf",
"score": "0.62110007",
"text": "def authenticate\n end",
"title": ""
},
{
"docid": "0434a09494de6f3fc1887081409aaadf",
"score": "0.62110007",
"text": "def authenticate\n end",
"title": ""
},
{
"docid": "0434a09494de6f3fc1887081409aaadf",
"score": "0.62110007",
"text": "def authenticate\n end",
"title": ""
},
{
"docid": "0d14db759b186383f90f7ccd0ceaf8e0",
"score": "0.62043303",
"text": "def authenticate!(*args); end",
"title": ""
},
{
"docid": "6f398155fbd1bc3d5baae76ac536cdc2",
"score": "0.6201732",
"text": "def auth(password); end",
"title": ""
},
{
"docid": "ebe19d5d10b8e7201a635bd9e3a5c833",
"score": "0.6200785",
"text": "def authenticate(request, realm, &password_procedure); end",
"title": ""
},
{
"docid": "fba2973782b28584828eb190e5d82603",
"score": "0.61991274",
"text": "def authenticate_inviter!\n authenticate_user!(force: true)\n end",
"title": ""
},
{
"docid": "de3a31f5f97ee45a7152d4518cae0cd8",
"score": "0.6196783",
"text": "def authenticate_user\n uri = URI @identity_endpoint\n http = Net::HTTP.new(uri.host, uri.port)\n if uri.scheme == 'https'\n http.use_ssl = true\n end\n req = Net::HTTP::Post.new(uri.path)\n content = {\n 'auth' => {\n 'passwordCredentials' => {\n 'username' => @identity_username,\n 'password' => @identity_password\n }\n }\n }\n req.body = content.to_json\n req['content-type'] = 'application/json'\n req['accept'] = 'application/json'\n res = http.request(req)\n\n case res\n when Net::HTTPSuccess\n # Get the token\n JSON.parse(res.body)['access']['token']['id']\n else\n raise \"Unable to authenticate with identity at #{@identity_endpoint} as #{@identity_username}\"\n end\n end",
"title": ""
},
{
"docid": "99d07185a8c7b607c88b315cd95eefea",
"score": "0.61890346",
"text": "def authenticate\n raise AuthenticationRequiredError unless could_authenticate?\n request = Viddler::Request.new(:get, 'users.auth')\n request.run do |p|\n p.api_key = @api_key\n p.user = @username\n p.password = @password\n end\n @session_id = request.response['auth']['sessionid']\n end",
"title": ""
},
{
"docid": "30f034c4d726542b7f3a1831f96e96e9",
"score": "0.61660874",
"text": "def authenticate\n request_access('password', username: @username, password: @password)\n end",
"title": ""
},
{
"docid": "956c39f4b6a99b36d6f2cff9babbc45d",
"score": "0.6166056",
"text": "def auth_user_0\n post session_url, params: { session: { email: '[email protected]', password: 'admin' } }\n end",
"title": ""
},
{
"docid": "11d12bd4d2cddef22a8124c76bee1444",
"score": "0.61606854",
"text": "def assine_auth(user, passwd)\n SubscriptionsClient::Subscriptions.relations.assine_auth.post do |req|\n req.body = {email: user, password: passwd}.to_json\n end\n end",
"title": ""
},
{
"docid": "e62f05688c074c5ff6713901ef43824d",
"score": "0.61550695",
"text": "def authorize(participant_id, username, password)\n @participant_id = participant_id\n @auth = { username: username, password: password }\n end",
"title": ""
},
{
"docid": "092108b14e7afd46c56210c7272b3b7a",
"score": "0.6140893",
"text": "def authenticate!\n success! @@user\n end",
"title": ""
},
{
"docid": "c56d18ba254bfb1dc34df33678b92381",
"score": "0.6130746",
"text": "def authenticate!(username, password, get_record_token=false)\n auth = get 'viddler.users.auth', :user => username, :password => password, :get_record_token => (get_record_token ? 1 : 0)\n self.record_token = auth['auth']['record_token'] if get_record_token\n self.sessionid = auth['auth']['sessionid']\n end",
"title": ""
},
{
"docid": "4a05dc67308028c7f39ce45e7ec720de",
"score": "0.61126566",
"text": "def authenticate(params)\n Clearance.configuration.user_model.authenticate(\n params[:session][:email], params[:session][:password]\n )\n end",
"title": ""
},
{
"docid": "7d84ed0d32452601121577f75ac1f0fb",
"score": "0.6107177",
"text": "def authenticate!\n end",
"title": ""
},
{
"docid": "7d84ed0d32452601121577f75ac1f0fb",
"score": "0.6107177",
"text": "def authenticate!\n end",
"title": ""
},
{
"docid": "aca46f5616d420de2663e36d045956aa",
"score": "0.60881084",
"text": "def user_auth(email, pass, id = nil)\n send_req({act: :user_auth, cloudflare_email: email, cloudflare_pass: pass, unique_id: id})\n end",
"title": ""
},
{
"docid": "7084fe77c7c433c1759507f1cdb9dda8",
"score": "0.6087952",
"text": "def preauthenticate; end",
"title": ""
},
{
"docid": "8f78043742ffccfbcf6b38c5244e416d",
"score": "0.60865843",
"text": "def authenticate(user)\n session[:user] = user.id\n end",
"title": ""
},
{
"docid": "4258acbc4aafc018d9eb13cc5c4e99b0",
"score": "0.6068338",
"text": "def authorize(username, password); end",
"title": ""
},
{
"docid": "4258acbc4aafc018d9eb13cc5c4e99b0",
"score": "0.6068338",
"text": "def authorize(username, password); end",
"title": ""
},
{
"docid": "4258acbc4aafc018d9eb13cc5c4e99b0",
"score": "0.6068338",
"text": "def authorize(username, password); end",
"title": ""
},
{
"docid": "4dcaa4568edeff9ec9e94fe6ebe6b3e5",
"score": "0.6065649",
"text": "def authenticate\n provider = params[:provider]\n access_token = params[:access]\n uri = URI.parse(self.send(\"#{provider}_info\".to_sym, access_token))\n user_info = JSON.parse(uri.read)\n @user = User.find_by_provider(user_info, provider)\n cookies.permanent.signed[:user_c] = @user.id\n login(@user.email)\n end",
"title": ""
},
{
"docid": "16abe8be64b188d884645c6d21ffa5fb",
"score": "0.6063805",
"text": "def auth username, password\n #if Users::V1::User.where(username: username).exists?\n if Utter::SimpleAuth::User.exists?(username)\n\tuser = Utter::SimpleAuth::User.find(username)\n\tif user.password == password\n\t @user = user\n\t 'success: return user session token to the client app which expires in 24hours'\n\telse\n\t @user = nil\n\t 'failure!'\n\tend\n else \n\t@user = nil\n\t'failure!'\n end\n end",
"title": ""
},
{
"docid": "d2cf7e3e33e42982fb271dc23677dbe4",
"score": "0.60606444",
"text": "def auth\n unless session[:user_id].nil? then\n @current_user = User.find(session[:user_id])\n @activeRole = session[:activeRole]\n end\n end",
"title": ""
},
{
"docid": "e50a1328c48b8c5edf6f1104e5009ffa",
"score": "0.6060568",
"text": "def authenticate\n\n end",
"title": ""
},
{
"docid": "8f21c2b0c982453d47ae3af95cf5cbb4",
"score": "0.60475314",
"text": "def authenticate_with( identity, next_service, username, key_manager )\n client_username = ENV['USER'] || username\n\n req = build_request identity, next_service, username,\n @hostname+\".\", client_username\n\n sig_data = @buffers.writer\n sig_data.write_string @session_id\n sig_data.write req\n\n sig = key_manager.sign( identity, sig_data.to_s )\n\n message = @buffers.writer\n message.write req\n message.write_string sig\n\n @messenger.send_message message\n message = @messenger.wait_for_message\n\n case message.message_type\n when USERAUTH_SUCCESS\n return true\n when USERAUTH_FAILURE\n return false\n else\n raise Net::SSH::Exception,\n \"unexpected server response to USERAUTH_REQUEST: \" +\n message.inspect\n end\n end",
"title": ""
},
{
"docid": "f0d801fae2ae53e443ea968b26f45022",
"score": "0.6032145",
"text": "def invoke_auth\n if @args[:auth]\n if @args[:auth][:type] == :plain\n psw = @args[:auth][:password]\n if psw.respond_to?(:call)\n psw = psw.call\n end\n #str = Base64::encode64(\"\\0#{@args[:auth][:username]}\\0#{psw}\").chomp\n str = [\"\\0#{@args[:auth][:username]}\\0#{psw}\"].pack(\"m\").gsub(/\\n/, '')\n send_data \"AUTH PLAIN #{str}\\r\\n\"\n @responder = :receive_auth_response\n else\n return invoke_internal_error(\"unsupported auth type\")\n end\n else\n invoke_mail_from\n end\n end",
"title": ""
},
{
"docid": "ecc205bd2d1555f1812359ea1d66afb8",
"score": "0.6024499",
"text": "def authenticate_inviter!\n send(:\"authenticate_#{resource_name}!\")\n end",
"title": ""
},
{
"docid": "d8207d52050dff362cf314c64ba0145b",
"score": "0.5992917",
"text": "def authenticate_user!\n identify_user(true)\n end",
"title": ""
},
{
"docid": "d8207d52050dff362cf314c64ba0145b",
"score": "0.5992917",
"text": "def authenticate_user!\n identify_user(true)\n end",
"title": ""
},
{
"docid": "985e506da0a941e733bffd54509f6f4d",
"score": "0.5984452",
"text": "def authenticate_with( identity, next_service, username, key_manager )\n send_request identity, username, next_service\n\n message = @messenger.wait_for_message\n\n case message.message_type\n when USERAUTH_PK_OK\n sig_data = @buffers.writer\n sig_data.write_string @session_id\n build_request identity, username, next_service, true, sig_data\n\n sig_blob = key_manager.sign( identity, sig_data )\n\n send_request identity, username, next_service, sig_blob.to_s\n message = @messenger.wait_for_message\n\n case message.message_type\n when USERAUTH_SUCCESS\n return true\n when USERAUTH_FAILURE\n return false\n else\n raise Net::SSH::Exception,\n \"unexpected server response to USERAUTH_REQUEST: \" +\n message.inspect\n end\n\n when USERAUTH_FAILURE\n return false\n\n else\n raise Net::SSH::Exception,\n \"unexpected reply to USERAUTH_REQUEST: #{message.inspect}\"\n end\n end",
"title": ""
},
{
"docid": "54dd24e121c1c7be13b9ce228c2106d3",
"score": "0.59715664",
"text": "def auth pw = nil\n\t\t\tif (!pw.nil?)\n\t\t\t\tself.send \"AUTHENTICATE \\\"#{pw}\\\"\"\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "bb804c4bc2f3d92af5bdc1b54e74c58d",
"score": "0.59364545",
"text": "def authenticate!\n vars = JWT.decode(request.env[\"HTTP_ACCESS_TOKEN\"], ENV['SECRET_TOKEN']) rescue 'Invalid token' \n access_granted = (vars[0][\"user_id\"]==ENV['ADMIN_ID'])\n !access_granted ? fail!(\"Could not log in\") : success!(access_granted)\n end",
"title": ""
},
{
"docid": "e27b160ac701437a8a69bc63fff3cd87",
"score": "0.59356713",
"text": "def authenticate\n puts '#> authenticating'\n uname = params[:uname]\n upassword = params[:upassword]\n \n # no creadentials\n if uname.nil? or upassword.nil?\n # check if already logged in\n ticket = session[:ticket]\n if not ticket.nil?\n @user_id = decrypt(ticket)\n else\n record_user\n end\n else # check credentials\n get_user_from_credentials(uname, upassword)\n end\n \n if @user.nil? # we haven't got a user yet\n get_user_from_id\n end\n if @user.nil? and @user_id != Globals::DEFAULT[:user_id] # retry 'anon' as we might have picked up a crap cookie\n get_user_from_uid('anon')\n end\n if @user.nil? # FAILURE\n throw 'Authentication failed, unable to find even a default user to authenticate as'\n end\n # add the users details to the view state\n # but ensure that their password isn't exposed while\n # noting that an empty/null password will present\n # 'anon' as the password\n @user.set_password('')\n @view_state[:user] = @user\n end",
"title": ""
},
{
"docid": "583fae1f6273bfb066f6d417421af1b9",
"score": "0.59255105",
"text": "def authenticate(username, password)\n param = {}\n param[:id] = @id\n param[:secid] = @secid\n param[:username] = username\n param[:password] = password\n data = Storm::Base::SODServer.remote_call \\\n '/Support/Ticket/authenticate', param\n data[:authenticated].to_i == 0 ? false : true\n end",
"title": ""
},
{
"docid": "bfd0b2906f601fdfb51d909d0b5382a2",
"score": "0.5922533",
"text": "def authenticate(srv_user, srv_pass, signed_text)\n begin\n # truncate token to 32-bytes for Ruby >= 2.4\n @key = srv_pass[0..31]\n @iv = srv_pass[0..15]\n\n token_array = decrypt(signed_text).split(':')\n\n s_user = token_array[0]\n expires = token_array[-1]\n\n return \"User name missmatch\" if s_user != srv_user\n\n return \"login token expired\" if Time.now.to_i >= expires.to_i\n\n return true\n rescue => e\n return e.message\n end\n end",
"title": ""
},
{
"docid": "43e6d871d083d0f452d330810c16ff2d",
"score": "0.5918427",
"text": "def rcon_auth(password); end",
"title": ""
},
{
"docid": "04042779636493f200b7e7e847f35dfc",
"score": "0.59132874",
"text": "def authenticate\n \t#property = Property.find(25)\n \t#if property.authenticate(params[:password])\n if params[:password] == \"Toledo123\"\n session[:granted] = true\n flash[:title] = \"Success\"\n flash[:notice] = \"Access Granted\"\n redirect_to action: :edit_survey\n\t else\n\t \tflash[:title] = \"Error\"\n flash[:notice] = \"Access Denied\"\n redirect_to action: :access\n\t end\n end",
"title": ""
},
{
"docid": "1c3dbcbae188d465d15ea8cf68ffbbb1",
"score": "0.59100646",
"text": "def authenticate\n if session[:auth_via]\n case session[:auth_via]\n when :cas\n if impersonating?\n Authorization.current_user = User.find_by_id(session[:impersonation_id])\n else\n Authorization.current_user = User.find_by_id(session[:user_id])\n end\n end\n logger.info \"User authentication passed due to existing session: #{session[:auth_via]}, #{session[:user_id]}, #{Authorization.current_user}\"\n return\n end\n\n # It's important we do this before checking session[:cas_user] as it\n # sets that variable. Note that the way before_filters work, this call\n # will render or redirect but this function will still finish before\n # the redirect is actually made.\n CASClient::Frameworks::Rails::Filter.filter(self)\n\n if session[:cas_user]\n @user = User.find_or_initialize_by(loginid: session[:cas_user])\n\n if @user.new_record?\n rm_json = RolesManagement.fetch_json_by_loginid(@user.loginid)\n if rm_json\n @user.rm_id = rm_json[\"id\"]\n @user.name = rm_json[\"name\"]\n @user.email = rm_json[\"email\"]\n \n Authorization.ignore_access_control(true)\n\n @user.save!\n\n Authorization.ignore_access_control(false)\n else\n session[:user_id] = nil\n session[:auth_via] = nil\n Authorization.current_user = nil\n\n logger.warn \"CAS user is valid but could not be found in Roles Management.\"\n\n redirect_to access_denied_path\n return\n end\n end\n\n # Valid user found through CAS.\n session[:user_id] = @user.id\n session[:auth_via] = :cas\n Authorization.current_user = @user\n\n logger.info \"Valid CAS user. Passes authentication.\"\n end\n end",
"title": ""
},
{
"docid": "52acf5f6a44cdac6c7aaad17dc9f1957",
"score": "0.5898406",
"text": "def login_via_webauth\n login_via_webauth_with @username, @password\n end",
"title": ""
},
{
"docid": "04e65379635e1f61d3b229b5726ee84f",
"score": "0.58827263",
"text": "def auth; end",
"title": ""
},
{
"docid": "11ae1ce1e56254459ab67f18f82af7e2",
"score": "0.58820933",
"text": "def login\n authenticate params[:phone_number], params[:password]\n end",
"title": ""
},
{
"docid": "2d5a77a310a0d0be9b5a1b8866bc0975",
"score": "0.58754355",
"text": "def sign_in\n @user = User.find_by_email(params[:email])\n if @user && @user.authenticate(params[:password])\n auth_token = Knock::AuthToken.new payload: {sub: @user.id}\n render json: {username: @user.username, jwt: auth_token.token}, status: 200\n else\n render json: {error: \"Incorrect email or password\"}, status: 404\n end\n end",
"title": ""
},
{
"docid": "f964ae5258cbf1ad71af0568589458ed",
"score": "0.5870524",
"text": "def subject_authenticate\n @statistician = Statistician.find(params[:id])\n \n if params[:commit] == \"Continue\"\n begin\n #simply authentication, passcode per subject\n #key must be unique. If stronger authentication is \n #needed this will have to change. For lab scenerios and studies\n #this should be fine.\n @subject = Subject.where(:password => params[:pass]).first\n if [email protected]?\n session[:subject_id] = @subject.id\n session[:is_subject_authenticated] = true\n redirect_to(:action => \"begin\", :id => @statistician.id)\n return\n else\n flash[:notice] = \"Password and/or Respondant ID is incorrect. Please try agian.\";\n session[:is_subject_authenticated] = false\n end\n rescue\n flash[:notice] = \"Error has occured\";\n session[:is_authenticated] = false\n end\n end\n \n render :layout => \"statistician\"\n end",
"title": ""
},
{
"docid": "0d76bcd45be6508d31320acab230ffb7",
"score": "0.5860491",
"text": "def authenticate!\n calculate_user_session_key!\n type3_opts = {\n :lm_response => lmv2_resp,\n :ntlm_response => ntlmv2_resp,\n :domain => domain,\n :user => username,\n :workstation => workstation,\n :flag => (challenge_message.flag & client.flags)\n }\n t3 = Message::Type3.create type3_opts\n if negotiate_key_exchange?\n t3.enable(:session_key)\n rc4 = OpenSSL::Cipher.new(\"rc4\")\n rc4.encrypt\n rc4.key = user_session_key\n sk = rc4.update exported_session_key\n sk << rc4.final\n t3.session_key = sk\n end\n t3\n end",
"title": ""
},
{
"docid": "e1559dd4222eb74905a8c60d577c8ef6",
"score": "0.58540773",
"text": "def authenticate(user_id, password)\n run_authenticated(user_id, password) do\n @@p4.run_login # Guaranteed to fail with bad user_id/password\n @@p4.run_logout # This _doesn't_ need to be in an ensure block\n end\n end",
"title": ""
},
{
"docid": "3a1cee2b58b7428e6de26c278eaae42a",
"score": "0.5852412",
"text": "def temp_authenticate\n user_id, user_passcode = params[:id], params[:pcd]\n user = find_user(user_id)\n if (!user.nil? && user.pending? && !current_user?(user))\n user = User.authenticate(user.email, user_passcode)\n sign_in(user) if !user.nil?\n end\n end",
"title": ""
},
{
"docid": "a135795f4dfad1dc9a307042793fa562",
"score": "0.58445376",
"text": "def authenticate \n return if skip_authentication?\n authenticate_or_request_with_http_basic do |name, pass| \n subject = Subject.authenticate(name, pass)\n if subject != nil\n session[:subject_id] = subject.id #this subject_id is stored in the session to be used in has_access method of a subjects_controller, essentially this is a logged in user id\n session[:subject_name] = subject.name\n true\n end\n end\n end",
"title": ""
},
{
"docid": "da6684b5b000559b50637df5c0990ea8",
"score": "0.58425456",
"text": "def auth(user, password)\n @user = user\n @password = password\n end",
"title": ""
},
{
"docid": "9fefb043b842db23de7493545aeb9ca5",
"score": "0.5842355",
"text": "def authenticate(params)\n ::User.authenticate(params[:session][:email],\n params[:session][:password])\n end",
"title": ""
},
{
"docid": "a6c890e6d654f58bd7e276051dd9491e",
"score": "0.5831228",
"text": "def auth(params = {})\n update_userpool_cache if @conf[:use_user_pool_cache]\n do_auth(params)\n end",
"title": ""
},
{
"docid": "57c17d209c012ccf59cd30b220696a36",
"score": "0.58296543",
"text": "def authenticate(passwd)\n \tself.password = passwd\n \tif authenticated? then self else nil end\n end",
"title": ""
},
{
"docid": "caebd69b11b7caab7a9d8a49914b8d89",
"score": "0.58161473",
"text": "def authenticate(password)\n authenticate_user(username, password)\n end",
"title": ""
},
{
"docid": "1eb95787e6c000f14d11db13d9a67982",
"score": "0.5809712",
"text": "def login\n enterCredentials\n authenticate\n end",
"title": ""
},
{
"docid": "6899252c413ce8e74387cd475a791070",
"score": "0.5799653",
"text": "def authenticate_with_identity\n if user_signed_in?\n # User is already authorized. So, the identity could not be attached to him\n redirect_after_authenticate_with_identity_signed_in\n else\n # User is unauthorized. Authorize him\n sign_in @identity.user\n redirect_after_authenticate_with_identity\n end\n end",
"title": ""
},
{
"docid": "6785c1047a56bb915cfd14dcd2fba3b1",
"score": "0.5793133",
"text": "def authenticate_user\n if !env['HTTP_AUTHORIZATION'].nil?\n # authentification with reverse proxy setting HTTP_AUTHORIZATION header\n user, pass = Base64.decode64(env['HTTP_AUTHORIZATION'].split[1]).split ':', 2\n elsif !request.env['REMOTE_USER'].nil?\n user = request.env['REMOTE_USER']\n else\n user = nil\n end\n\n if !user.nil?\n logger.debug \"Logging user #{user}\"\n\n #puts \"You have been automatically authenticated as #{session['REMOTE_USER']} thanks to kerberos !\"\n #If user is already logged in the application, we do not retrieve again his information from ldap\n if session[:user_id].nil?\n authenticated_user = User.find_or_create_from_ldap(user)\n if authenticated_user\n session[:user_id] = authenticated_user.id\n else\n flash[:error] = \"User information can not been retrieved. Please contact support team.\"\n render :text => authentication_failed_path\n end\n end\n\n if params[:response_type].nil?\n params[:response_type] = \"code\"\n end\n\n #1- User wants to access a page\n if !params[:scope].nil? && params[:scope] == \"#{BASE_URL}\"\n render :text => params[:redirect_uri]\n else\n #2 - User has been redirected on the application via a client application\n @authorizer = OAuth::Provider::Authorizer.new current_user, true, params\n render :text => @authorizer.redirect_uri\n end\n\n else\n render :text => authentication_failed_path\n end\n\n end",
"title": ""
},
{
"docid": "60e47c7dfe789bffaff931e704744298",
"score": "0.5787145",
"text": "def authenticate_subscribe(message)\n\t\t\t\tsubscription = PrivatePub.subscription(channel: message['subscription'], timestamp: message['ext']['private_pub_timestamp'])\n\t\t\t\t#Redis.current.hset('log', \"#{Time.now.to_i}_auth\", {message_subscription: message['subscription'], client_id: message['clientId']})\n\t\t\t\tif message['ext']['private_pub_signature'] != subscription[:signature]\n\t\t\t\t\tmessage['error'] = \"Incorrect signature.\"\n\t\t\t\telsif PrivatePub.signature_expired? message['ext']['private_pub_timestamp'].to_i\n\t\t\t\t\tmessage['error'] = \"Signature has expired.\"\n\t\t\t\telsif message['subscription'].index('/feed/actor') == 0\n\t\t\t\t\tputs \"\\nincoming new subscription: #{message['subscription']}\"\n\t\t\t\t\tcurrent_subsciptions = Redis.current.hgetall('subscriptions')\n\t\t\t\t\tpresent_subscription = current_subsciptions[message['subscription']]\n\t\t\t\t\tputs \"already present sub by this actor? #{!present_subscription.nil? && present_subscription.length != 0}\"\n\t\t\t\t\tif present_subscription\n\t\t\t\t\t\tclient_ids = eval(present_subscription)[:client_ids]\n\t\t\t\t\t\tclient_ids[message['clientId']] = Time.now.to_i\n\t\t\t\t\telse\n\t\t\t\t\t\tclient_ids = {message['clientId'] => Time.now.to_i}\n\t\t\t\t\tend\n\t\t\t\t\t## begin try\n\t\t\t\t\tbegin\n\t\t\t\t\t\tputs \"writing new subscription, now #{client_ids.length} channels in total\"\n\t\t\t\t\t\tRedis.current.hset('subscriptions', message['subscription'], {time: Time.now.to_i, client_ids: client_ids})\n\t\t\t\t\t\tping_online_actors_change_to_rails(message['subscription'], 'subscribing')\n\t\t\t\t\trescue Exception => e\n\t\t\t\t\t\tputs \"\\nException: #{e}\\n\"\n\t\t\t\t\tend\n\t\t\t\t\t## end try\n\t\t\t\tend\n\t\t\tend",
"title": ""
},
{
"docid": "60d9fbd3e0982d992386f94875985714",
"score": "0.57850325",
"text": "def authenticate\n determine_node_name unless @node_name\n Chef::Log.debug(\"Authenticating #{@safe_name} via openid\") \n response = @rest.post_rest('openid/consumer/start', { \n \"openid_identifier\" => \"#{Chef::Config[:openid_url]}/openid/server/node/#{@safe_name}\",\n \"submit\" => \"Verify\"\n })\n @rest.post_rest(\n \"#{Chef::Config[:openid_url]}#{response[\"action\"]}\",\n { \"password\" => @secret }\n )\n end",
"title": ""
},
{
"docid": "fa6526d3fd557f8a24ba2a64757d065e",
"score": "0.57801276",
"text": "def auth\n end",
"title": ""
},
{
"docid": "c5bc98d194aacda6ab6bb4ad1ea1a3ef",
"score": "0.57774967",
"text": "def authenticate(*args)\n @access = @auth.authenticate(*args)\n end",
"title": ""
},
{
"docid": "76b36ffc46426177b661c3eb1ec13d55",
"score": "0.57731533",
"text": "def subscribe_request\n send_subscribe_request do |response|\n if response\n debug [self.name, \"authentication successed\"]\n add_to_pool\n EventMachine.add_timer(0.1) do\n send_authentication(\"success\")\n end\n @authenticated_by_url = true\n else\n debug [self.name, \"authentication failed\"]\n EventMachine.add_timer(0.1) do\n send_authentication(\"failure\")\n disconnect\n end\n end\n end unless admin || authenticated?\n end",
"title": ""
},
{
"docid": "f428657732c496cf505e2a597b56ce57",
"score": "0.5772219",
"text": "def authenticate\n expose Account.authenticate(@oauth_token, params[:membername], params[:password])\n end",
"title": ""
},
{
"docid": "78efa0b66c27788ab59dc7058673b472",
"score": "0.5770048",
"text": "def authenticate(req, res)\n unless basic_credentials = check_scheme(req)\n challenge(req, res)\n end\n userid, password = basic_credentials.unpack(\"m*\")[0].split(\":\", 2)\n password ||= \"\"\n if userid.empty?\n error(\"user id was not given.\")\n challenge(req, res)\n end\n unless encpass = @userdb.get_passwd(@realm, userid, @reload_db)\n error(\"%s: the user is not allowed.\", userid)\n challenge(req, res)\n end\n\n case encpass\n when /\\A\\$2[aby]\\$/\n password_matches = BCrypt::Password.new(encpass.sub(/\\A\\$2[aby]\\$/, '$2a$')) == password\n else\n password_matches = password.crypt(encpass) == encpass\n end\n\n unless password_matches\n error(\"%s: password unmatch.\", userid)\n challenge(req, res)\n end\n info(\"%s: authentication succeeded.\", userid)\n req.user = userid\n end",
"title": ""
},
{
"docid": "13f45ddeba937e4f4388e11518190c59",
"score": "0.57617223",
"text": "def authenticate_the_orcid!(orcid_profile_id, orcid_profile_password)\n code = RequestSandboxAuthorizationCode.call(orcid_profile_id: orcid_profile_id, password: orcid_profile_password)\n token = Orcid.oauth_client.auth_code.get_token(code)\n normalized_token = {provider: 'orcid', uid: orcid_profile_id, credentials: {token: token.token, refresh_token: token.refresh_token }}\n Devise::MultiAuth::CaptureSuccessfulExternalAuthentication.call(user, normalized_token)\n end",
"title": ""
},
{
"docid": "e718ea21e9d8bef0404baf3c8a1d42ab",
"score": "0.57603616",
"text": "def authenticate(*args)\n warden.authenticate(*args)\n end",
"title": ""
},
{
"docid": "200bde9df4c1f8e565d3677925886e95",
"score": "0.57603544",
"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\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": "29878fe7dcf904d1acc9a320568cdd58",
"score": "0.57598144",
"text": "def set_subscriber\n @subscriber = Subscriber.find(params[:id])\n\n authorize @subscriber\n end",
"title": ""
},
{
"docid": "758dedee6586540c50fc236286b88715",
"score": "0.5754021",
"text": "def current_inviter\n authenticate_inviter!\n end",
"title": ""
},
{
"docid": "f96d67674c1993c16125445b255cf094",
"score": "0.57472736",
"text": "def digest_authorize(username, password); end",
"title": ""
},
{
"docid": "f96d67674c1993c16125445b255cf094",
"score": "0.57472736",
"text": "def digest_authorize(username, password); end",
"title": ""
},
{
"docid": "1d671b0ff4dc0a277c0b565048ee09fd",
"score": "0.57464796",
"text": "def authenticate_user(email, password)\n params = [email, password]\n data = Bankin::Client::Post.create_data_client('/authenticate', Bankin::Client::nb_params(params), params, @client_id, @client_secret)\n unless data.eql?(false)\n url = Bankin::Url::Post.create_url(data)\n encoded_url = URI.encode(url)\n uri = URI.parse(encoded_url)\n req = Net::HTTP::Post.new(uri, initheader = Bankin::Header.init())\n req.body = Bankin::Body::Post.init('/authenticate', data)\n default = {use_ssl: true}\n res = Net::HTTP.start(uri.host, uri.port, default, ) do |http|\n http.request(req)\n end\n Bankin::Response.send(res)\n end\n # END AUTHENTICATE_USER(email, password)\n end",
"title": ""
},
{
"docid": "d14b62a631f773ef44838d71dae58196",
"score": "0.5746355",
"text": "def authenticate_inviter!\n false\n end",
"title": ""
},
{
"docid": "7634a5768c1518868e05bf4cd50f1c5d",
"score": "0.5744307",
"text": "def subscribe\n @current_user.update!(\n endpoint: params[:subscription][:endpoint],\n p256dh: params[:subscription][:keys][:p256dh],\n auth: params[:subscription][:keys][:auth],\n alerts: true,\n )\n end",
"title": ""
},
{
"docid": "9befc132b9b5a62e9f8457eeb32b923c",
"score": "0.57417554",
"text": "def authenticate\n @account = Service.new()\n @account.debug = true\n @account.authenticate('[email protected]', 'grateurdunet')\n end",
"title": ""
},
{
"docid": "49eb8fa0e99f67dd4f123bb42f2799d1",
"score": "0.57388127",
"text": "def authenticate\n user = User.find_by_credentials(params[:email], params[:password]) # you'll need to implement this\n if user\n render json: { id: user.id, auth_token: user.generate_auth_token }, status: 200\n else\n render json: { error: 'Invalid username or password' }, status: 401\n end\n end",
"title": ""
},
{
"docid": "ace003af5701f8acd1c2614de13508f8",
"score": "0.57370144",
"text": "def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n # salt pw\n password += 'rushmore98'\n # encrypt pw\n password = Digest::MD5.hexdigest(password)\n username == USER_ID && password == PASSWORD\n end\n end",
"title": ""
},
{
"docid": "8f2cd22e3314e1bb039ae15af6ae522d",
"score": "0.573625",
"text": "def authenticate\n options = {\n body: \"username=#{@user}&password=#{@pass}\"\n }\n\n # Have to clear out the cookies or the old SID gets sent while requesting\n # the new SID (and it fails).\n self.class.cookies.clear\n\n res = self.class.post('/login', options)\n if res.success?\n token = res.headers[\"Set-Cookie\"]\n raise QbtClientError.new(\"Login failed: no SID (cookie) returned\") if token.nil?\n\n token = token.split(\";\")[0]\n @sid = token\n else\n raise QbtClientError.new(res)\n end\n end",
"title": ""
},
{
"docid": "d323c99518c912dad7f007f2e611491e",
"score": "0.57336634",
"text": "def authenticate_inviter!\n authenticate_admin!(:force => true)\n end",
"title": ""
},
{
"docid": "bea398407c817ccc1e49b63f6fc76b17",
"score": "0.57330614",
"text": "def authenticate!\n\t\terror!('Unauthorized', 401) if !is_authenticated\n @request_user\n\tend",
"title": ""
},
{
"docid": "9d9a4d71eb478f05fc68edf75dc2fee1",
"score": "0.57320523",
"text": "def authenticate\n \tif session[\"user_id\"].nil?\n \t\tflash[:notice] = 'You must be logged in to complete this action.'\n \t\tredirect_to :controller => 'sessions', :action => 'new'\n \tend\n end",
"title": ""
},
{
"docid": "a418b3f379a69b36cb33c287f7943151",
"score": "0.573188",
"text": "def userAuth\n \n if params[:email] and params[:password]\n user = User.find_by_email(params[:email])\n if user && user.authenticate(params[:password])\n respond_to do |format|\n format.json { render :json => {:status => 200, :message => \"Authentication accepted\", :user => user}, :status => status }\n format.xml { render :xml => {:status => 200, :message => \"Authentication accepted\", :user => user}, :status => status }\n end\n else\n error(403, 403, \"Not Authenticated\")\n end\n else\n error(403, 403, \"Not Authenticated\")\n end\n end",
"title": ""
},
{
"docid": "446221067afbc820e8348f4aee388c19",
"score": "0.57276785",
"text": "def authenticate\n command = AuthenticateUser.call(params[:email], params[:password])\n\n if command.success?\n render json: { auth_token: command.result, expiration_in: 7200 }\n else\n render json: { error: command.errors }, status: :unauthorized\n end\n end",
"title": ""
},
{
"docid": "8882a5ca529018d38967958f155eb37b",
"score": "0.5724538",
"text": "def authenticate_user_from_token!\n if claims and user = User.find_by(email: claims[0]['user']) and user.encrypted_password == claims[0]['password']\n @current_user = user\n else\n return render_unauthorized\n end\n end",
"title": ""
}
] |
6272a1f1934fc1c5efb28eb1426cbd29
|
The on_line? method is used to determine if the point is on a line. See module Geom for the various ways to specify a line.
|
[
{
"docid": "563df4b7c474ce385be901af8444607e",
"score": "0.68241256",
"text": "def on_line?(line)\n end",
"title": ""
}
] |
[
{
"docid": "8791bb463290b31d084290712a3a2e34",
"score": "0.8088679",
"text": "def point_is_on_line?(point)\n ((@x_coefficient * point.x + @y_coefficient * point.y + @free_coefficient) - 0.0).abs < 0.0001\n end",
"title": ""
},
{
"docid": "5a43b03b29bf8991ca078d8a1cc82ce2",
"score": "0.7812587",
"text": "def point_is_on_line?(p1)\n p1.y==@slope*p1.x + @free_term\n end",
"title": ""
},
{
"docid": "24fe35b8292ee32f21315ab757547fdc",
"score": "0.7298293",
"text": "def line?\n 'line' == self.type\n end",
"title": ""
},
{
"docid": "d1018f06e76e939d230dd4e0ba2c5ecc",
"score": "0.7282929",
"text": "def contains_line(line)\n\t\tpoint = line.get_center\n\t\treturn point[0] > @x1 && point[0] < @x2 && point[1] > @y1 && point[1] < @y2\n\tend",
"title": ""
},
{
"docid": "ec8137c9a1707b70f27e2a41300677bf",
"score": "0.71413964",
"text": "def test_on_line_true_from_at_origin\n status = nil\n assert_nothing_raised do\n line = [Geom::Point3d.new(0,0,0), Geom::Vector3d.new(0,0,1)]\n a = [0.0.to_i,0.0.to_f,0.0.to_l]\n status = a.on_line? line\n end\n assert_equal(true, status,\n 'on_line returned incorrect result' )\n end",
"title": ""
},
{
"docid": "34830bfa97fd110ed20505af87d2a9ef",
"score": "0.7128092",
"text": "def test_on_line_false\n status = nil\n assert_nothing_raised do\n line = [Geom::Point3d.new(0,0,0), Geom::Vector3d.new(0,0,1)]\n a = [887,123.123,0.001]\n status = a.on_line? line\n end\n assert_equal(false, status,\n 'on_line returned incorrect result' )\n end",
"title": ""
},
{
"docid": "bbb2480f89fccd0c05ec21a1b8993c9a",
"score": "0.71112895",
"text": "def test_on_line_true\n status = nil\n assert_nothing_raised do\n line = [Geom::Point3d.new(0,0,0), Geom::Vector3d.new(0,0,1)]\n a = [0,0,124.456]\n status = a.on_line? line\n end\n assert_equal(true, status,\n 'on_line returned incorrect result' )\n end",
"title": ""
},
{
"docid": "48fa1f02bf7cad9eafc1de320c191a51",
"score": "0.6918823",
"text": "def test_on_line_tolerance\n status = nil\n assert_nothing_raised do\n line = [Geom::Point3d.new(0,0,0), Geom::Vector3d.new(0,0,1)]\n a = [0,0,0.0001]\n status = a.on_line? line\n end\n assert_equal(true, status,\n 'on_line returned incorrect result' )\n end",
"title": ""
},
{
"docid": "21a90e67f2db9794023c64d33ad61ed1",
"score": "0.68435746",
"text": "def below_line?\n\t\t\t\t\treturn (self.below_line == true)\n\t\t\t\tend",
"title": ""
},
{
"docid": "063e66d1afb651b09ea196ff5eb8cef9",
"score": "0.68433356",
"text": "def point_is_on_line?(point1, point2, point3)\n check_p1 = @x_coefficient * point1.x + @y_coefficient * point1.y + @z_coefficient * point1.z + @free_coefficient\n check_p2 = @x_coefficient * point2.x + @y_coefficient * point2.y + @z_coefficient * point2.z + @free_coefficient\n check_p3 = @x_coefficient * point3.x + @y_coefficient * point3.y + @z_coefficient * point3.z + @free_coefficient\n check_p1.equal?(0) && check_p2.equal?(0) && check_p3.equal?(0)\n end",
"title": ""
},
{
"docid": "98e0706f728031e6f6c47450eaf6078a",
"score": "0.6729801",
"text": "def above_line?\n\t\t\t\t\treturn (self.below_line.nil? || self.below_line == false)\n\t\t\t\tend",
"title": ""
},
{
"docid": "0d3bc6ff5794a5c497488ebedad5a396",
"score": "0.6654993",
"text": "def line?(node)\n node.line == source_line\n end",
"title": ""
},
{
"docid": "6fab5b27736725b7032e5f06d1aa8147",
"score": "0.66228217",
"text": "def single_line?(line_on, line_off)\n\tline_on == line_off\nend",
"title": ""
},
{
"docid": "ef73a0bf6d47cd43e9fbd00420585ba2",
"score": "0.65941405",
"text": "def starts_on_line?(line)\n return false unless line.respond_to?(:offsets)\n @comment.first_line_number == line.offsets.join('-')\n end",
"title": ""
},
{
"docid": "4911bbb5c2dac81abe18861724ba684b",
"score": "0.6481797",
"text": "def enabled_line?(_line_number)\n true\n end",
"title": ""
},
{
"docid": "0eaed3ba4cf0ffb5d41da5cf7f9d3e18",
"score": "0.6349343",
"text": "def has_line_number?(num)\n num.between? @from_line, @to_line\n end",
"title": ""
},
{
"docid": "96e1c5e5cef1595ef6d469791e64a7ef",
"score": "0.6339082",
"text": "def vert_or_horiz line\n return true if line.point1.x == line.point2.x\n return false if line.point1.y == line.point2.y\n return nil\nend",
"title": ""
},
{
"docid": "3550c6900b53dda94b2a339ad66a85ba",
"score": "0.6324239",
"text": "def line_intersection?(slope_1, intercept_1, slope_2, intercept_2)\n\nend",
"title": ""
},
{
"docid": "e5a8f741ec4bbdb308665425c3d5d90d",
"score": "0.6298282",
"text": "def has_line_type?(line_type)\n return true if @lines.length == 1 && @lines[0][:line_type] == line_type.to_sym\n \n @lines.detect { |l| l[:line_type] == line_type.to_sym }\n end",
"title": ""
},
{
"docid": "69d0b4d4324cce06605853715cdd8093",
"score": "0.6295025",
"text": "def has_line_type?(line_type)\n return true if @lines.length == 1 && @lines[0][:line_type] == line_type.to_sym\n @lines.detect { |l| l[:line_type] == line_type.to_sym }\n end",
"title": ""
},
{
"docid": "75ce93ee3185e1ea81b3f1ab86f4b4bc",
"score": "0.6277091",
"text": "def internal_line?(line)\n false\n end",
"title": ""
},
{
"docid": "75ce93ee3185e1ea81b3f1ab86f4b4bc",
"score": "0.6277091",
"text": "def internal_line?(line)\n false\n end",
"title": ""
},
{
"docid": "ac2cb10c1d8987e61da2ff4daf49ec95",
"score": "0.6260767",
"text": "def is_vline?(cell)\n get_figure(cell) == [:line, :vertical]\n end",
"title": ""
},
{
"docid": "0a146a2840355f88017aa6ff690d3d72",
"score": "0.6253583",
"text": "def includes?(point)\n self.polyline.any? do |step_json|\n polyline_array = eval step_json\n polyline_array.include?(point)\n end\n end",
"title": ""
},
{
"docid": "790fde5d2aa37266e327050d16c650db",
"score": "0.6252199",
"text": "def function_line?(line)\n false\n end",
"title": ""
},
{
"docid": "bd3198e20267060533fa55e3d5c8b97d",
"score": "0.621044",
"text": "def point_is_between_lats_of_line_segment?(base_point, trailing_point)\n\t\t(base_point.lat <= self.lat && self.lat < trailing_point.lat) ||\n\t\t(trailing_point.lat <= self.lat && self.lat < base_point.lat)\n\tend",
"title": ""
},
{
"docid": "f1542e0f5e321c77106422fb91a1d499",
"score": "0.61972994",
"text": "def start_of_line?\n @start_of_line\n end",
"title": ""
},
{
"docid": "191a83753993547e5f6691e20015299f",
"score": "0.6131907",
"text": "def known_line_type?(line)\n line_key = segment_peek(line)\n @segment_keys.include?(line_key)\n end",
"title": ""
},
{
"docid": "b09e8f876689a9aa120a68ffa2fedd03",
"score": "0.6105146",
"text": "def has_straight_line(midpoints, spacing, x)\n pos = self.positions\n midpoints.map{|midpoint| [pos[midpoint - spacing], pos[midpoint], pos[midpoint + spacing]].all? x }.include? true\n end",
"title": ""
},
{
"docid": "14a032b25552b28d0e44e72dcac5d439",
"score": "0.6094904",
"text": "def point?\n 'point' == self.type\n end",
"title": ""
},
{
"docid": "7850fa3e84e6774704818d5acc219cea",
"score": "0.60884154",
"text": "def is_line_only_a(event)\n last_event = last_non_line_feed_event\n return false if last_event[1] != event\n\n index = event_index(last_event.first.last)\n previous_event = self.at(index - 1)\n\n previous_event.first.last.zero? || previous_event.first.last.nil?\n end",
"title": ""
},
{
"docid": "f50bd905cbeae2a2c8e2dcd56ed905df",
"score": "0.60819644",
"text": "def plot_line; end",
"title": ""
},
{
"docid": "a320106dce89f58ae4c053c58c0f0345",
"score": "0.6070154",
"text": "def intersect?(line)\n eq1 = LinearEquation.new(vector.x, -line.vector.x, point.x - line.point.x)\n eq2 = LinearEquation.new(vector.y, -line.vector.y, point.y - line.point.y)\n eq3 = LinearEquation.new(vector.z, -line.vector.z, point.z - line.point.z)\n (eq1.solve_system(eq2) == eq2.solve_system(eq3)) and (not parallel? line)\n end",
"title": ""
},
{
"docid": "5540fff806f9cda70fdf8724bcf64118",
"score": "0.605969",
"text": "def check_for_poly_line(poly_verts, line_vert, line_axis)\n poly_sat = SAT.new(poly_verts, line_axis)\n line_sat = SAT.new([line_vert], line_axis)\n\n if poly_sat.max > line_sat.min || poly_sat.min < line_sat.max\n return poly_sat.get_overlap(line_sat)\n else\n return false\n end\n end",
"title": ""
},
{
"docid": "76c07e4dfebb52c1ac3998a12706e982",
"score": "0.6054831",
"text": "def intersectLine l\n if real_close(y, l.m * x + l.b)\n self\n else\n NoPoints.new\n end\n end",
"title": ""
},
{
"docid": "38b1f8e2b7d383fa85f3109da72433b7",
"score": "0.60413784",
"text": "def is_bezier_point?\n [1,2,4,5].include? @record_type\n end",
"title": ""
},
{
"docid": "e0e1a2ae6b926d1f602cdccb3a6245c6",
"score": "0.60271",
"text": "def close_to?(point)\n # change the point to this stroke's position\n check_point = point - @position #Vector.from_pt(point) - @position\n # if only one point check the distance\n if @points.length == 1\n return check_point.magnitude < CLOSE_DISTANCE\n else\n # else some line segments\n prev_pt = @points[0]\n @points[1..-1].each do |next_pt|\n return true if minimum_distance(check_point, prev_pt, next_pt) < CLOSE_DISTANCE\n prev_pt = next_pt\n end\n end\n false\n end",
"title": ""
},
{
"docid": "3cc455e45b4ccf0ace2b873e53bdfb84",
"score": "0.6007606",
"text": "def array_of_points_is_on_line(array)\n raise ArgumentError, 'Array is empty!' if array.length == 0\n res = Array.new\n for i in 0..array.size-1 do\n res.push(point_is_on_line?(array[i]))\n end\n res\n end",
"title": ""
},
{
"docid": "216350172c0399cfdc7e8fe13379661c",
"score": "0.59816825",
"text": "def check_straight_line(coordinates)\r\n slope = 'inf'\r\n slope = (coordinates[1][1] - coordinates[0][1]) / (coordinates[1][0] - coordinates[0][0]) if coordinates[1][0] - coordinates[0][0] != 0\r\n (2...(coordinates.length)).each do |idx|\r\n prev = coordinates[idx-1]\r\n curr = coordinates[idx]\r\n if slope == 'inf'\r\n return false if curr[0] - prev[0] != 0\r\n else\r\n return false if curr[0] - prev[0] == 0 || (curr[1] - prev[1]) / (curr[0] - prev[0]) != slope\r\n end\r\n end\r\n true\r\nend",
"title": ""
},
{
"docid": "c9b7566fa7163b15653e364a8a67bfde",
"score": "0.595236",
"text": "def is_hline?(cell)\n get_figure(cell) == [:line, :horizontal]\n end",
"title": ""
},
{
"docid": "eafa90f7baa6904712df9aafda864161",
"score": "0.59452504",
"text": "def ends_on_line?(line)\n return false unless line.respond_to?(:offsets)\n @comment.last_line_number == line.offsets.join('-')\n end",
"title": ""
},
{
"docid": "e876a44007ed55cb16282480db14db4b",
"score": "0.59356797",
"text": "def contains_point?(point)\n return false if outside_bounding_box?(point)\n contains_point = false\n i = -1\n j = @points.size - 1\n while (i += 1) < @points.size\n a_point_on_polygon = @points[i]\n trailing_point_on_polygon = @points[j]\n if point_is_between_the_lons_of_the_line_segment?(point, a_point_on_polygon, trailing_point_on_polygon)\n if ray_crosses_through_line_segment?(point, a_point_on_polygon, trailing_point_on_polygon)\n contains_point = !contains_point\n end\n end\n j = i\n end\n return contains_point\n end",
"title": ""
},
{
"docid": "08854411e92595404a4fcd5b3e20de8c",
"score": "0.59342706",
"text": "def check_line_collision(line)\n\t\tif @y >= line.y1 && @y <= line.y2\n\t\t\tif @x < line.x1 && line.x1 - @x <= @radius\n\t\t\t\t@x = line.x1 - @radius - 1\n\t\t\t\t@dX *= -1\n\t\t\t\treturn true\n\t\t\telsif @x > line.x1 && @x - line.x1 <= @radius\n\t\t\t\t@x = line.x1 + @radius + 1\n\t\t\t\t@dX *= -1\n\t\t\t\treturn true\n\t\t\tend\n\t\telsif @x >= line.x1 && @x <= line.x2\n\t\t\tif @y < line.y1 && line.y1 - @y <= @radius\n\t\t\t\t@y = line.y1 - @radius - 1\n\t\t\t\t@dY *= -1\n\t\t\t\treturn true\n\t\t\telsif @y > line.y1 && @y - line.y1 <= @radius\n\t\t\t\t@y = line.y1 + @radius + 1\n\t\t\t\t@dY *= -1\n\t\t\t\treturn true\n\t\t\tend\t\t\t\t\t\n\t\tend\n\t\t\n\t\treturn false\n\tend",
"title": ""
},
{
"docid": "3949c9952ab2f1eb73ecf87c2e909f49",
"score": "0.59096885",
"text": "def ray_crosses_through_line_segment?(base_point, trailing_point)\n\t\t(self.lng - base_point.lng) < (trailing_point.lng - base_point.lng) * (self.lat - base_point.lat) / (trailing_point.lat - base_point.lat)\n\tend",
"title": ""
},
{
"docid": "09537f513f855dda370c865561b920aa",
"score": "0.589635",
"text": "def line(x0, y0, x1, y1)\n move_to(x0, y0).line_to(x1, y1)\n end",
"title": ""
},
{
"docid": "44346953d91ad143fd26b51fecd97ea5",
"score": "0.5887039",
"text": "def line?\n !!(@inbuffer.match(\"\\n\"))\n end",
"title": ""
},
{
"docid": "31e100b7337164dbaaaecfb78e65a9a7",
"score": "0.5880047",
"text": "def intersects_line?(x1, y1, x2, y2)\n t0 = 0.0\n t1 = 1.0\n p = q = r = 0.0\n \n x_delta = x2 - x1\n y_delta = y2 - y1\n \n (0..3).each do |edge|\n \n if edge == 0 # left edge\n p = -x_delta\n q = -(@x1 + 1 - x1)\n end\n \n if edge == 1 # right edge\n p = x_delta\n q = (@x2 - 1 - x1)\n end\n \n if edge == 2 # top edge\n p = -(y_delta)\n q = -(@y1 + 1 - y1)\n end\n \n if edge == 3 # bottom edge\n p = y_delta\n q = (@y2 - 1 - y1)\n end\n\n r = q.to_f / p.to_f\n\n return false if p == 0 && q < 0 \n \n if p < 0\n if r > t1\n return false\n elsif r > t0\n t0 = r\n end\n elsif p > 0\n if r < t0\n return false\n elsif r < t1\n t1 = r\n end\n end\n end\n \n true\n end",
"title": ""
},
{
"docid": "55d26cddfa870b0fcfed51b1d840acff",
"score": "0.58782905",
"text": "def single_line?\n start_line == end_line\n end",
"title": ""
},
{
"docid": "b39f93bd4b8459c384d692def062e94e",
"score": "0.5841676",
"text": "def statement_line?\n if self.method_line? or self.class_line? or self.comment_line?\n return false\n end\n\n true\n end",
"title": ""
},
{
"docid": "8a546d601ed4bd685938461a344c15b5",
"score": "0.5824457",
"text": "def intersecting?(other_line)\n @x_coefficient != other_line.x_coefficient || @y_coefficient != other_line.y_coefficient\n end",
"title": ""
},
{
"docid": "5ce70d499d4a435348a2d3c8756b83ab",
"score": "0.5815222",
"text": "def intersectWithSegmentAsLineResult seg # seg is e1, self is the intersect point - receive dynamic dispatch\n #return the point if it is on the line segment, otherwise noPoint\n if inbetween(@x,seg.x1,seg.x2) and inbetween(@y,seg.y1,seg.y2) then self else NoPoints.new end\n end",
"title": ""
},
{
"docid": "7cc28d4baf038f11e5d2081fb5fbaa25",
"score": "0.5810957",
"text": "def draw_line(*args)\n end",
"title": ""
},
{
"docid": "a218070b2a7d4e9ca2f2bcb8349512e5",
"score": "0.5791699",
"text": "def process_line(glyph_line, glyphs, font_map)\n glyphs.each do |g|\n if g.to_s.include?(AFont.unknown_glyph)\n\tline = ''\n\tglyphs.each {|gl| line << gl.to_s}\n\tabort = handle_glyph(line, g, font_map)\n return abort if abort\n end\n end\n return false\n end",
"title": ""
},
{
"docid": "cdd05c0105f9181b7c3f97e4680b399a",
"score": "0.5787176",
"text": "def line_found?(player_sign)\n pos = get_list_by_player(player_sign)\n !search_line(pos).empty?\n end",
"title": ""
},
{
"docid": "6928c16d121d50b2b1a9c653bc442e68",
"score": "0.5779151",
"text": "def contains_point?(point)\n # Validate the polygon first\n return false if !self.valid?\n\n contains_pt = false\n start = -1\n trail = self.vertices.size - 2 # disregard the last vertex\n\n # Test for all sides\n while (start += 1) < self.vertices.size-1 \n # Initially set starting_pt = top-left, trailing_pt = bottom-left \n starting_pt = self.vertices[start]\n trailing_pt = self.vertices[trail]\n\n # If the point is between the y segment (latitude)\n if point_is_between_ys_of_line_segment?(point, starting_pt, trailing_pt)\n if ray_crosses_line_segment?(point, starting_pt, trailing_pt)\n contains_pt = !contains_pt\n end\n end\n\n # Check the next edge\n trail = start\n end\n \n contains_pt\n end",
"title": ""
},
{
"docid": "32acee210a513d97698ab6180b564813",
"score": "0.5766648",
"text": "def beginning_of_line?\n @position.zero? or @data[@position - 1] == ?\\n\n end",
"title": ""
},
{
"docid": "80ff7f003de2dfa9492bf8d7b58b1e05",
"score": "0.57652986",
"text": "def line(position, dot)\n dot ? dotted(position) : solid(position)\n end",
"title": ""
},
{
"docid": "752171205636b59ee9180308c48e5651",
"score": "0.5764686",
"text": "def comment_line?(line_source); end",
"title": ""
},
{
"docid": "752171205636b59ee9180308c48e5651",
"score": "0.5764686",
"text": "def comment_line?(line_source); end",
"title": ""
},
{
"docid": "5da54d98252c6342445ace335edef521",
"score": "0.5763704",
"text": "def line(x0, y0, x1, y1, stroke_color, inclusive = T.unsafe(nil)); end",
"title": ""
},
{
"docid": "204cf2a065c9702319fc24a7569e2c24",
"score": "0.57456744",
"text": "def point?()\n self.point1d? or self.point2d?\nend",
"title": ""
},
{
"docid": "9bb9b1cef82b7941614ba74847960aff",
"score": "0.57430273",
"text": "def at_start_of_line?\n @cursor == 0 or @text[@cursor - 1, 1] == \"\\n\"\n end",
"title": ""
},
{
"docid": "e76570573a5d7388fed0617ddafd4c95",
"score": "0.57382065",
"text": "def on_line(&blk)\n @on_line_block = blk\n end",
"title": ""
},
{
"docid": "e76570573a5d7388fed0617ddafd4c95",
"score": "0.57382065",
"text": "def on_line(&blk)\n @on_line_block = blk\n end",
"title": ""
},
{
"docid": "1db565ca325330d0d721d0858a12b6eb",
"score": "0.57307065",
"text": "def check_line_equation(x1, y1, x2, y2, x, y, op)\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m*x1\n right_side = m*x + b\n if op == 'greater'\n return y > right_side, b > 0 # true if positive slope\n elsif op == 'less'\n return y < right_side, b > 0\n end\nend",
"title": ""
},
{
"docid": "1af957bb54d8a91cd224b5223e6a9b06",
"score": "0.5727298",
"text": "def on_segment?(point)\n raise ArgumentError.new(\"#{p}\") unless point.is_a?(Point)\n point.x <= [p.x, q.x].max && point.x >= [p.x, q.x].min &&\n point.y <= [p.y, q.y].max && point.y >= [p.y, q.y].min &&\n orientation(p, q, point) == :collinear\n end",
"title": ""
},
{
"docid": "5148ac9da7d977b3bddae4bacc408ed1",
"score": "0.57132316",
"text": "def line(angle=@angle,max=100,x=@x,y=@y)\n dx, dy = offset_x(angle,1), offset_y(angle,1)\n (0..max).each do |dist|\n x = (x+dx).normalize_x\n y = (y+dy).normalize_y\n return dist if yield(x,y)\n end\n return false\n end",
"title": ""
},
{
"docid": "ce035e7d4c2e01501886ba818bf509cc",
"score": "0.5708675",
"text": "def point?\n self.int? || self.point2d?\n end",
"title": ""
},
{
"docid": "cb235334ad065ff185ee4dd0db582e19",
"score": "0.57029974",
"text": "def on_axis?\n return @on_axis\n end",
"title": ""
},
{
"docid": "fbc79db6d1d28d28b6af3d8ddd6cd378",
"score": "0.56987256",
"text": "def line x1, y1, x2, y2, c, aa = true\n h = self.h\n renderer.draw_line x1, h-y1-1, x2, h-y2-1, color[c], aa\n end",
"title": ""
},
{
"docid": "190531beb835abcb2b100d2f834266cc",
"score": "0.56965774",
"text": "def winning_line?(marker)\n !winning_lines_map(marker, false).reject { |hash| hash if hash[:score] > 0 }.empty?\n end",
"title": ""
},
{
"docid": "fbe83515439683f9a9de7450afc323ef",
"score": "0.5690746",
"text": "def draw_line(point1,point2)\r\n model = Sketchup.active_model \r\n entities = model.active_entities \r\n #point1 = Geom::Point3d.new(sx,sy,sz)\r\n\t#point2 = Geom::Point3d.new(ex,ey,ez)\r\n\tline = entities.add_line point1,point2\r\n\tif (!line)\r\n UI.messagebox \"Line failure\"\r\n end\r\nend",
"title": ""
},
{
"docid": "516b814d8cc6be33a1c9fe8918302aa7",
"score": "0.5689582",
"text": "def isLine?(row)\n return !row.include?(0)\n end",
"title": ""
},
{
"docid": "1728ea89025af7d3cfbc943432f06161",
"score": "0.56850654",
"text": "def parallel?(other_line)\n @x_coefficient.equal?(other_line.x_coefficient) && @y_coefficient.equal?(other_line.y_coefficient)\n end",
"title": ""
},
{
"docid": "6b843dc3ed81d8f9ad781f7b0c3a4008",
"score": "0.5665197",
"text": "def colorize_lines?\n color_scheme && color_scheme.lines?\n end",
"title": ""
},
{
"docid": "3be160585650d6ab93b9c68f13d491b8",
"score": "0.5664125",
"text": "def closest_point_to_line(points, line_start, line_end)\n closest = nil\n\n points.each do |point|\n distance = distance_of_point_to_line(point, line_start, line_end)\n\n if closest.nil? || distance < closest.distance\n closest = PointAlongAxis.new(distance, point)\n end\n end\n\n return closest\n end",
"title": ""
},
{
"docid": "58eac0054adef59dea6d9fc6b5d4c3d0",
"score": "0.5653881",
"text": "def has_line\n # Check if there is currently a source\n if @current_source == nil\n return false if !has_source\n next_source\n end\n # Check if the current source has any lines left\n if !@current_source.has_line\n @current_source.close\n @current_source = nil\n return has_line\n end\n return true\n end",
"title": ""
},
{
"docid": "2e46c5c10219c80544207f7e5e831beb",
"score": "0.56482303",
"text": "def point_on_line(distance_from_end, *points)\n x0, y0, x1, y1 = points.flatten\n length = Math.sqrt((x1 - x0)**2 + (y1 - y0)**2)\n p = (length - distance_from_end) / length\n xr = x0 + p * (x1 - x0)\n yr = y0 + p * (y1 - y0)\n [xr, yr]\n end",
"title": ""
},
{
"docid": "228ea79b48c32ff93e93d28abeeb3718",
"score": "0.56412995",
"text": "def line_stats?\n [email protected]?\n end",
"title": ""
},
{
"docid": "46ac15c1823c909fab1379df600be2d4",
"score": "0.5634122",
"text": "def adjustment_line_is?\n false\n end",
"title": ""
},
{
"docid": "9528b2ec462746a26745d8b4197ca9d6",
"score": "0.56324005",
"text": "def line *args\n case args[0]\n when Driving::Point\n s_p0 = world_to_screen p0\n s_p1 = world_to_screen p1\n when Driving::LineSegment\n s_p0 = world_to_screen(args[0].p0)\n s_p1 = world_to_screen(args[0].p1)\n when Driving::Road\n s_p0 = world_to_screen(args[0].n0.pos)\n s_p1 = world_to_screen(args[0].n1.pos)\n else\n raise \"Invalid specification of line to draw\"\n end\n \n @g.draw_line s_p0.x, s_p0.y, s_p1.x, s_p1.y\n end",
"title": ""
},
{
"docid": "cbc771ee23f993d4ec26c9d643abdf63",
"score": "0.5631521",
"text": "def potential_line?(filename, lineno); end",
"title": ""
},
{
"docid": "913f01772d76e8418c97fa05b943a62d",
"score": "0.56301236",
"text": "def intersectLine l\n if real_close(m, l.m)\n if real_close(b, l.b)\n self\n else\n NoPoints.new\n end\n else\n @x = (l.b - b) / (m - l.m)\n @y = m * @x + b\n Point.new(@x, @y)\n end\n end",
"title": ""
},
{
"docid": "2e3562884054a4b5549e42be4210e0e7",
"score": "0.5618941",
"text": "def point?\n geometry.nil? || geometry.geometry_type.type_name == 'Point'\n end",
"title": ""
},
{
"docid": "2e3562884054a4b5549e42be4210e0e7",
"score": "0.5618941",
"text": "def point?\n geometry.nil? || geometry.geometry_type.type_name == 'Point'\n end",
"title": ""
},
{
"docid": "818fb4b7e4d375f25aa6d91fbc819114",
"score": "0.56176645",
"text": "def draw_line(x1, y1, c1, x2, y2, c2, z=0, mode=:default); end",
"title": ""
},
{
"docid": "3de4399519c067a10069dca3bec77d30",
"score": "0.5616069",
"text": "def line(*points)\n x0, y0, x1, y1 = points.flatten\n move_to(x0, y0)\n line_to(x1, y1)\n end",
"title": ""
},
{
"docid": "3dafba7421287de8d6f7e1c509d04227",
"score": "0.56140816",
"text": "def drawline(coord1, coord2, colour)\n check coord1\n check coord2\n\n x_increment = (coord2.x - coord1.x) <=> 0\n y_increment = (coord2.y - coord1.y) <=> 0\n\n return if x_increment == 0 && y_increment == 0\n\n x, y = coord1.x, coord1.y\n\n while (x_increment > 0 ? x <= coord2.x : x >= coord2.x) &&\n (y_increment > 0 ? y <= coord2.y : y >= coord2.y)\n\n plot(new_coord(x, y), colour)\n\n x += x_increment\n y += y_increment\n end\n self\n end",
"title": ""
},
{
"docid": "b8564f40ef90ee8e83c4a3ffe7f0dc75",
"score": "0.56130147",
"text": "def line?\n !product_item? and !products.empty?\n end",
"title": ""
},
{
"docid": "23e1c6c0b097d367539ead372da805ab",
"score": "0.56130147",
"text": "def line(screen, p1, p2)\n\t\t# get screen object\n\t\ts = screen.get\n\t\t# convert coords\n\t\tx1d, y1d = convert_coords(p1[0], p1[1], p1[2])\n\t\tx2d, y2d = convert_coords(p2[0], p2[1], p2[2])\n\t\t# draw line\n\t\ts.draw_aa_line(x1d, y1d, x2d, y2d, $FGCOLOR)\n\tend",
"title": ""
},
{
"docid": "3ae91d50c5b1774d08afe4f5b37a4961",
"score": "0.56071824",
"text": "def linear?\n self.type == :linear\n end",
"title": ""
},
{
"docid": "5636ef171487f912896f58db7db2dd26",
"score": "0.56071794",
"text": "def intersects?(_other_line_string)\n end",
"title": ""
},
{
"docid": "bbf766d1d183bba3d49c7282ce53417a",
"score": "0.55884105",
"text": "def visible?\n !line.empty?\n end",
"title": ""
},
{
"docid": "1def068807481afa5e2d50addb1eab17",
"score": "0.55737567",
"text": "def point?()\n self .point1d? or self== Point2d\nend",
"title": ""
},
{
"docid": "4a394861768e34c88f2bb451a6346901",
"score": "0.55737364",
"text": "def point?(value)\n value.point1d? or value.point2d?\nend",
"title": ""
},
{
"docid": "37667391fa789e6eb1c7796e28f6082f",
"score": "0.55713916",
"text": "def has_line_item?(id)\n self.unique_order_line_items.each do |item|\n return true if item.product_id == id\n end\n return false\n end",
"title": ""
},
{
"docid": "1cddc6176adada5de65057ad73064dc3",
"score": "0.5570457",
"text": "def same_line?(other); end",
"title": ""
},
{
"docid": "1cddc6176adada5de65057ad73064dc3",
"score": "0.5570457",
"text": "def same_line?(other); end",
"title": ""
},
{
"docid": "e147c493db7667bc358cf3bf0cff81d9",
"score": "0.556868",
"text": "def draw_line(p1, p2, colour)\n if p1.y == p2.y\n draw_horizontal p1.y, p1.x, p2.x, colour\n else\n draw_vertical p1.x, p1.y, p2.y, colour\n end\n end",
"title": ""
},
{
"docid": "2f53eb6e868c46d615afef4ff1cbc52b",
"score": "0.5566996",
"text": "def check_straight_line(coordinates)\n n = coordinates.length\n return true if n == 2\n\n x = coordinates[0][0]\n y = coordinates[0][1]\n x1 = coordinates[1][0]\n y1 = coordinates[1][1]\n dy = y1-y; dx = x1-x\n\n for i in 2...n\n x = coordinates[i][0]\n y = coordinates[i][1]\n\n if (y-y1)*dx != (x-x1)*dy\n return false\n end\n end\n return true\nend",
"title": ""
}
] |
7a32d7849ee232161bf10830734f9863
|
POST /dias POST /dias.xml
|
[
{
"docid": "6d894e711f933e703631b71265171ca6",
"score": "0.580463",
"text": "def create\n @dia = Dia.new(params[:dia])\n\n respond_to do |format|\n if @dia.save\n #flash[:notice] = 'Dia was successfully created.'\n @dias = Dia.find(:all,:order=> \"num\")\n format.html { redirect_to :action => \"index\" }\n format.xml { render :xml => @dia, :status => :created, :location => @dia }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dia.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "040b1dcc9c0431f2a79f0e6876ea2be5",
"score": "0.6287026",
"text": "def post( path, body = nil )\n body ? length = body.length.to_s : length = '0' \n parse( @access_token.post( DOSSIA_URL + '/dossia-restful-api/services/v3.0' + path, body, { 'Content-Type' => 'application/xml', 'Content-Length' => length } ) )\n end",
"title": ""
},
{
"docid": "e3212fb0e4c604fd1ef64c171652c2af",
"score": "0.6040199",
"text": "def create\n @diannao = Diannao.new(diannao_params)\n\n respond_to do |format|\n if @diannao.save\n format.html { redirect_to @diannao, notice: 'Diannao was successfully created.' }\n format.json { render :show, status: :created, location: @diannao }\n else\n format.html { render :new }\n format.json { render json: @diannao.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aec6485a4a0f492b7031b27bef8d1224",
"score": "0.60333437",
"text": "def create\n @diaria = Diaria.new(diaria_params)\n\n respond_to do |format|\n if @diaria.save\n format.html { redirect_to @diaria, notice: 'Diaria was successfully created.' }\n format.json { render :show, status: :created, location: @diaria }\n else\n format.html { render :new }\n format.json { render json: @diaria.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9648e61568708070d6b0edf6cbdca302",
"score": "0.60233754",
"text": "def create\n #@dieta = Dieta.new(params[:dieta])\n\t#@usuario = Usuario.find(params[:usuario_id])\n #respond_to do |format|\n # if @dieta.save\n # format.html { redirect_to(@dieta, :notice => 'Dieta was successfully created.') }\n # format.xml { render :xml => @dieta, :status => :created, :location => @dieta }\n # else\n # format.html { render :action => \"new\" }\n # format.xml { render :xml => @dieta.errors, :status => :unprocessable_entity }\n # end\n #end\n\t@usuario = Usuario.find(params[:usuario_id])\n\t@dieta = @usuario.dietas.build(params[:dieta])\n\[email protected]\n\tredirect_to @usuario\n end",
"title": ""
},
{
"docid": "62736d7fa09c7e709fc0ebc5168ae1ba",
"score": "0.6018151",
"text": "def create\n @estagiarios = Estagiario.new(params[:estagiario])\n\n respond_to do |format|\n if @estagiarios.save\n flash[:notice] = 'ESTAGIÁRIO CADASTRADO COM SUCESSO.'\n format.html { redirect_to(@estagiarios) }\n format.xml { render :xml => @estagiarios, :status => :created, :location => @estagiarios }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estagiarios.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "670ad307407d91d7430dde4c4bbe8d8c",
"score": "0.59243983",
"text": "def create\n @diente = Diente.new(diente_params)\n\n respond_to do |format|\n if @diente.save\n format.html { redirect_to @diente, notice: 'Diente was successfully created.' }\n format.json { render :show, status: :created, location: @diente }\n else\n format.html { render :new }\n format.json { render json: @diente.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "353f715831ca098104826d7a81cdb514",
"score": "0.59096247",
"text": "def create\n @depoimentos = Depoimento.all\n @doacao = Doacao.new(doacao_params)\n respond_to do |format|\n if @doacao.save\n format.html { redirect_to @doacao, notice: 'Doacão Feita com sucesso.' }\n format.json { render :show, status: :created, location: @doacao }\n else\n format.html { render :new }\n format.json { render json: @doacao.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4495ca49c5dd5a3f0d9d223dec4efa6a",
"score": "0.5895662",
"text": "def create\n @soupdejour = Soupdejour.new(params[:soupdejour])\n\n respond_to do |format|\n if @soupdejour.save\n format.html { redirect_to @soupdejour, notice: 'Soupdejour was successfully created.' }\n format.json { render json: @soupdejour, status: :created, location: @soupdejour }\n else\n format.html { render action: \"new\" }\n format.json { render json: @soupdejour.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "24c08d180fbd880d1bf984aecc351dc4",
"score": "0.5894553",
"text": "def create\n @depositario = Depositario.new(params[:depositario])\n\n respond_to do |format|\n if @depositario.save\n format.html { redirect_to(@depositario, :notice => 'Depositario cadastrado com sucesso.') }\n format.xml { render :xml => @depositario, :status => :created, :location => @depositario }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @depositario.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2720e9bd727b08cce37ae725accf5e72",
"score": "0.5875031",
"text": "def create\n @doacao_ideium = DoacaoIdeium.new(doacao_ideium_params)\n\n respond_to do |format|\n if @doacao_ideium.save\n format.html { redirect_to @doacao_ideium, notice: 'Ideia cadastrada com sucesso.' }\n format.json { render :show, status: :created, location: @doacao_ideium }\n else\n format.html { render :new }\n format.json { render json: @doacao_ideium.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2b6041c67cfc8e347dd8a9297eef871f",
"score": "0.58694994",
"text": "def create\n @dium = Dium.new(dium_params)\n respond_to do |format|\n if @dium.save\n format.html { redirect_to @dium, notice: 'O Dia foi Aberto!' }\n format.json { render :show, status: :created, location: @dium }\n else\n format.html { render :new }\n format.json { render json: @dium.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a8dbee7fac7a15bbb13fb6174e5188b5",
"score": "0.5865358",
"text": "def create\n @diario = Diario.new(params[:diario])\n @diario.zona_id = $zona\n @diario.fecha = $fecha\n\n\n respond_to do |format|\n if @diario.save\n format.html { redirect_to @diario, notice: 'Diario fue creado correctamente.' }\n format.json { render json: @diario, status: :created, location: @diario }\n else\n format.html { render action: \"new\" }\n format.json { render json: @diario.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5d896c0377163ec1a20ea2b540fbf7ae",
"score": "0.58649504",
"text": "def create\n @domeniu = Domeniu.new(domeniu_params)\n respond_to do |format|\n if @domeniu.save\n format.html { redirect_to temeleMele_path, notice: 'Domeniul a fost creat.' }\n format.json { render action: 'show', status: :created, location: @domeniu }\n else\n format.html { render action: 'new' }\n format.json { render json: @domeniu.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "03854fc9601d2bbb5b5117c7791ab8d5",
"score": "0.5849563",
"text": "def create\n @detalle_dia = DetalleDia.new(detalle_dia_params)\n\n respond_to do |format|\n if @detalle_dia.save\n format.html { redirect_to @detalle_dia, notice: 'Detalle dia was successfully created.' }\n format.json { render :show, status: :created, location: @detalle_dia }\n else\n format.html { render :new }\n format.json { render json: @detalle_dia.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a375d6201098c75a44081b25a17d7344",
"score": "0.5848979",
"text": "def create\n params[:cliente] = formata_dados(params[:cliente])\n @estados = Estado.all\n @cliente = Cliente.new(params[:cliente])\n\n respond_to do |format|\n if @cliente.save\n flash[:notice] = 'Registro salvo com sucesso.'\n format.html { redirect_to(clientes_url) }\n format.xml { render :xml => @cliente, :status => :created, :location => @cliente }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cliente.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8f55063d722c96fea9cd3bdfdd038a9d",
"score": "0.5827039",
"text": "def create\n @ponto_diario = PontoDiario.new(params[:ponto_diario])\n\n respond_to do |format|\n if @ponto_diario.save\n format.html { redirect_to(@ponto_diario, :notice => 'Ponto diario cadastrado com sucesso.') }\n format.xml { render :xml => @ponto_diario, :status => :created, :location => @ponto_diario }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ponto_diario.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6b56ebd7ddd25d53967a0ccd85e8998a",
"score": "0.5816462",
"text": "def create\n @duenio = Duenio.new(duenio_params)\n\n respond_to do |format|\n if @duenio.save\n format.html { redirect_to @duenio, notice: 'Duenio was successfully created.' }\n format.json { render :show, status: :created, location: @duenio }\n else\n format.html { render :new }\n format.json { render json: @duenio.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5ba800fa7d054ec677529f6e46de6750",
"score": "0.5814735",
"text": "def create\n @dia = Dia.new(dia_params)\n\n respond_to do |format|\n if @dia.save\n @dias = Dia.order( \"num\").to_a\n format.html { redirect_to :action => \"index\" }\n format.xml { render :xml => @dia, :status => :created, :location => @dia }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dia.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "660a62235a945e6539ba23145c9ce167",
"score": "0.58090395",
"text": "def create\n @domaine = Domaine.new(domaine_params)\n\n respond_to do |format|\n if @domaine.save\n format.html { redirect_to @domaine, notice: 'Domaine was successfully created.' }\n format.json { render :show, status: :created, location: @domaine }\n else\n format.html { render :new }\n format.json { render json: @domaine.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1a2430fa5191479fd4919abb2ab2ce58",
"score": "0.5802657",
"text": "def create\n @estagiario = Estagiario.new(params[:estagiario])\n\n respond_to do |format|\n if @estagiario.save\n flash[:notice] = 'Estagiario foi criado com sucesso.'\n format.html { redirect_to(@estagiario) }\n format.xml { render :xml => @estagiario, :status => :created, :location => @estagiario }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estagiario.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "697b1867b9ef988cb8ae8c1d7a4917d4",
"score": "0.5800143",
"text": "def create\n @deposito = Deposito.new(params[:deposito])\n\n respond_to do |format|\n if @deposito.save\n format.html { redirect_to(depositos_url, :notice => 'El Deposito ha sido creado satisfactoriamente.') }\n format.xml { render :xml => @deposito, :status => :created, :location => @deposito }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @deposito.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "75f2ec96ba18318832b490a6c5763afb",
"score": "0.5789248",
"text": "def create\n @diabet = @pacient.diabets.new\n\n respond_to do |format|\n if @diabet.save\n format.html { redirect_to(@diabet, :notice => 'Diabet was successfully created.') }\n format.xml { render :xml => @diabet, :status => :created, :location => @diabet }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @diabet.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2fb1cb507413bd256ed83573fdbce601",
"score": "0.578132",
"text": "def create\n @diploma_element = DiplomaElement.new(params[:diploma_element])\n\n respond_to do |format|\n if @diploma_element.save\n flash[:notice] = 'DiplomaElement was successfully created.'\n format.html { redirect_to(@diploma_element) }\n format.xml { render :xml => @diploma_element, :status => :created, :location => @diploma_element }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @diploma_element.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4177257599820893e6c30a7464c797d8",
"score": "0.5780971",
"text": "def create\n @idddnteger = Idddnteger.new(params[:idddnteger])\n\n respond_to do |format|\n if @idddnteger.save\n format.html { redirect_to @idddnteger, notice: 'Idddnteger was successfully created.' }\n format.json { render json: @idddnteger, status: :created, location: @idddnteger }\n else\n format.html { render action: \"new\" }\n format.json { render json: @idddnteger.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a1871773c0ee84d61ce04cf845dd29e3",
"score": "0.57626975",
"text": "def create\n @dieta = Dieta.new(dieta_params)\n respond_to do |format|\n if @dieta.save\n format.html { redirect_to index_dieta_path(params[:dieta][:paciente_id]),\n notice: 'Datos guardados correctamente.' }\n else\n format.html { redirect_to index_dieta_path(params[:dieta][:paciente_id]),\n notice: 'Ocurrio un error mientras se guardaban los datos.' }\n end\n end\n end",
"title": ""
},
{
"docid": "87ffcf72b79542019854e5ab7955cd99",
"score": "0.57007915",
"text": "def create\n @estudiante = Estudiante.new(params[:estudiante])\n\n if @estudiante.save\n render json: @estudiante, status: :created, location: @estudiante\n else\n render json: @estudiante.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "1fa1deab94529462b9b5feb57abe655d",
"score": "0.5689709",
"text": "def create\n @adjunto = Adjunto.new(adjunto_params)\n\n respond_to do |format|\n if @adjunto.save\n format.html { redirect_to @adjunto, notice: 'Adjunto was successfully created.' }\n format.json { render :show, status: :created, location: @adjunto }\n else\n format.html { render :new }\n format.json { render json: @adjunto.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8249e2c716f0dc1bc6deb877b1ffb35f",
"score": "0.5683087",
"text": "def create\n @daw_estudiante = DawEstudiante.new(daw_estudiante_params)\n\n respond_to do |format|\n if @daw_estudiante.save\n format.html { redirect_to @daw_estudiante, notice: 'Daw estudiante was successfully created.' }\n format.json { render :show, status: :created, location: @daw_estudiante }\n else\n format.html { render :new }\n format.json { render json: @daw_estudiante.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ff64f712ca5c171b73151901dc47c4f6",
"score": "0.567846",
"text": "def postRequest\n assertRequestData\n assertRequestType\n req = Net::HTTP::Post.new(@uri.request_uri)\n req.add_field('Content-Type', 'text/xml')\n req.body = buildXmlRequest\n @response = sendRequest(req)\n return @response\n end",
"title": ""
},
{
"docid": "fb84993c0bc32d4d608da10853ad67a4",
"score": "0.5671829",
"text": "def create\n @idioma = Idioma.new(params[:idioma])\n\n respond_to do |format|\n if @idioma.save\n format.html { redirect_to(@idioma, :notice => 'Idioma creado con exito.') }\n format.xml { render :xml => @idioma, :status => :created, :location => @idioma }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @idioma.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f72985ab4f371981b8215c72a6411abc",
"score": "0.5665819",
"text": "def create\n @etiqueta = Etiqueta.new(params[:etiqueta])\n\n respond_to do |format|\n if @etiqueta.save\n flash[:notice] = 'Etiqueta was successfully created.'\n format.html { redirect_to(@etiqueta) }\n format.xml { render :xml => @etiqueta, :status => :created, :location => @etiqueta }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @etiqueta.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "651c695510cae5fa91b71b3b14c9004c",
"score": "0.5663182",
"text": "def create\n @servico = Servico.new(params[:servico])\n\n respond_to do |format|\n if @servico.save\n format.html { redirect_to(servicos_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @servico.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "12f8b4c832804e780db1a4c8e974a3e0",
"score": "0.566099",
"text": "def post_xml(e, doc, p = {})\n begin\n url = \"https://#{@username}:#{@password}@#{@host}#{@docroot}#{e}\"\n msg \"post to #{url}\", Logger::DEBUG\n params = { :content_type => \"application/xml\" }.merge! p\n params[:cookies] = $cookie if !$cookie.empty?\n resp = RestClient.post(url, doc.to_s, params )\n msg resp, Logger::DEBUG\n $cookie = resp.cookies unless resp.cookies.empty?\n msg \"got cookie #{$cookie}\", Logger::DEBUG unless resp.cookies.empty?\n # XML Document\n if (/<.+>/).match(resp)\n xmldoc = Nokogiri::XML(resp)\n else\n err_node = Nokogiri::XML::Node.new('err_node', xmldoc)\n err_node.content = resp\n xmldoc.root << err_node\n end\n rescue SocketError\n raise \"Host \" + @host + \" nicht erreichbar\"\n rescue Exception => e\n msg \"error parsing XML \" + e.to_s, Logger::DEBUG\n end\n if (xmldoc.nil? || !xmldoc.xpath(\"//err_node\").empty?)\n @posted_uuid = nil\n end\n if !xmldoc.nil?\n @posted_uuid = xmldoc.xpath(\"//uuid\")[0].text if !xmldoc.xpath(\"//uuid\").empty?\n end\n return xmldoc\n end",
"title": ""
},
{
"docid": "23033ee3eda7ff0e5c2a3fba4f88deb6",
"score": "0.5650525",
"text": "def create\n @dependencia = Dependencia.new(params[:dependencia])\n\n respond_to do |format|\n if @dependencia.save\n flash[:notice] = 'Dependencia was successfully created.'\n format.html { redirect_to(@dependencia) }\n format.xml { render :xml => @dependencia, :status => :created, :location => @dependencia }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dependencia.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fc586daab4a9912bc402ce32bd01c20a",
"score": "0.56493616",
"text": "def create\n @registro_diario = RegistroDiario.new(registro_diario_params)\n\n respond_to do |format|\n if @registro_diario.save\n format.html { redirect_to @registro_diario, notice: 'Registro diario was successfully created.' }\n format.json { render :show, status: :created, location: @registro_diario }\n else\n format.html { render :new }\n format.json { render json: @registro_diario.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3ea5649e91ea8afef542bec3f7b229e4",
"score": "0.56487006",
"text": "def create\n @instancia = Instancia.new(params[:instancia])\n\n respond_to do |format|\n if @instancia.save\n format.html { redirect_to(@instancia, :notice => 'Instancia was successfully created.') }\n format.xml { render :xml => @instancia, :status => :created, :location => @instancia }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @instancia.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5b59af5873266c6965ab3db8a4d890a5",
"score": "0.56401664",
"text": "def create\n @tipo_de_expediente = TipoDeExpediente.new(params[:tipo_de_expediente])\n\n respond_to do |format|\n if @tipo_de_expediente.save\n format.html { redirect_to(@tipo_de_expediente, :notice => 'TipoDeExpediente was successfully created.') }\n format.xml { render :xml => @tipo_de_expediente, :status => :created, :location => @tipo_de_expediente }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tipo_de_expediente.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e8e1c95745f4140dbb89bcadec5f1e77",
"score": "0.56371677",
"text": "def create\n @unidades = Unidade.new(params[:unidade])\n respond_to do |format|\n if @unidades.save\n flash[:notice] = 'CADASTRADO COM SUCESSO.'\n format.html { redirect_to(@unidades) }\n format.xml { render :xml => @unidades, :status => :created, :location => @unidades }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @unidades.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2db28c12f21f8037da06f5c11ac2d419",
"score": "0.563135",
"text": "def create\n @asiento = Asiento.new(params[:asiento])\n\n respond_to do |format|\n if @asiento.save\n format.html { redirect_to(@asiento, :notice => 'Asiento was successfully created.') }\n format.xml { render :xml => @asiento, :status => :created, :location => @asiento }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @asiento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6b05e256d08322bb04bb539189b92a92",
"score": "0.56261444",
"text": "def create\n @estudiante = Estudiante.new(estudiante_params)\n\n respond_to do |format|\n if @estudiante.save\n format.html { redirect_to @estudiante, notice: 'Estudiante was successfully created.' }\n format.json { render :show, status: :created, location: api_v1_estudiante_url(@estudiante) }\n else\n format.html { render :new }\n format.json { render json: @estudiante.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "637d8b8d5647e351e04c8026daa58ca6",
"score": "0.5621658",
"text": "def create\n @servicio = Servicio.new(servicio_params)\n respond_to do |format|\n # Creacion de Asientos de Servicio para el Servicio recien creado\n t = @servicio.transaction do\n @servicio.save\n for i in [email protected]\n AsientoDeServicio.create(nro: i, estado: true, servicio_id: @servicio.id)\n end\n end\n if t\n format.html { redirect_to @servicio, notice: 'Servicio was successfully created.' }\n format.json { render :show, status: :created, location: @servicio }\n else\n format.html { render :new }\n format.json { render json: @servicio.errors, status: :unprocessable_entity }\n end\n end \n end",
"title": ""
},
{
"docid": "507073e54458ded9ff32fc037b0526a4",
"score": "0.56216383",
"text": "def create\n @naciona = Naciona.new(params[:naciona])\n\n respond_to do |format|\n if @naciona.save\n flash[:notice] = 'Naciona was successfully created.'\n format.html { redirect_to(@naciona) }\n format.xml { render :xml => @naciona, :status => :created, :location => @naciona }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @naciona.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "adbd4063f9795c23205a346f6dfd3f22",
"score": "0.5621483",
"text": "def post uri, args = {}; Request.new(POST, uri, args).execute; end",
"title": ""
},
{
"docid": "9a02bf5365970144e6534a7b4ea54be3",
"score": "0.56188774",
"text": "def create\n @episodio = Episodio.new(params[:episodio])\n\n respond_to do |format|\n if @episodio.save\n flash[:notice] = 'Episodio was successfully created.'\n format.html { redirect_to(@episodio) }\n format.xml { render :xml => @episodio, :status => :created, :location => @episodio }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @episodio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5fb040946bdf3cc6fd41652337308c47",
"score": "0.56181484",
"text": "def create\n @nada = Nada.new(params[:nada])\n\n respond_to do |format|\n if @nada.save\n flash[:notice] = 'Nada was successfully created.'\n format.html { redirect_to(@nada) }\n format.xml { render :xml => @nada, :status => :created, :location => @nada }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @nada.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5694a31c35d55703f1cbb394080a3631",
"score": "0.56123173",
"text": "def create\n @expediente = Expediente.new(params[:expediente])\n\n respond_to do |format|\n if @expediente.save\n format.html { redirect_to(@expediente, :notice => 'Expediente was successfully created.') }\n format.xml { render :xml => @expediente, :status => :created, :location => @expediente }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @expediente.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fb94aa5273fff253cecaac12846d805e",
"score": "0.5608866",
"text": "def create\n @servicios = Servicio.new(params[:servicios])\n \n\n respond_to do |format|\n if @servicios.save\n flash[:notice] = 'Servicios was successfully created.'\n format.html { redirect_to(@servicios) }\n format.xml { render :xml => @servicios, :status => :created, :location => @servicios }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @servicios.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "92eee3457901ce87298d5dbb2b9ccda2",
"score": "0.56045014",
"text": "def transmit\n if params[:result] == \"Cancel\"\n flash[:notice] = 'DOI creation cancelled.'\n redirect_to root_url\n elsif params[:result] == \"Edit\"\n redirect_to edit_adapt_doi_url(@doi)\n else\n xml = @doi.data_cite\n app_id = \"00000000\" # TODO read real app_id from secrets.rb\n ada_url = \"http://ada.edu.au/ada/#{@doi.ddi_id}\"\n service_url = \"https://services.ands.org.au/doi/1.1/mint.json/\"\n\n response = HTTParty.post(service_url,\n :query => { :app_id => app_id, :url => ada_url },\n :body => { :xml => \"#{xml}\" },\n :limit => 10)\n Rails.logger.warn response\n # TODO analyse the response here, store new DOI or report error\n\n redirect_to adapt_doi_url(@doi)\n end\n end",
"title": ""
},
{
"docid": "74dc66a58eb7d0d9f52cff4bb2cdeb4e",
"score": "0.55877113",
"text": "def post(options)\n wesabe.post(options)\n end",
"title": ""
},
{
"docid": "7dfbd00b500ac6cb152bd5cff6f832ae",
"score": "0.55817264",
"text": "def create\n @din = Din.new(params[:din])\n\n respond_to do |format|\n if @din.save\n format.html { redirect_to(@din, :notice => 'Din was successfully created.') }\n format.xml { render :xml => @din, :status => :created, :location => @din }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @din.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ef5408565fc2c205d2775e66e96bebd5",
"score": "0.55767274",
"text": "def create\n @estudiante = Estudiante.new(estudiante_params)\n\n respond_to do |format|\n if @estudiante.save\n format.html { redirect_to @estudiante, notice: 'Estudiante was successfully created.' }\n format.json { render :show, status: :created, location: @estudiante }\n else\n format.html { render :new }\n format.json { render json: @estudiante.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "cfb95cd19e18e87e773bb8ea2e8c62fc",
"score": "0.5575033",
"text": "def create\n @pedido_detallado = PedidoDetallado.new(pedido_detallado_params)\n\n respond_to do |format|\n if @pedido_detallado.save\n format.html { redirect_to @pedido_detallado, notice: 'Pedido detallado was successfully created.' }\n format.json { render :show, status: :created, location: @pedido_detallado }\n else\n format.html { render :new }\n format.json { render json: @pedido_detallado.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "3199172d4065b6003041cf7a5b6aad91",
"score": "0.5574732",
"text": "def post_expense_xml(xml)\n #request header bekommt Content-type = xml\n header \"Content-Type\", \"text/xml\" \n #expense daten werden alsl xml per Post request an den Server gesendet\n post '/expenses', xml\n #es wird erwartet das dies erfolgreich war\n expect(last_response.status).to eq(200)\n\n parsed = Ox.load(last_response.body, mode: :hash)\n expect(parsed).to include('expense_id' => a_kind_of(Integer))\n #adds an id key to the expense hash, containing the id from the database, after an expense is succesfully stored\n expense.merge('id' => parsed['expense_id'])\nend",
"title": ""
},
{
"docid": "687c7c8ba072299f1e04fbb31de8c1cf",
"score": "0.55678594",
"text": "def create\n @pedido_atestado = PedidoAtestado.new(pedido_atestado_params)\n\n respond_to do |format|\n if @pedido_atestado.save\n format.json { }\n format.html { redirect_to aluno_path(), notice: 'Pedido encaminhado com sucesso.' }\n else\n format.html { render :new }\n format.json { render json: @pedido_atestado.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e1eb28af1d1d5a44076df597ade18a3b",
"score": "0.5567539",
"text": "def domeniu_params\n params.require(:domeniu).permit(:nume, :descriere, :user_id, :sesiune_id)\n end",
"title": ""
},
{
"docid": "8b864c03b96a413c8ed78fb0af358754",
"score": "0.5564057",
"text": "def create\n @enquete = Enquete.new(params[:enquete])\n\n respond_to do |format|\n if @enquete.save\n format.html { redirect_to(@enquete, :notice => 'Enquete cadastrado com sucesso.') }\n format.xml { render :xml => @enquete, :status => :created, :location => @enquete }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @enquete.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ba213468103fc95cdd3efe3ccb3007a0",
"score": "0.55623907",
"text": "def create\n @dle = Dle.new(params[:dle])\n\n respond_to do |format|\n if @dle.save\n format.html { redirect_to(@dle, :notice => 'Dle was successfully created.') }\n format.xml { render :xml => @dle, :status => :created, :location => @dle }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dle.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "715c5a4794cbe73dd4d3ac394ee6848a",
"score": "0.55618876",
"text": "def create\n @unidades = Unidade.new(params[:unidade])\n respond_to do |format|\n if @unidades.save\n flash[:notice] = 'UNIDADE CADASTRADA COM SUCESSO.'\n format.html { redirect_to(@unidades) }\n format.xml { render :xml => @unidades, :status => :created, :location => @unidades }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @unidades.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9b5be50a2e63556345ef2ec910a1cc9b",
"score": "0.5552655",
"text": "def indicadoresdiario_params\n params.require(:indicadoresdiario).permit(:id_ind_diario, :segmento, :isn, :resp_1_2, :resp_4_5, :resolutividad, :version, :fecha, :volumen)\n end",
"title": ""
},
{
"docid": "5c2ee43627631e091c00efa8577b8e0e",
"score": "0.554953",
"text": "def create\n @destaque = Destaque.new(params[:destaque])\n\n respond_to do |format|\n if @destaque.save\n format.html { redirect_to(@destaque, :notice => 'Destaque was successfully created.') }\n format.xml { render :xml => @destaque, :status => :created, :location => @destaque }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @destaque.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2829236ed83cfa890787ef0984dd1006",
"score": "0.55491203",
"text": "def create\n @tipo_denuncium = TipoDenuncium.new(tipo_denuncium_params)\n\n respond_to do |format|\n if @tipo_denuncium.save\n format.html { redirect_to @tipo_denuncium, notice: 'Tipo denuncium was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_denuncium }\n else\n format.html { render :new }\n format.json { render json: @tipo_denuncium.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "09836182aaef1441b6ee062aec72e786",
"score": "0.554649",
"text": "def create\n @pais_dominio = PaisDominio.new(params[:pais_dominio])\n\n respond_to do |format|\n if @pais_dominio.save\n format.html { redirect_to @pais_dominio, :notice => 'Pais dominio was successfully created.' }\n format.json { render :json => @pais_dominio, :status => :created, :location => @pais_dominio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @pais_dominio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6b50ea7c4bea0dccafb50ece6162374c",
"score": "0.55324507",
"text": "def create\n @dossier = Dossier.new(params[:dossier])\n\n respond_to do |format|\n if @dossier.save\n format.html { redirect_to(@dossier, :notice => 'Dossier was successfully created.') }\n format.xml { render :xml => @dossier, :status => :created, :location => @dossier }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dossier.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "13c4337c40f768d5712a2a8b8904953e",
"score": "0.5522236",
"text": "def create\n @iadre = Iadre.new(params[:iadre])\n\n respond_to do |format|\n if @iadre.save\n format.html { redirect_to([:admin, @iadre], :notice => 'Adres został pomyślnie dodany.') }\n format.xml { render :xml => @iadre, :status => :created, :location => @iadre }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @iadre.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a3e5b23e6897763055a3636f4444494a",
"score": "0.55187905",
"text": "def create\n @diet_instruction = DietInstruction.new(diet_instruction_params)\n\n respond_to do |format|\n if @diet_instruction.save\n flash[:notice] = 'Navodilo je bilo uspesno kreirano'\n format.html { redirect_to controller: :admins, action: :sifranti }\n else\n format.html { render :new }\n format.json { render json: @diet_instruction.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e51b570907cac2f4a7fffd22c0d9ede6",
"score": "0.55186087",
"text": "def reminder\n @postto = BASE_URL + '/directions'\n respond_to do |format|\n format.xml { @postto }\n end\n end",
"title": ""
},
{
"docid": "a53fef2f0eee7f161143fe5efb852c03",
"score": "0.5517408",
"text": "def create\n @disconnexion = Disconnexion.new(disconnexion_params)\n\n respond_to do |format|\n if @disconnexion.save\n format.html { redirect_to @disconnexion, notice: 'Disconnexion was successfully created.' }\n format.json { render :show, status: :created, location: @disconnexion }\n else\n format.html { render :new }\n format.json { render json: @disconnexion.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f33c555cc947bb1b393cd9ebe3bed5a8",
"score": "0.5516475",
"text": "def create\n @estado_despacho = EstadoDespacho.new(params[:estado_despacho])\n\n respond_to do |format|\n if @estado_despacho.save\n flash[:notice] = 'El Estado Despacho fue creado.'\n format.html { redirect_to(@estado_despacho) }\n format.xml { render :xml => @estado_despacho, :status => :created, :location => @estado_despacho }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estado_despacho.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e95b5943f51db7d5473ec87bf68af8aa",
"score": "0.5512494",
"text": "def create\n @estudiante = Estudiante.new(params[:estudiante])\n respond_to do |format|\n if @estudiante.save\n format.html { redirect_to @estudiante, notice: 'El estudiante ha sido creado exitosamente' }\n format.json { render json: @estudiante, status: :created, location: @estudiante }\n else\n format.html { render action: \"new\" }\n format.json { render json: @estudiante.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "64ccb96560fec29013867f07564c3231",
"score": "0.5508811",
"text": "def create\n @denuncia = Denuncia.new(params[:denuncia])\n @expedientes = Expediente.all\n @municipios = Municipio.all\n\n @denuncia.usuario = current_user\n @expediente = Expediente.find(params[:expediente_id])\n @denuncia.expediente = @expediente\n\n respond_to do |format|\n if @denuncia.save\n format.html { redirect_to @expediente, notice: 'Denuncia was successfully created.' }\n format.json { render json: @denuncia, status: :created, location: @denuncia }\n else\n format.html { render action: \"new_con_expediente\" }\n format.json { render json: @denuncia.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e309271243f97ae254b9458fc2aff5b4",
"score": "0.55051684",
"text": "def dieta_params\n params.require(:dieta).permit(:dietaPDF, :nutriologo_id, :paciente_id)\n end",
"title": ""
},
{
"docid": "8e6c796cc57a1fe63445d4eab9889248",
"score": "0.550255",
"text": "def create\n\n @objeto = parent_object\n @adjunto = @objeto.adjuntos.build(params[:adjunto])\n \n respond_to do |format|\n if @adjunto.save\n flash[:notice] = 'Adjunto was successfully created.'\n format.html { redirect_to(adjuntos_url) }\n format.xml { render :xml => @adjunto, :status => :created, :location => @adjunto }\n else\n format.html \n format.xml { render :xml => @comentario.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2ea2b5a68c6dce23480a63e323ebb8e3",
"score": "0.5501864",
"text": "def create\n @apoderado = Apoderado.new(apoderado_params)\n\n respond_to do |format|\n if @apoderado.save\n format.html { redirect_to @apoderado, notice: 'Apoderado was successfully created.' }\n format.json { render :show, status: :created, location: @apoderado }\n else\n format.html { render :new }\n format.json { render json: @apoderado.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "726507b7424796449e38bbd65c1c2afa",
"score": "0.5500111",
"text": "def create\n puts detalhe_params\n @atendimento = Atendimento.new(atendimento_params)\n @detalhe = AtendimentoDetalhe.new(\n atendimento: @atendimento,\n atendente: current_user,\n tipo: AtendimentoDetalhe.tipos.key(atendimento_params[:detalhe_tipo].to_i),\n descricao: atendimento_params[:detalhe_descricao]\n )\n respond_to do |format|\n if @atendimento.save && @detalhe.save\n format.html { redirect_to @atendimento, notice: 'Atendimento criado com sucesso.' }\n format.json { render :show, status: :created, location: @atendimento }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @atendimento.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "16fdf8af49c4ce33055d42d2ca830951",
"score": "0.54972184",
"text": "def post(path, params = {})\n request(:post , path, params)\n end",
"title": ""
},
{
"docid": "c5c1c9b3ba193365a43fbc583a951907",
"score": "0.5495162",
"text": "def create\n @desconto = Desconto.new(params[:desconto])\n respond_to do |format|\n if @desconto.save\n flash[:notice] = 'Desconto criado com sucesso.'\n format.html { redirect_to(admin_descontos_path) }\n format.xml { render :xml => @desconto, :status => :created, :location => @desconto }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @desconto.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "de29edd5419a3a735fe2ce034f6cb1ef",
"score": "0.5490203",
"text": "def dieta_params\n params.require(:dieta).permit(:paciente_id, :alimento_id, :comida)\n end",
"title": ""
},
{
"docid": "952dbdda660421a8408a8df37a7d860c",
"score": "0.5488854",
"text": "def create\n \n \tputs params.inspect\n \n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Post.new('/days.json')\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n#\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(','), :amount => params['amount'], :type => params['type']})\n#\t\trequest.set_form_data(ActiveSupport::JSON.encode(params))\n#\t\trequest.set_form_data({:day => params['day']})\n\t\treq = ActiveSupport::JSON.encode(params);\n\t\tputs req\n\t\trequest.set_form_data(params)\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n \n=begin\n @day = Day.new(params[:day])\n\n respond_to do |format|\n if @day.save\n format.html { redirect_to @day, notice: 'Day was successfully created.' }\n format.json { render json: @day, status: :created, location: @day }\n else\n format.html { render action: \"new\" }\n format.json { render json: @day.errors, status: :unprocessable_entity }\n end\n end\n=end\n end",
"title": ""
},
{
"docid": "f0c269859bcd83e07827ded98e44582a",
"score": "0.54846495",
"text": "def create\n @fecha = Fecha.new(params[:fecha])\n\n respond_to do |format|\n if @fecha.save\n format.html { redirect_to(@fecha, :notice => 'Fecha was successfully created.') }\n format.xml { render :xml => @fecha, :status => :created, :location => @fecha }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @fecha.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d0a7144f3cd5fbdf18a82a2c5e242f80",
"score": "0.54845756",
"text": "def create\n @estado = Estado.new(params[:estado])\n\n respond_to do |format|\n if @estado.save\n flash[:notice] = 'Estado foi criado com sucesso.'\n format.html { redirect_to(@estado) }\n format.xml { render :xml => @estado, :status => :created, :location => @estado }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @estado.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "aa73258549593c74130afde7d3b443b4",
"score": "0.5483821",
"text": "def create\n @saidas = Saida.new(params[:saida])\n\n respond_to do |format|\n if @saidas.save\n flash[:notice] = 'LANÇAMENTO SAIDA EFETUADO.'\n format.html { redirect_to(homes_path) }\n format.xml { render :xml => @saidas, :status => :created, :location => @saidas }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @saidas.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8e061b722eae762b973431602b8b712c",
"score": "0.5480147",
"text": "def create\n @deisgn = Deisgn.new(params[:deisgn])\n\n respond_to do |format|\n if @deisgn.save\n format.html { redirect_to @deisgn, :notice => 'Deisgn was successfully created.' }\n format.json { render :json => @deisgn, :status => :created, :location => @deisgn }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @deisgn.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a212be5005b72d008296d7f994681abc",
"score": "0.54792696",
"text": "def create\n @exemplo = Exemplo.new(params[:exemplo])\n\n respond_to do |format|\n if @exemplo.save\n flash[:notice] = 'Exemplo was successfully created.'\n format.html { redirect_to(@exemplo) }\n format.xml { render :xml => @exemplo, :status => :created, :location => @exemplo }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @exemplo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4c28c4e9d7467ac907dad4cdbd52ed33",
"score": "0.54758424",
"text": "def create\n @dato = Dato.new(dato_params)\n\n respond_to do |format|\n if @dato.save\n format.html { redirect_to @dato, notice: 'Dato was successfully created.' }\n format.json { render :show, status: :created, location: @dato }\n else\n format.html { render :new }\n format.json { render json: @dato.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "673aebb00b0ab8718e1b6ce9a307802a",
"score": "0.5475301",
"text": "def create\n @asignatura = Asignatura.new(params[:asignatura])\n\n respond_to do |format|\n if @asignatura.save\n flash[:notice] = 'Asignatura was successfully created.'\n format.html { redirect_to(@asignatura) }\n format.xml { render :xml => @asignatura, :status => :created, :location => @asignatura }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @asignatura.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "44fe5bf0bae375a2be82b55bb7d1d5ef",
"score": "0.54735374",
"text": "def create\n @entrega = Entrega.new(params[:entrega])\n\n respond_to do |format|\n if @entrega.save\n format.html { redirect_to(@entrega, :notice => 'Entrega was successfully created.') }\n format.xml { render :xml => @entrega, :status => :created, :location => @entrega }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @entrega.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ab94483f99e626aa5bfa5c928af526bb",
"score": "0.54730636",
"text": "def create\n @diocese = Diocese.new(diocese_params)\n\n if @diocese.save\n render json: @diocese, status: :created, location: @diocese\n else\n render json: @diocese.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "8e7f6565369ea645086c63a0bd1072e5",
"score": "0.5470752",
"text": "def create\n @solicitante = Solicitante.new(params[:solicitante])\n\n respond_to do |format|\n if @solicitante.save\n format.html { redirect_to(@solicitante, :notice => 'Solicitante was successfully created.') }\n format.xml { render :xml => @solicitante, :status => :created, :location => @solicitante }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @solicitante.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7e978b590fdce994bbb7565dfe8aedee",
"score": "0.54644287",
"text": "def create\r\n @estudante = Estudante.new(estudante_params)\r\n\r\n respond_to do |format|\r\n if @estudante.save\r\n format.html { redirect_to @estudante, notice: 'Estudante was successfully created.' }\r\n format.json { render :show, status: :created, location: @estudante }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @estudante.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "c4b8ba4273b09ed53e57e2e3ebc0e16d",
"score": "0.54623824",
"text": "def post(options = {})\n request :post, options\n end",
"title": ""
},
{
"docid": "90ed2b2ac19bc32bc6df01e2f1460bfe",
"score": "0.54615134",
"text": "def create\r\n @estudo = Estudo.new(estudo_params)\r\n\r\n respond_to do |format|\r\n if @estudo.save\r\n format.html { redirect_to @estudo, notice: 'O Estudo Foi criado' }\r\n format.json { render action: 'show', status: :created, location: @estudo }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @estudo.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "0274a7df4bd7c8b81e07c979ecf0bf11",
"score": "0.54559046",
"text": "def create\n @dosificacion = Dosificacion.new(dosificacion_params)\n\n respond_to do |format|\n if @dosificacion.save\n\n @etiqueta = Etiqueta.new\n\n etiquetaDosificacion = @dosificacion.etiqueta.etiqueta\n idDosificacion = @dosificacion.id\n idDosificacionString = idDosificacion.to_s\n\n @etiqueta.etiqueta = etiquetaDosificacion + idDosificacionString\n @etiqueta.formato_id = 4\n @etiqueta.save\n\n format.html { redirect_to etiqueta_mostrar_path(@etiqueta.id), notice: 'Dosificación registrada exitosamente.' }\n else\n format.html { render :new }\n end\n end\n end",
"title": ""
},
{
"docid": "00e4e557e6056e853b7e5f85607178a6",
"score": "0.5453748",
"text": "def create\n @note = Note.new(params[:note])\n\n=begin\n $ curl -H 'Content-Type: application/xml' -X POST -d '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<note>\n <content>note from api 2</content>\n <course_id>2</course_id>\n <tag>api</tag>\n</note> http://notility.herokuapp.com/notes\n=end\n\n respond_to do |format|\n if @note.save\n format.html { redirect_to @note, notice: 'Note was successfully created.' }\n format.json { render json: @note, status: :created, location: @note }\n format.xml { render :xml => @note }\n else\n format.html { render action: \"new\" }\n format.xml { render :xml => \"Failed\"}\n flash[:notice] = \"Failed to save.\"\n end\n end\n end",
"title": ""
},
{
"docid": "6181e4904cdbd41cca0aa9e1a2f233ce",
"score": "0.544601",
"text": "def new\n @estagiarios = Estagiario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estagiarios }\n end\n end",
"title": ""
},
{
"docid": "26380d1b624f706bca7f17ea821ec233",
"score": "0.54449546",
"text": "def new\n @ponto_diario = PontoDiario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ponto_diario }\n end\n end",
"title": ""
},
{
"docid": "e9d0913ae7a631948940122a0936d32e",
"score": "0.54394025",
"text": "def create\n\n request = RestClient.post File.join(API_SERVER,\"rest-api/departments\"), { \n 'name' => params['department']['name'], \n 'description' => params['department']['description'] }.to_json, :content_type => :json, :accept => :json\n redirect_to :action => :index\n end",
"title": ""
},
{
"docid": "137368900147c10d49e8222d0d8c3108",
"score": "0.54352874",
"text": "def create\n @asignatura = Asignatura.new(params[:asignatura])\n\n respond_to do |format|\n if @asignatura.save\n format.html { redirect_to(@asignatura, :notice => 'Asignatura was successfully created.') }\n format.xml { render :xml => @asignatura, :status => :created, :location => @asignatura }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @asignatura.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1774b4ca81ddb0bd0a1d46fed3953790",
"score": "0.5433149",
"text": "def create\n @factura = Factura.new(factura_params)\n @factura.domiciliada = params[:domiciliada]\n\n\n respond_to do |format|\n if @factura.save\n format.html { redirect_to facturas_path }\n format.json { render action: 'show', status: :created, location: @factura }\n else\n format.html { render action: 'new' }\n format.json { render json: @factura.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2cc5459320c29e37b5c3d1dd704dd06b",
"score": "0.54244846",
"text": "def create\n @prescripcion_diarium = PrescripcionDiarium.new(prescripcion_diarium_params)\n\n respond_to do |format|\n if @prescripcion_diarium.save\n format.html { redirect_to @prescripcion_diarium, notice: 'Prescripcion diarium was successfully created.' }\n format.json { render :show, status: :created, location: @prescripcion_diarium }\n else\n format.html { render :new }\n format.json { render json: @prescripcion_diarium.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "30050d8d8cc0a99064ea734d58fafbdd",
"score": "0.5424269",
"text": "def create\n\n @idioma = Idioma.new(idioma_params)\n\n respond_to do |format|\n if @idioma.save\n format.html { redirect_to idiomas_path(@idioma, egresso_id: @idioma.egresso_id), notice: 'Idioma criado com sucesso.' }\n format.json { render :show, status: :created, location: idiomas_path }\n else\n format.html { render :new }\n format.json { render json: @idioma.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
ce3c5e733f9d674c86e3b0880a840d50
|
When passed a block, yields AppInstance records from the API. This operation lazily loads records as efficiently as possible until the limit is reached. source://twilioruby//lib/twilioruby/rest/microvisor/v1/app.rb66
|
[
{
"docid": "abc7181aaa3fa40e9807e1a6e9021314",
"score": "0.0",
"text": "def each; end",
"title": ""
}
] |
[
{
"docid": "8510b02019c3ea6c88ddc9179865acc5",
"score": "0.6029344",
"text": "def each(&block)\n @apps.each(&block) if @apps\n end",
"title": ""
},
{
"docid": "2ffd26b5f5fd669a5e4846ec0fc4d690",
"score": "0.58095443",
"text": "def index\n @app_instances = AppInstance.all\n end",
"title": ""
},
{
"docid": "ea154d03f3239ce0f66af179b3789a7a",
"score": "0.5790013",
"text": "def all(options = {}, &block)\n url = \"#{API_BASE_URL}#{api_path}\"\n\n params = { per_page: 999 }.merge!(options)\n\n request_manager.GET(url, parameters: params, success: ->(operation, result) {\n records = []\n\n result[\"#{api_name}s\"].each do |params|\n records << new(params)\n end\n\n block.call(records, nil) if block\n }, failure: ->(operation, error) {\n block.call(nil, error) if block\n })\n\n self\n end",
"title": ""
},
{
"docid": "498526ea93de414d6d7a6275362bead4",
"score": "0.5780775",
"text": "def each_server_app(&block)\n @app.each(@options, &block)\n end",
"title": ""
},
{
"docid": "100112963015559d7c323e658e38d289",
"score": "0.56548744",
"text": "def all\n request_model = @request_model_factory.all_apps_request_model\n response = @network_client.perform_request(request_model)\n JSON.parse(response.body).map do |app_hash|\n Fabricio::Model::App.new(app_hash)\n end\n end",
"title": ""
},
{
"docid": "236e823711167622887498279974e925",
"score": "0.5647958",
"text": "def limit(env)\n app.call(env)\n end",
"title": ""
},
{
"docid": "490fb148957fb9396a788dd33ed60b02",
"score": "0.5621897",
"text": "def get_apps\n apps = @api_rate_limit.call.app.list.sort_by { |app| DateTime.parse(app[\"created_at\"]) }.reverse\n @app_count = apps.count\n @hatchet_apps = apps.select {|app| app[\"name\"].match(@regex) }\n end",
"title": ""
},
{
"docid": "99510526c2830e77db66304e13e6471d",
"score": "0.55476207",
"text": "def each\n @raw_page['records'].each { |record| yield Force::Mash.build(record, @client) }\n\n next_page.each { |record| yield record } if has_next_page?\n end",
"title": ""
},
{
"docid": "4ba654e0dce0b47f9acaba6f1a995677",
"score": "0.55061865",
"text": "def get_api_apps(opts={})\n path = '/api_app/list'\n path += opts[:page] ? \"?page=#{opts[:page]}\" : ''\n path += opts[:page_size] ? \"&page_size=#{opts[:page_size]}\" : ''\n HelloSign::Resource::ResourceArray.new get(path, opts), 'api_apps', HelloSign::Resource::ApiApp\n end",
"title": ""
},
{
"docid": "f473542fe49df7ba1e9ded5cd4db3338",
"score": "0.548174",
"text": "def get_applications_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ApplicationManagementApi.get_applications ...'\n end\n # resource path\n local_var_path = '/appManagement/applicationList'\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[:'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[:'includeCourseCount'] = opts[:'include_course_count'] if !opts[:'include_course_count'].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_MANAGEMENT', '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 => 'ApplicationInfoListSchema')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ApplicationManagementApi#get_applications\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "747216aa107df7925ea91ba8c949887d",
"score": "0.5480282",
"text": "def app_instances(name)\n require_login\n raise CloudFoundry::Client::Exception::BadParams, \"Name cannot be blank\" if name.nil? || name.empty?\n get(\"#{CloudFoundry::Client::APPS_PATH}/#{name}/instances\")\n end",
"title": ""
},
{
"docid": "29c167d49b83e52b26ad843cb1e405ae",
"score": "0.54756397",
"text": "def app\n @app_resource ||= App.new(@client)\n end",
"title": ""
},
{
"docid": "29c167d49b83e52b26ad843cb1e405ae",
"score": "0.54756397",
"text": "def app\n @app_resource ||= App.new(@client)\n end",
"title": ""
},
{
"docid": "db8d8fa154f2e2494cc1ad3090121cff",
"score": "0.5448183",
"text": "def list_applications_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.list_applications ...'\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_applications, 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_applications, 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_applications, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/applications'\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] || 'ApplicationsCollection' \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_applications\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "9a01a8dc2ffdcf22c5eebb10f4508832",
"score": "0.5445254",
"text": "def retrieve_applications()\n start.uri('/api/application')\n .get()\n .go()\n end",
"title": ""
},
{
"docid": "577f3e7e098b0f1d572897563503246c",
"score": "0.54129934",
"text": "def retrieve_applications()\n start.uri('/api/application')\n .get()\n .go()\n end",
"title": ""
},
{
"docid": "5a7ff4fd9e07b4af917ea5ca6b4950ef",
"score": "0.54082847",
"text": "def each_experience(client, org, limit=200, offset=0, &block)\n all = client.experiences.get(org, :limit => limit, :offset => offset)\n\n all.each do |exp|\n next if exp.status != ::Io::Flow::V0::Models::ExperienceStatus.active\n yield exp\n end\n\n if all.size >= limit\n each_experience(client, org, limit, offset + limit, &block)\n end\nend",
"title": ""
},
{
"docid": "d6ff72e59f2af35113c7045ef09b295d",
"score": "0.5400582",
"text": "def app\n @app ||= begin\n builder.lock!\n builder.to_app(lambda { |env|\n # the inner app that creates and returns the Response object\n response = Response.new\n response.finish(env) unless env[:parallel_manager]\n env[:response] = response\n })\n end\n end",
"title": ""
},
{
"docid": "d6ff72e59f2af35113c7045ef09b295d",
"score": "0.5400582",
"text": "def app\n @app ||= begin\n builder.lock!\n builder.to_app(lambda { |env|\n # the inner app that creates and returns the Response object\n response = Response.new\n response.finish(env) unless env[:parallel_manager]\n env[:response] = response\n })\n end\n end",
"title": ""
},
{
"docid": "c1a4d959431e259d5fa3a9f520fa5eff",
"score": "0.5398604",
"text": "def admin_apps_requests_list(options = {})\n if block_given?\n Pagination::Cursor.new(self, :admin_apps_requests_list, options).each do |page|\n yield page\n end\n else\n post('admin.apps.requests.list', options)\n end\n end",
"title": ""
},
{
"docid": "c476e981570518dcbe3483f59b2385aa",
"score": "0.5395062",
"text": "def get_app_list\n page = params[:page].blank? ? 1 : params[:page]\n apps = (FacebookAppList.search do \n fulltext \"\"\n paginate :page => page, :per_page => 12\n end).results\n next_page = apps.last_page? ? -1 : (page.to_i + 1)\n previous_page = apps.first_page? ? -1 : (page.to_i - 1)\n @response_data = ::Response::Data.new(:TotalPages => apps.num_pages, \n :Message => \"Successfully fetched #{apps.size} apps.\", \n :NextPage => next_page, \n :PreviousPage => previous_page, \n :CurrentPage => page, \n :Response => \"success\")\n @response_data.Data = ActiveSupport::JSON.decode(apps.to_json(:only => [:id, :app_name, :app_url]))\n render \"facebook/response\"\n end",
"title": ""
},
{
"docid": "df644de6ccc368dd9085c899c09ec93e",
"score": "0.53608876",
"text": "def each_experience(client, org, limit=200, offset=0, &block)\n all = client.experiences.get(org, :limit => limit, :offset => offset)\n\n all.each do |exp|\n yield exp\n end\n\n if all.size >= limit\n each_experience(client, org, limit, offset + limit, &block)\n end\nend",
"title": ""
},
{
"docid": "a5518ccec888e81e677fb716201872de",
"score": "0.5313302",
"text": "def retrieve_each(count, params:, max_call: 1000)\n offset = params.fetch(:offset, 0)\n calls = 0\n\n loop do\n ret = retrieve(params.merge(count: count, offset: offset))\n if ret.err?\n yield(ret, nil)\n break\n end\n\n json = ret.response.body_json\n calls += 1\n\n yield(ret, json)\n break if json['list'].empty? || max_call <= calls\n\n offset += count\n end\n end",
"title": ""
},
{
"docid": "c2d8daac60f04088ea8878e51c17656c",
"score": "0.5305664",
"text": "def applications\n return App.for_plan(self.id)\n end",
"title": ""
},
{
"docid": "2355672122811b29040fc67ae49bb3cc",
"score": "0.5286035",
"text": "def each_app(&blk)\n return unless manifest\n\n ordered_by_deps(manifest[:applications]).each(&blk)\n end",
"title": ""
},
{
"docid": "52622f5207f72d6bb1c9d80471d0dd27",
"score": "0.5278546",
"text": "def apps(compartment_name:)\n fn_management_client\n .list_applications(\n compartment_ocid(compartment_name: compartment_name),\n limit: 50\n ).collect(&:data).flatten\nend",
"title": ""
},
{
"docid": "45b6fd71502e34cf2c89d3e40aaa449a",
"score": "0.52760875",
"text": "def each_in_batches(&block)\n each(&block)\n\n # Non-pagination usecase or last page reached\n return if @pagination_next_page.nil?\n\n # Query the server for the next page\n resources = Resource.get(@pagination_next_page, {}, {}, @clazz)\n resources.each_in_batches(&block)\n end",
"title": ""
},
{
"docid": "fcc1b1ee6eeb47f320b80ab0cf96a7b6",
"score": "0.52573943",
"text": "def each options=nil, &block\n server_apps = find options\n server_apps.each(&block)\n end",
"title": ""
},
{
"docid": "6f4cf16aa46aa5e3bf3ce38adcebe537",
"score": "0.52515745",
"text": "def index\n @apps = App.paginate(page: params[:page])\n end",
"title": ""
},
{
"docid": "ef4b93851110f56866f544c878533886",
"score": "0.5247497",
"text": "def list_apps_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AppApi.list_apps ...\"\n end\n # resource path\n local_var_path = \"/apps\"\n\n # query parameters\n query_params = {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n\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 = ['jwt']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ListAppsResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AppApi#list_apps\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "fb1045203216973037711e54a486e702",
"score": "0.5234827",
"text": "def batch(api_name, options = {})\n batch = Api.get(api_name)::Batch.new(self, options)\n if block_given?\n yield batch\n batch.run\n end\n batch\n end",
"title": ""
},
{
"docid": "fca0dfd6a9de4b04bade0460550f1405",
"score": "0.52183974",
"text": "def all_apps_request_model\n model = Fabricio::Networking::RequestModel.new do |config|\n config.type = :GET\n config.base_url = FABRIC_API_URL\n config.api_path = FABRIC_API_PATH + FABRIC_APPS_ENDPOINT\n end\n model\n end",
"title": ""
},
{
"docid": "fca0dfd6a9de4b04bade0460550f1405",
"score": "0.52183974",
"text": "def all_apps_request_model\n model = Fabricio::Networking::RequestModel.new do |config|\n config.type = :GET\n config.base_url = FABRIC_API_URL\n config.api_path = FABRIC_API_PATH + FABRIC_APPS_ENDPOINT\n end\n model\n end",
"title": ""
},
{
"docid": "cef832cccb2024578d41113ad995ac64",
"score": "0.519726",
"text": "def index\n @apps = App.all.order(\"updated_at DESC\").limit 5\n end",
"title": ""
},
{
"docid": "736a4a33d81212248026f236e8af2784",
"score": "0.518919",
"text": "def index\n @job_applications = JobApplication.paginate_by_job_seeker_id(@job_seeker.id,\n :include => [:job],\n :page => params[:page], \n :per_page => params[:per_page] || 5,\n :order => 'updated_at DESC')\n end",
"title": ""
},
{
"docid": "0d7f4c13d87c249e7bb044122f67ef84",
"score": "0.51777506",
"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": "5cac996fc93dacd4dfa82ffc468fad51",
"score": "0.5165141",
"text": "def get_application_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ApplicationApi.get_application_all_using_get ...'\n end\n # resource path\n local_var_path = '/application'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\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 => 'PageApplication')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ApplicationApi#get_application_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "bd210199f18b32efcd536d3479f16c40",
"score": "0.5161121",
"text": "def all_sequentially &block\n page, per_page = 1, 5\n begin\n results = paginate(page: page, per_page: per_page, order: '_id asc')\n results.each{|o| block.call o}\n page += 1\n end until results.blank? or results.size < per_page\n end",
"title": ""
},
{
"docid": "dda63b835edfde957febfe0567b2425c",
"score": "0.51559174",
"text": "def accessible_apps # rubocop:disable Metrics/MethodLength\n page = params[:page].to_i > 0 ? params[:page] : 1\n scope = %w(public private).include?(params[:scope]) ? params[:scope] : %w(public private)\n query = params[:query].presence\n\n app_series = AppSeries.includes(:latest_revision_app).\n accessible_by(@context).unremoved.\n where(scope: scope).page(page)\n\n if query\n app_series = app_series.eager_load(:tags)\n .where(\"app_series.name REGEXP ? OR tags.name REGEXP ?\", query, query)\n end\n\n apps = app_series.map do |app_serie|\n revisions = app_serie.accessible_revisions(@context).map do |app|\n {\n revision: app.revision,\n id: app.id,\n uid: app.uid,\n title: app.title,\n version: app.version,\n }\n end\n\n latest_revision_app = app_serie.latest_revision_app\n\n {\n id: latest_revision_app.id,\n name: latest_revision_app.name,\n scope: latest_revision_app.scope,\n spec: latest_revision_app.spec,\n revisions: revisions,\n }\n end\n\n render json: apps\n end",
"title": ""
},
{
"docid": "1b02579f6e16fd516ba91f731e13e186",
"score": "0.51547796",
"text": "def list_apps\n app_series = if unsafe_params[:editable]\n AppSeries.editable_by(@context).accessible_by_private\n else\n AppSeries.accessible_by(@context)\n end\n\n app_series = app_series.eager_load(:latest_revision_app, :latest_version_app).order(id: :desc)\n apps = app_series.map { |series| series.latest_accessible(@context) }.compact\n\n # The scope applies to the App and not the AppSeries\n if unsafe_params[:scopes].present?\n check_scope!\n apps = apps.select { |app| unsafe_params[:scopes].include?(app.scope) }\n end\n\n result = apps.map do |app|\n describe_for_api(app, unsafe_params[:describe])\n end\n\n render json: result\n end",
"title": ""
},
{
"docid": "578daa4d62c4d6f6d13eca465f30d701",
"score": "0.5152546",
"text": "def app(&block) # :yields:\n @app ||= Console::Application.new\n if block\n DslProxy.exec(@app, &block)\n end\n @app\n end",
"title": ""
},
{
"docid": "aa681a7346191e731b175d7ba67cffea",
"score": "0.5150484",
"text": "def list_all_app_meta_data_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.list_all_app_meta_data ...'\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_app_meta_data, 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_app_meta_data, 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_app_meta_data, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/app_meta_data'\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] || 'AppMetaDataCollection' \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_app_meta_data\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "4b8fe599792690c0299959e3e5bdc3b4",
"score": "0.51476705",
"text": "def each(&block)\n load! if !_data\n\n i = 0\n count = 0\n while true\n # Sanity check to avoid nil accesses, although this should\n # never happen\n break if !_data || !_data[i]\n\n Fogli.logger.info(\"Fogli Cache: #{log_string(i)}\") if Fogli.logger\n\n _data[i][\"data\"].each do |item|\n count += 1\n yield item\n\n # Facebook's \"limit\" is a limit per page, not a total\n # limit, which is what is expected, so we have to keep\n # track of that manually\n return if options[:limit] && count >= options[:limit].to_i\n end\n\n i += 1\n\n if i >= _data.length\n # Load the next page, but exit the loop if we're on the\n # last page.\n break if !load!\n end\n end\n end",
"title": ""
},
{
"docid": "cb260d68ee8cfca838c77ec8a0dc6dd6",
"score": "0.514319",
"text": "def each\n limits = @version.read_limits\n \n page = self.page(\n page_size: limits['page_size'],\n )\n \n @version.stream(page,\n limit: limits['limit'],\n page_limit: limits['page_limit']).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "cb260d68ee8cfca838c77ec8a0dc6dd6",
"score": "0.514319",
"text": "def each\n limits = @version.read_limits\n \n page = self.page(\n page_size: limits['page_size'],\n )\n \n @version.stream(page,\n limit: limits['limit'],\n page_limit: limits['page_limit']).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "5cf557d073ed6cdaf18b59898fe2b405",
"score": "0.5140972",
"text": "def application_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ApplicationsApi.application_get ...\"\n end\n # resource path\n local_var_path = \"/application\"\n\n # query parameters\n query_params = {}\n query_params[:'index'] = opts[:'index'] if !opts[:'index'].nil?\n query_params[:'count'] = opts[:'count'] if !opts[:'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 = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<ApplicationsResponse>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ApplicationsApi#application_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "df1921cc214d2662bd9d1d00fba0f97c",
"score": "0.5139566",
"text": "def each\n page_token = nil\n loop do\n response = client.list_instances @config.project_path,\n page_token: page_token\n\n response.instances.each do |instance|\n yield instance\n end\n page_token = response.next_page_token\n\n break if page_token.nil?\n end\n end",
"title": ""
},
{
"docid": "66273a318f43b0e73eb899ca885b4f03",
"score": "0.51137704",
"text": "def load_applications\n api_load_has_one(:source, :application, 'source_id')\n end",
"title": ""
},
{
"docid": "6a73b4b2bba4345e479a23f80ca2223a",
"score": "0.5113454",
"text": "def accessible_apps # rubocop:disable Metrics/MethodLength\n page = params[:page].to_i > 0 ? params[:page] : 1\n scope = %w(public private).include?(params[:scope]) ? params[:scope] : %w(public private)\n query = params[:query].presence\n\n app_series = AppSeries.includes(:latest_revision_app)\n .accessible_by(@context)\n .where(scope: scope)\n .page(page)\n\n if query\n app_series = app_series.eager_load(:tags)\n .where(\"app_series.name REGEXP ? OR tags.name REGEXP ?\", query, query)\n end\n\n apps = app_series.map do |app_serie|\n revisions = app_serie.accessible_revisions(@context).map do |app|\n {\n revision: app.revision,\n id: app.id,\n uid: app.uid,\n title: app.title,\n version: app.version,\n }\n end\n\n latest_revision_app = app_serie.latest_revision_app\n\n {\n id: latest_revision_app.id,\n name: latest_revision_app.name,\n scope: latest_revision_app.scope,\n spec: latest_revision_app.spec,\n revisions: revisions,\n }\n end\n\n render json: apps\n end",
"title": ""
},
{
"docid": "ef1d39ded3a07a1bf0f7c08880db032e",
"score": "0.5107205",
"text": "def app\n jobs = App.find_by(uid: unsafe_params[:id]).\n app_series.jobs.accessible_by(@context).\n eager_load(:app, user: :org, analysis: :workflow).\n includes(:taggings).\n search_by_tags(params.dig(:filters, :tags)).\n order(order_from_params).page(page_from_params).per(page_size)\n\n jobs = JobService::JobsFilter.call(jobs, params[:filters])\n jobs.each { |job| job.current_user = @context.user }\n\n page_dict = pagination_dict(jobs)\n\n render json: jobs, root: Job.model_name.plural,\n meta: { count: page_dict[:total_count], pagination: page_dict },\n adapter: :json\n end",
"title": ""
},
{
"docid": "95c221af7ae46be91044562431acaff6",
"score": "0.5099214",
"text": "def after_app_loaded(&block)\n if application_loaded?\n yield app\n else\n @after_app_loaded_blocks ||= []\n @after_app_loaded_blocks << block\n end\n end",
"title": ""
},
{
"docid": "491c54745b6c9341b79aa9335f1f56d0",
"score": "0.50932825",
"text": "def run(app, block_params, &block)\n parsed_body = {}\n if JSON_CONTENT_TYPE.like?(app.env['CONTENT_TYPE'])\n body = app.request.body.read\n unless body.empty?\n begin\n parsed_body = JSON.parse(body)\n rescue JSON::ParserError => e\n return [400, {:code => 400, :message => e.message}.to_json]\n end\n end\n end\n app.params['parsed_body'] = parsed_body\n unless @processors_dispatchers.empty?\n @processors_dispatchers.each do |processor_dispatcher|\n begin\n processor_dispatcher.process(app, parsed_body)\n rescue SwaggerInvalidException => e\n app.content_type :json\n return [400, {:code => 400, :message => e.message}.to_json]\n end\n end\n end\n if block\n # Execute the block in the context of the app\n app.instance_exec(*block_params, &block)\n else\n ''\n end\n end",
"title": ""
},
{
"docid": "e09ccbab4717ce7ef5cc790acade8b8f",
"score": "0.50771874",
"text": "def initialize(app, &block)\n @app = app\n reset\n block.call(self)\n self\n end",
"title": ""
},
{
"docid": "2be43bdf961eefbb1d8dfbba1e66afd8",
"score": "0.5074526",
"text": "def read_from_api(endpoint, &block)\n # first page\n fetch_page(endpoint, first_page_params)\n yield current_items if block_given?\n\n # subsequent pages (if any)\n while has_next_page?\n sleep(rand(0.25))\n fetch_page(next_page_url)\n yield current_items if block_given?\n end\n end",
"title": ""
},
{
"docid": "1f01599e029f490858af535b007e91fe",
"score": "0.50529444",
"text": "def index\n apps = applications.scope_search(search)\n .serialization_preloading.paginate(:page => current_page, :per_page => per_page)\n respond_with(apps)\n end",
"title": ""
},
{
"docid": "e8cd6a9e0a3a9bc2c5704890f492eb8d",
"score": "0.50427604",
"text": "def each\n limits = @version.read_limits\n \n page = self.page(\n page_size: limits['page_size'],\n )\n \n @version.stream(page,\n limit: limits['limit'],\n page_limit: limits['page_limit']).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "0c37ccc5978e47cf270d24b599e1e2c8",
"score": "0.50304615",
"text": "def get_application_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UtilsApi.get_application_all_using_get ...'\n end\n # resource path\n local_var_path = '/nucleus/v1/application'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\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 => 'PageApplication')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UtilsApi#get_application_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "2293a7b25bfe5b9fae465e3b4ac89742",
"score": "0.50248677",
"text": "def instances\n get_json(instances_endpoint)\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "c2d93895a85b08361f627aaa57194c2e",
"score": "0.5015872",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size], )\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
},
{
"docid": "3f6f5f04d8037054d36975d186baeb4e",
"score": "0.50151294",
"text": "def index\n include_cartridges = (params[:include] == \"cartridges\")\n domain_id = params[:domain_id].presence\n\n by = domain_id.present? ? {domain_namespace: Domain.check_name!(domain_id).downcase} : {}\n apps =\n case params[:owner]\n when \"@self\" then Application.includes(:domain).accessible(current_user).where(owner: current_user)\n when nil then Application.includes(:domain).accessible(current_user)\n else return render_error(:bad_request, \"Only @self is supported for the 'owner' argument.\")\n end.where(by).sort_by{ |a| a.name }.map { |app| get_rest_application(app, include_cartridges) }\n Domain.find_by(canonical_namespace: domain_id.downcase) if apps.empty? && domain_id.present? # check for a missing domain\n\n @analytics_tracker.track_event('apps_list', nil, nil, {'domain_namespace' => domain_id})\n\n render_success(:ok, \"applications\", apps, \"Found #{apps.length} applications.\")\n end",
"title": ""
},
{
"docid": "76b4aaa23062a3ffd46b7857a5e346c3",
"score": "0.50070095",
"text": "def rack_app &blk\n App.new(self, &blk)\n end",
"title": ""
},
{
"docid": "ac950d2662c0f5036518e82982de540d",
"score": "0.49998182",
"text": "def apps\n @apps ||= AppSet.new heroku_api\n end",
"title": ""
},
{
"docid": "3bf4057ec64b994efe8d26d60180274d",
"score": "0.49991944",
"text": "def each\n params = {}\n if range[:begin]\n begin_key = range[:begin_inclusive] ? :start : :after\n params[begin_key] = range[:begin]\n end\n if range[:end]\n end_key = range[:end_inclusive] ? :end : :before\n params[end_key] = range[:end]\n end\n params[:limit] = range[:limit]\n @response ||= collection.perform(:list, params)\n return enum_for(:each) unless block_given?\n raise ResultsNotReady.new if collection.app.inside_parallel?\n loop do\n @response.results.each do |doc|\n yield KeyValue.from_listing(collection, doc, @response)\n end\n break unless @response.next_link\n @response = @response.next_results\n end\n @response = nil\n end",
"title": ""
},
{
"docid": "216f1aa981cefcf571ad38db387c751e",
"score": "0.49819767",
"text": "def call(env)\n increment_active_requests\n if block_requests?\n block_request\n else\n @app.call(env)\n end\n ensure\n decrement_active_requests\n end",
"title": ""
},
{
"docid": "328f9616214d13cb4490a44149fa1a8a",
"score": "0.49815568",
"text": "def each(&block)\n process_results(&block)\n until next_page.nil?\n result = service.execute(next_page_url)\n process_results(&block)\n end\n end",
"title": ""
},
{
"docid": "9cf02761f09e04ae53bd4e17456f3257",
"score": "0.49787924",
"text": "def each\n docs = DefaultPaginator.new\n while docs.has_next?\n docs = connection.paginate(docs.next_page, docs.per_page, \"select\", params: { q: query })[\"response\"][\"docs\"]\n docs.each do |doc|\n yield resource_factory.to_resource(object: doc)\n end\n end\n end",
"title": ""
},
{
"docid": "9cf02761f09e04ae53bd4e17456f3257",
"score": "0.49787924",
"text": "def each\n docs = DefaultPaginator.new\n while docs.has_next?\n docs = connection.paginate(docs.next_page, docs.per_page, \"select\", params: { q: query })[\"response\"][\"docs\"]\n docs.each do |doc|\n yield resource_factory.to_resource(object: doc)\n end\n end\n end",
"title": ""
},
{
"docid": "d2a3cdd537fa76309194532e56b3ed7b",
"score": "0.49761286",
"text": "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size],)\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n end",
"title": ""
}
] |
d7fec1b0a292efa67c729d7d61976c15
|
Field setter method, accpet args and &block to be passed. For details how to pass args and block see Lolita::Configuration::Field. Return field itself.
|
[
{
"docid": "d04f426dc1ab661d20f9bf7df5679be1",
"score": "0.62729025",
"text": "def field *args, &block\n field=Lolita::Configuration::Factory::Field.add(self.current_dbi,*args,&block)\n field.field_set = current_fieldset\n if self.current_dbi!=self.dbi\n field.nested_in=self.dbi\n field.nested_form = current_nested_form\n end\n @fields << field\n field\n end",
"title": ""
}
] |
[
{
"docid": "20eef49caaebe4019fc2e6e7526c60e4",
"score": "0.69422084",
"text": "def set_field(field)\n\t\tend",
"title": ""
},
{
"docid": "20eef49caaebe4019fc2e6e7526c60e4",
"score": "0.69422084",
"text": "def set_field(field)\n\t\tend",
"title": ""
},
{
"docid": "2b3665186a9d73ff6b845e1e79dfc3e1",
"score": "0.6819862",
"text": "def field(name, &block)\n @config[:fields][name.to_sym] = Docile.dsl_eval(Watchy::Config::FieldConfigBuilder.new, &block).build\n end",
"title": ""
},
{
"docid": "b721c4b24ac37fd45794a7a0d59ba5f7",
"score": "0.663323",
"text": "def field=(value)\n @field = value\n end",
"title": ""
},
{
"docid": "be5158623d8b39a65c75051d9f3ec254",
"score": "0.6558651",
"text": "def field field, &block\n if (block_given?)\n resource = nest_resource field, &block\n [:formatters, :assigners, :inputs].each do |t|\n c = resource.send(t)\n self.send(t).merge!(c.inject(Hash.new){|m,v| m.merge!(\"#{field}.#{v[0]}\".to_sym => v[1])})\n end\n end\n return FieldConfig.new(field, self)\n end",
"title": ""
},
{
"docid": "04d3301d28ac0ea3e553becd80a8794f",
"score": "0.636561",
"text": "def define_setter(field_name)\n define_method(\"#{field_name}=\") do |value|\n send(field_name).tap { |field| field.overwrite(value) }\n end\n end",
"title": ""
},
{
"docid": "f32d2eba4cefc3f10d020470d46262a1",
"score": "0.63534635",
"text": "def field=(_arg0); end",
"title": ""
},
{
"docid": "8b5206aeba957b4a3368f4384e13cf81",
"score": "0.631388",
"text": "def fld=(val); @fld = val end",
"title": ""
},
{
"docid": "7cc99615c57691a4446c21c5bffb0708",
"score": "0.6291448",
"text": "def create_field_setter(name, meth, field)\n generated_methods.module_eval do\n re_define_method(\"#{meth}=\") do |value|\n typed_value = TinyDyno::Adapter.simple_attribute(field_type: field.options[:type], value: value)\n write_attribute(name, typed_value)\n end\n end\n end",
"title": ""
},
{
"docid": "fe29f0c6265dd90477f35297cd422d11",
"score": "0.6277258",
"text": "def field(name, **props, &block)\n field = config[:fields].fetch(name, field_defaults(name))\n props.merge!(converter: block) if block\n\n @config = { **config,\n fields: { **config[:fields],\n name => { **field, **props }\n }\n }\n end",
"title": ""
},
{
"docid": "882e6a6e00c04227cfefbd21d55994de",
"score": "0.6269009",
"text": "def set_field(field_name, field_value)\n send(\"#{field_name}=\", field_value)\n end",
"title": ""
},
{
"docid": "8901875ac94dd08ee3393a045e997b76",
"score": "0.6218862",
"text": "def configure_field\n end",
"title": ""
},
{
"docid": "8901875ac94dd08ee3393a045e997b76",
"score": "0.6218862",
"text": "def configure_field\n end",
"title": ""
},
{
"docid": "bbbcaa6a08e272ea0458f399d95c7f44",
"score": "0.6152381",
"text": "def create_field_setter(name, meth, field)\n generated_methods.module_eval do\n re_define_method(\"#{meth}=\") do |value|\n write_attribute(name, value, field)\n end\n end\n end",
"title": ""
},
{
"docid": "dcff7b5aca1c14fc97e812c9623561e2",
"score": "0.6147347",
"text": "def set_field\n #@field = Field.find(params[:field_id])\n end",
"title": ""
},
{
"docid": "1243295704442ba43f087f95bf05143d",
"score": "0.6137982",
"text": "def set_field\n @field = Field.find(params[:field_id])\n end",
"title": ""
},
{
"docid": "d01288957c6a4bc3c0b04343fbd417b7",
"score": "0.61056256",
"text": "def field(name, &block)\n if fields[name]\n fields[name].instance_exec(&block)\n else\n fields[name] = Field.new(self, name, &block)\n end\n end",
"title": ""
},
{
"docid": "8737abb4445776d07b8211e4221a51ca",
"score": "0.60914296",
"text": "def configure_field\n end",
"title": ""
},
{
"docid": "849f8240554fad17cdbb718b4fa08be2",
"score": "0.6070146",
"text": "def set_field(name,value)\n begin\n field = find_field(name)\n field.Value = value.to_s if field\n rescue\n require 'pry'\n binding.pry\n nil\n end\n end",
"title": ""
},
{
"docid": "01c305b206b1eb693b620da37ffc5a69",
"score": "0.60607857",
"text": "def field( *attrs )\n name, hash = attrs.first, attrs[1]\n\n self.instance_fields[name] = hash || {}\n\n # Defines a method that corresponds to the field attribute and tries to make value of the implicit type\n #\n define_method(\"#{name}=\") do |value|\n self[name] = self.class.cast_value(value, self.class.fields[name])\n end\n\n define_method(\"#{name}\") do\n definition = self.class.fields[name]\n self[name] ||\n (definition[:default].is_a?(TrueClass) && definition[:type].to_s.constantize.try(:default)) ||\n self.proc_or_value(definition[:default])\n end\n\n end",
"title": ""
},
{
"docid": "de27084e50a15dbd04d258a284e14284",
"score": "0.60387087",
"text": "def set(field, value)\n @fields_update[field] = value\n end",
"title": ""
},
{
"docid": "857edabba544cb14258d47ea6d147ef8",
"score": "0.60138565",
"text": "def set_field\n @field = FormKit::Field.find(params[:field_id])\n end",
"title": ""
},
{
"docid": "be0353ace877bb406d7fd69f8986eab5",
"score": "0.60111064",
"text": "def []=(field, value)\n valid_field!(field)\n @fields[field] = value\n end",
"title": ""
},
{
"docid": "39ff840594af198f71f0f826ea86405f",
"score": "0.5994795",
"text": "def field_writer\n :\"#{field_name}=\"\n end",
"title": ""
},
{
"docid": "eab379be6a38a97fc7c7ef3eb8bbf6c3",
"score": "0.5980016",
"text": "def set_field(field, value)\n if respond_to?(field)\n value = arrayize(value) if is_array_field(field)\n instance_variable_set(\"@#{field}\", value)\n end\n end",
"title": ""
},
{
"docid": "eab379be6a38a97fc7c7ef3eb8bbf6c3",
"score": "0.5980016",
"text": "def set_field(field, value)\n if respond_to?(field)\n value = arrayize(value) if is_array_field(field)\n instance_variable_set(\"@#{field}\", value)\n end\n end",
"title": ""
},
{
"docid": "7c7cdc1b6bc7815eb3b191260de307b4",
"score": "0.5960294",
"text": "def field(field, options = {}, &block) # just in case...\n\t\tself.input(field,options, &block)\n\n\tend",
"title": ""
},
{
"docid": "b6217b5c643100aad5c152c9b1358684",
"score": "0.59554297",
"text": "def set_field\n @field = Field.find(params[:id])\n end",
"title": ""
},
{
"docid": "b6217b5c643100aad5c152c9b1358684",
"score": "0.59554297",
"text": "def set_field\n @field = Field.find(params[:id])\n end",
"title": ""
},
{
"docid": "b6217b5c643100aad5c152c9b1358684",
"score": "0.59554297",
"text": "def set_field\n @field = Field.find(params[:id])\n end",
"title": ""
},
{
"docid": "b6217b5c643100aad5c152c9b1358684",
"score": "0.59554297",
"text": "def set_field\n @field = Field.find(params[:id])\n end",
"title": ""
},
{
"docid": "1d3fbb17eee1d1fc81f4814022be0e25",
"score": "0.5947019",
"text": "def set(field, value)\n if @fields.keys.include?(field)\n @fields[field][:value] = value\n elsif @ofields.keys.include?(field)\n @ofields[field][:value] = value\n else\n raise Cipfact::SpecDslError, \"Field '#{field}' is not defined inside the spec\"\n end\n end",
"title": ""
},
{
"docid": "74e36bae2309e6a499322ad79399703c",
"score": "0.5935684",
"text": "def set_field\n @field = Field.find(params[:id])\n end",
"title": ""
},
{
"docid": "87165219f3ae751f546c4c2bfe4672c7",
"score": "0.5935234",
"text": "def set_block_field\n @block_field = BlockField.find(params[:id])\n end",
"title": ""
},
{
"docid": "93d8211372bb7490c2c9e449e5e02428",
"score": "0.5914254",
"text": "def set_field\n @field = @form.fields.find(params[:id])\n end",
"title": ""
},
{
"docid": "8887766444b56533aa490fe350e235d0",
"score": "0.5907082",
"text": "def _setter(name, *args, &block)\n Doodle::Debug.d { [:_setter, 1, name, args] }\n #p [:_setter, name, *args]\n att = __doodle__.lookup_attribute(name)\n Doodle::Debug.d { [:_setter, 2, :att, att] }\n if att && __doodle__.validation_on && att.readonly\n Doodle::Debug.d { [:_setter, 3] }\n raise Doodle::ReadOnlyError, \"Trying to set a readonly attribute: #{att.name}\", Doodle::Utils.doodle_caller\n end\n if block_given?\n Doodle::Debug.d { [:_setter, 4] }\n # if a class has been defined, let's assume it can take a\n # block initializer (test that it's a Doodle or Proc)\n if att.kind && !att.abstract && klass = att.kind.first\n Doodle::Debug.d { [:_setter, 5] }\n if [Doodle, Proc].any?{ |c| klass <= c }\n # p [:_setter, '# 1 converting arg to value with kind ' + klass.to_s]\n Doodle::Debug.d { [:_setter, 6] }\n args = [klass.new(*args, &block)]\n else\n Doodle::Debug.d { [:_setter, 7] }\n __doodle__.handle_error att.name, ArgumentError, \"#{klass} #{att.name} does not take a block initializer\", Doodle::Utils.doodle_caller\n end\n else\n Doodle::Debug.d { [:_setter, 8] }\n # this is used by init do ... block\n args.unshift(DeferredBlock.new(block))\n end\n end\n Doodle::Debug.d { [:_setter, 9] }\n if att\n Doodle::Debug.d { [:_setter, 10] }\n if att.kind && !att.abstract && klass = att.kind.first\n Doodle::Debug.d { [:_setter, 11, :att_kind, klass] }\n if !args.first.kind_of?(klass) && [Doodle].any?{ |c| klass <= c }\n Doodle::Debug.d { [:_setter, 12] }\n #p [:_setter, \"#2 converting arg #{att.name} to value with kind #{klass.to_s}\"]\n #p [:_setter, args]\n begin\n # try conversion if only one argument and conversion exists\n conversion = att.__doodle__.conversions[args.first.class]\n Doodle::Debug.d { [:_setter, 12.1, name, att.__doodle__.conversions.keys, conversion, args.first, args.first.class ] }\n if args.size == 1 && conversion\n Doodle::Debug.d { [:_setter, 12.2, :trying_conversion ] }\n args = att.convert(self, *args)\n else\n Doodle::Debug.d { [:_setter, 12.3, :initialize_using_first_kind, klass, 13] }\n args = [klass.new(*args, &block)]\n end\n rescue Object => e\n Doodle::Debug.d { [:_setter, 14] }\n __doodle__.handle_error att.name, e.class, e.to_s, Doodle::Utils.doodle_caller(e)\n end\n end\n else\n Doodle::Debug.d { [:_setter, 10.1, :abstract, att.abstract] }\n end\n Doodle::Debug.d { [:_setter, 15] }\n #p [:_setter, :got_att1, name, args.map{ |x| x.object_id }, *args]\n v = ivar_set(name, att.validate(self, *args))\n\n #p [:_setter, :got_att2, name, ivar, :value, v]\n #v = instance_variable_set(ivar, *args)\n else\n Doodle::Debug.d { [:_setter, 16] }\n #p [:_setter, :no_att, name, *args]\n ##DBG: Doodle::Debug.d { [:_setter, \"no attribute\"] }\n v = ivar_set(name, *args)\n end\n Doodle::Debug.d { [:_setter, 17, v] }\n validate!(false)\n v\n end",
"title": ""
},
{
"docid": "ea35e4301f6b9a718649a55145bfdda4",
"score": "0.5894724",
"text": "def field(*args, &block)\n callbacks[:readers] << XmlDsl::BlockMethod.new(:field, *args, &block)\n end",
"title": ""
},
{
"docid": "a5cadf0d07dff472661b8054b9fffe51",
"score": "0.5849684",
"text": "def new_clean_value field_name, val\n \n setter = \"#{field_name}=\"\n clean_data.send setter, val\n \n if new_data.respond_to?(setter)\n new_data.send setter, val\n else\n if not self.class.allowed_psuedo_field?(field_name)\n raise \"Unknown field being set: #{field_name.inspect} (value: #{val.inspect})\"\n end\n end\n \n val\n \n end",
"title": ""
},
{
"docid": "bc0e1842528c8215b8b9fe8d31f91d38",
"score": "0.5846192",
"text": "def add_field_setter(namespace, name, type = 'Object')\n add_field_method(namespace, \"#{name}=\") do |o|\n o.parameters = [[name, nil]]\n o.docstring.add_tag get_tag(:return, nil, type)\n o.docstring.add_tag get_tag(:param, \"new #{name}\", type, name)\n end\n end",
"title": ""
},
{
"docid": "d3a1228bcc6431c9776b64406dd5d219",
"score": "0.58365184",
"text": "def setField(field_name, val)\n fld_name = field_name.downcase\n if fld_name == 'wdir'\n # remove extraneous notes from wind direction field\n if (mat = /(.*)\\(.*\\)/.match(val))\n val = mat[1]\n end\n end\n #instance_variable_set(\"@#{fld_name}\", val.to_s.strip)\n if @record.respond_to? :update_attribute\n # active record\n @fld_count += 1\n @record.update_attribute fld_name, val.to_s.strip\n else \n self.class.send(:attr_accessor, fld_name)\n end\n end",
"title": ""
},
{
"docid": "36a1b97047c70a2c9916c4e94446420b",
"score": "0.58342195",
"text": "def field_writer\n define_method \"#{field}=\" do |val|\n val = val.to_s if val.is_a?(Symbol)\n super(val)\n end\n end",
"title": ""
},
{
"docid": "5d3973b89bdfb5fc38544146a9506ee9",
"score": "0.58285344",
"text": "def method_missing(name, *args, &block)\n if self.is_dynamic_field?(name)\n if name.to_s.ends_with?('=')\n name = name.to_s.gsub(/\\=$/, '').to_sym\n self.dynamic_setter(name, args.first)\n else\n self.dynamic_getter(name)\n end\n else\n super\n end\n end",
"title": ""
},
{
"docid": "756d01372aac8ffcca6613895d6e56f1",
"score": "0.5824777",
"text": "def assign_field(object, field, value)\n if @verbosity == 2\n display = if value.is_a?(Array)\n \"[ ... ]\"\n elsif value.is_a?(Hash)\n \"{ ... }\"\n else\n value.to_s\n end\n puts \"- #{field} : #{display}\"\n end\n puts \"- #{field} : #{value.inspect}\" if @verbosity == 3\n if embedded?(object, field)\n build_it(object, field, value)\n else\n object.send(\"#{field}=\", value)\n end\n end",
"title": ""
},
{
"docid": "290de520175703439ec4b00ae684fda4",
"score": "0.5810691",
"text": "def field_setter(funcName, fieldName)\n define_method(mkSetter(funcName)) do |value |\n self[fieldName]=value\n end\nend",
"title": ""
},
{
"docid": "775c83629cab20789e9828a942c6ecf1",
"score": "0.5809441",
"text": "def set_field_value(code_name, value); field(code_name).try(:set_value_for, self, value) end",
"title": ""
},
{
"docid": "786e43f9597d2c68c13d3d8c3cd6c438",
"score": "0.57852095",
"text": "def set_field\n @field = Field.find(params[:id])\n end",
"title": ""
},
{
"docid": "786e43f9597d2c68c13d3d8c3cd6c438",
"score": "0.57852095",
"text": "def set_field\n @field = Field.find(params[:id])\n end",
"title": ""
},
{
"docid": "5bff941f1f33a054d7094311e83b0d9e",
"score": "0.57788885",
"text": "def field_configuration(field, action = nil, **)\n Field.configuration_for(field, model_config_key, action)\n end",
"title": ""
},
{
"docid": "58654a7734bd2ee30abff8aa999ac2d8",
"score": "0.57683927",
"text": "def set_field\n @field = @form.fields.find(params[:field_id])\n end",
"title": ""
},
{
"docid": "4a37fcbb949c20835d41de5f3ff30416",
"score": "0.5736717",
"text": "def each_field(&block)\n if block_given?\n @fields.each(&block)\n self\n else\n @fields.dup\n end\n end",
"title": ""
},
{
"docid": "f605dbc20971f36993427295a07cfb8d",
"score": "0.5735464",
"text": "def field(*args)\n result = self\n args.each { |name| result = result.get_field(name) }\n\n result\n end",
"title": ""
},
{
"docid": "43d4cef1c91c73bc0f554c6d846eb9e4",
"score": "0.5733988",
"text": "def field(name, **options)\n name = name.to_sym\n definitions[name] = options\n proxy.instance_eval do\n define_method(name) { fields[name] }\n define_method(\"#{name}=\") { |value| fields[name] = value }\n end\n end",
"title": ""
},
{
"docid": "c2a7e9fd72280504fdb4e97739eecfba",
"score": "0.5722343",
"text": "def []=(field_name, value)\n f = field(field_name)\n if f\n f.value = value\n else\n add_field!(field_name, value)\n end\n end",
"title": ""
},
{
"docid": "df1f02aa1bee458d5627bb5fa16e4414",
"score": "0.57153773",
"text": "def method_missing(name, *args, &block)\n case\n when self.respond_to_field?(name)\n self.field_value(name)\n when self.has_field?(name)\n self.attributes[name.to_s]\n when self.has_field?(name.to_s.sub(/=$/, ''))\n attribute = name.to_s.sub(/=$/, '')\n self.update_attribute(attribute, args.first)\n else\n super\n end\n end",
"title": ""
},
{
"docid": "5b0d02a3d15f0e3fef7dc873320f66e5",
"score": "0.57112014",
"text": "def []=(field_name, value)\n field = get_or_create_field_node(field_name)\n field.content = value.to_s\n end",
"title": ""
},
{
"docid": "0c7e1ade4143aefac9302a9d0c257754",
"score": "0.57064235",
"text": "def field_for(field, **opt)\n Field.for(object, field, model_config_key, **opt)\n end",
"title": ""
},
{
"docid": "91f4b78781b7bfbe72190b98396d35af",
"score": "0.56951404",
"text": "def method_missing(sym, *args, &block)\n setter = sym.to_s.include?('=')\n str = sym.to_s.chomp('=')\n var = \"@#{str}\".to_sym\n val = args.first\n\n if setter\n field_name = str.upcase\n @fields[field_name] = ''\n val = val.to_ruby\n self.instance_variable_set(var, val)\n else\n self.instance_variable_get(var)\n end\n end",
"title": ""
},
{
"docid": "fcc32252ce0af665e4dcce3e12dcfce2",
"score": "0.5686497",
"text": "def set(name, value)\n if !has_field?(name)\n raise ArgumentError, \"#{self.class.name} has no field called #{name}\"\n end\n\n value = Typelib.from_ruby(value, @field_types[name])\n raw_set_field(name.to_s, value)\n\n rescue TypeError => e\n raise e, \"#{e.message} for #{self.class.name}.#{name}\", e.backtrace\n end",
"title": ""
},
{
"docid": "608a1512c382ec2e405c9b372f777bdb",
"score": "0.5679959",
"text": "def method_missing(m, *args)\n # Figure out if this is a setter or a getter\n setter = false\n if m.to_s =~ /(.*?)=$/\n setter = true \n m = $1\n raise \"Can only set one value\" if args.size != 1\n end\n\n # Make sure the field isn't a multi-parameter field. If so, do the\n # necessary conversions.\n m, property = if Field.respond_to?(:get_actual_name_and_property)\n Field.get_actual_name_and_property(m.to_s)\n else\n [m.to_s, nil]\n end\n\n # Get the field\n item_type_field = self.item_type.item_type_fields.\n first('field.name' => m.to_s)\n field = item_type_field.field if item_type_field\n unless field\n # Figure out the field from a base_field\n base_field_map = BaseFieldMapping.first('base_field.name' => m.to_s, \n :item_type_id => self.item_type_id)\n field = base_field_map.field if base_field_map\n end\n\n # bail out if no field was found\n raise NoMethodError.new(\"\\\"#{m}\\\" is not a Field on an \\\"#{self.item_type.name}\\\" ItemType\") unless field\n\n data = ItemData.first(:field_id => field.id, :item_id => self.id)\n\n # Give up if trying to get a value that doesn't exist\n return nil if !setter && !data\n\n if setter\n\n # Typecast the value being set\n data_value = if field.respond_to?(:field_type)\n if property\n _type = data ?\n field.field_type(self.item_type).new(data.value.value) :\n field.field_type(self.item_type).new\n _type.send(\"#{property}=\", args.first)\n _type\n else\n field.field_type(self.item_type).new(args.first)\n end.to_s\n else\n # If for some reason we don't know the field type,\n # don't bother to typecast\n args.first.to_s\n end\n\n value = ItemDataValue.first(:value => data_value) ||\n ItemDataValue.create(:value => data_value)\n\n unless data\n data = ItemData.create(:field => field,\n :item_data_value => value, :item_id => self.id)\n else\n data.update(:item_data_value_id => value.id)\n end\n\n else\n\n if data.respond_to?(:typecast_value) && !property\n data.typecast_value\n elsif data.respond_to?(:typecast_value) && property :\n data.typecast_value.send(property)\n else\n data.value.value\n end\n\n end\n end",
"title": ""
},
{
"docid": "19f25517044cbee80cca476e8e83d067",
"score": "0.56720454",
"text": "def set_field\n @field = Field.find(params[:id])\n auth!\n end",
"title": ""
},
{
"docid": "1e2fad5f249aaab068ed299c36f39ee5",
"score": "0.56516784",
"text": "def set_field(name, attr, value) \n field = @field_list[name]\n fail \"Bad name '#{name}' in MemberSearch\" unless field\n field[attr] = value\n end",
"title": ""
},
{
"docid": "7cbf513c1f9e2248fceaa51aaca6502d",
"score": "0.5637219",
"text": "def field(name, default: nil, freeze: false, clone: true, valid: nil,\n type: String, desc: nil)\n name = name.to_sym\n variable = \"@#{name}\".to_sym\n modified = \"@__modified_#{name}\".to_sym\n\n raise ArgumentError, 'the field \"hash\" is reserved' if name == :hash\n\n # Permitting them to be lazy here; the default value will automatically\n # be added to a valid Array.\n valid << default if valid.is_a?(Array) and !valid.include?(default)\n\n # note the details about the field in the class\n @fields[name] = { desc: desc, type: type, default: default,\n valid: valid }\n\n # declare the getter\n attr_reader name\n\n # the setter is a little more complicated\n define_method('%s=' % name) do |value, set_modified: true|\n\n case valid\n when Array, Range\n raise InvalidValue,\n \"invalid value #{value} for #{self.class}.#{name}\" unless\n valid.include?(value)\n when Proc\n raise InvalidValue,\n \"invalid value #{value} for #{self.class}.#{name}\" unless\n valid.call(value)\n end\n\n # We don't need to do anything to a frozen variable, but if it's not\n # frozen, if we're supposed to clone it, do so, and if we're supposed\n # to freeze it, also do that.\n unless value.frozen?\n value = value.clone if clone\n value.freeze if freeze\n end\n\n # set the instance variable for this field\n instance_variable_set(variable, value)\n\n # also, unless explicitly told not to, mark this variable as modified.\n # This exception is used by the initializer to set the defaults.\n instance_variable_set(modified, true) if set_modified\n end\n end",
"title": ""
},
{
"docid": "4754d843bc2d3a0d76f3d30f2cbdac51",
"score": "0.56310934",
"text": "def value_setter(&block)\n if block_given?\n @value_setter ||= block\n else\n @value_setter ||= Proc.new {|val| val }\n end\n @value_setter\n end",
"title": ""
},
{
"docid": "088aee66eb74d1ab446feb0b52160fef",
"score": "0.5628932",
"text": "def field(name, options={})\n (@value[:fields] ||= {}).update name.to_sym => options\n end",
"title": ""
},
{
"docid": "08726046199d844c1c1813cbfdd05333",
"score": "0.56273484",
"text": "def field_set_and_list_wrapping(*args, &block)\n block_given? ? super{\n (val = yield).is_a?(String) ? val : form_buffers.last\n } : super\n end",
"title": ""
},
{
"docid": "8c32e6bf981d520d62bf2b714957478b",
"score": "0.5626397",
"text": "def field_set_and_list_wrapping(*args, &block)\n block_given? ? super{\n (val = yield).is_a?(String) ? val : form_buffers.last\n } : super\n end",
"title": ""
},
{
"docid": "945139a283addb0543a17f0f49006bd0",
"score": "0.56240165",
"text": "def initialize(field, &block)\n @hash = { field: field }\n @block = block\n end",
"title": ""
},
{
"docid": "5f509fe28d457bd96d503b8b650ae9c5",
"score": "0.5623772",
"text": "def add_field(*args)\n new_field = self.class.add_field(*args)\n method = \"#{new_field.name}=\"\n send(method, new_field.default) if respond_to? method\n end",
"title": ""
},
{
"docid": "e728f6d690d9b03e28ff1f941a661e9c",
"score": "0.5616484",
"text": "def field_value=(value)\n super find_or_create_field_value(value)\n end",
"title": ""
},
{
"docid": "8cd45c032f3123cbb87681d5f072596c",
"score": "0.56128305",
"text": "def field_config(fieldname)\n # does field already have a configuration hash?\n field_configured = @@field_configs.has_key?(fieldname)\n \n if !field_configured\n # set up a configuration hash for the field\n @@field_configs[fieldname] = {}\n \n # create the new attribute writer for the field;\n # this calls the manipulation methods before setting the field\n define_method(\"#{fieldname}=\") do |value_in|\n value_in = self.class.strip(fieldname, value_in)\n value_in = self.class.sha1(fieldname, value_in)\n write_attribute(fieldname, value_in)\n end\n end\n end",
"title": ""
},
{
"docid": "6efa713386be072ba6773ab645f4d0b7",
"score": "0.5605366",
"text": "def update!(**args)\n @field = args[:field] if args.key?(:field)\n end",
"title": ""
},
{
"docid": "6efa713386be072ba6773ab645f4d0b7",
"score": "0.5605366",
"text": "def update!(**args)\n @field = args[:field] if args.key?(:field)\n end",
"title": ""
},
{
"docid": "6efa713386be072ba6773ab645f4d0b7",
"score": "0.5605366",
"text": "def update!(**args)\n @field = args[:field] if args.key?(:field)\n end",
"title": ""
},
{
"docid": "6efa713386be072ba6773ab645f4d0b7",
"score": "0.5605366",
"text": "def update!(**args)\n @field = args[:field] if args.key?(:field)\n end",
"title": ""
},
{
"docid": "6efa713386be072ba6773ab645f4d0b7",
"score": "0.5605366",
"text": "def update!(**args)\n @field = args[:field] if args.key?(:field)\n end",
"title": ""
},
{
"docid": "6efa713386be072ba6773ab645f4d0b7",
"score": "0.5605366",
"text": "def update!(**args)\n @field = args[:field] if args.key?(:field)\n end",
"title": ""
},
{
"docid": "6efa713386be072ba6773ab645f4d0b7",
"score": "0.5605366",
"text": "def update!(**args)\n @field = args[:field] if args.key?(:field)\n end",
"title": ""
},
{
"docid": "6efa713386be072ba6773ab645f4d0b7",
"score": "0.5605366",
"text": "def update!(**args)\n @field = args[:field] if args.key?(:field)\n end",
"title": ""
},
{
"docid": "430966cd5f821d472fc52d43fec19a29",
"score": "0.56023157",
"text": "def field(attr_name, proc = nil, **options)\n attr_accessor(attr_name)\n define_read_method_with_default(attr_name, options[:default])\n define_write_method(attr_name, proc, options)\n end",
"title": ""
},
{
"docid": "329289e05f238a0f18e9efacbb210134",
"score": "0.5571914",
"text": "def field_value(field, opt = nil)\n unless field.is_a?(Blacklight::Configuration::Field)\n field = field_config(field)\n end\n field_values(field, opt)\n end",
"title": ""
},
{
"docid": "f455e8fc6664bec72a7bef4ea590b214",
"score": "0.5565467",
"text": "def initialize(field, value)\n @field, @value = field, value\n end",
"title": ""
},
{
"docid": "133de1941f78cd2e763658df0ff63bfd",
"score": "0.55640954",
"text": "def set(*args, &block)\n update(*args, &block)\n end",
"title": ""
},
{
"docid": "f84a600527f573dd061ff10fdcebf2f3",
"score": "0.5560927",
"text": "def set(field,value)\n _doc[field.to_s] = value\n end",
"title": ""
},
{
"docid": "f84a600527f573dd061ff10fdcebf2f3",
"score": "0.5560927",
"text": "def set(field,value)\n _doc[field.to_s] = value\n end",
"title": ""
},
{
"docid": "c7f5dc1fe9e3a66cac05ddbbe4b19019",
"score": "0.554861",
"text": "def create_field_setter(name, meth, field)\n generated_methods.module_eval do\n re_define_method(\"#{meth}=\") do |value|\n val = write_attribute(name, value)\n if field.foreign_key?\n remove_ivar(field.association.name)\n end\n val\n end\n end\n end",
"title": ""
},
{
"docid": "5453e24f68a9607a79a56bc3547295ee",
"score": "0.5545127",
"text": "def fields=(fields)\n @fields, @value = fields, nil\n end",
"title": ""
},
{
"docid": "5b9a3ed5a85105418b1440f084bf50dd",
"score": "0.55387396",
"text": "def set_field_direct(column, new_value)\n set_fields_direct(column => new_value)\n end",
"title": ""
},
{
"docid": "8d7484506c4e5d323a6ad71b00146129",
"score": "0.5538032",
"text": "def put_field(obj, field, as=nil, &block)\n put!((as || field).to_s, obj.send(field), &block)\n end",
"title": ""
},
{
"docid": "63973c66738572af96ea542ccb846a34",
"score": "0.553586",
"text": "def method_missing(method_name, *arguments, &block)\n record_fields = self.class.defined_fields.keys\n requested_field = method_name.to_s.sub('=','').to_sym\n\n if record_fields.include?(requested_field)\n is_setter_field = method_name =~ /=/\n definition = self.class.definition_for(requested_field)\n\n if is_setter_field\n args = [definition.start, definition.stop, arguments.first]\n case definition.type\n when 'N' then set_numeric_value(*args)\n when 'AN' then set_text_value(*args)\n end\n else\n extract_field_value(definition)\n end\n else\n super\n end\n end",
"title": ""
},
{
"docid": "b35f0349dda573336223691f6dfe9d5e",
"score": "0.55291575",
"text": "def setf(field, newval)\n pfields = field.split(/\\//)\n store = pfields.last\n\n # Traverse to the leaf\n value = @config\n fidx = 0\n pfields.each do |af|\n if fidx < (pfields.size - 1)\n if af =~ /^:/\n index = af[1..-1].intern\n elsif af =~ /^\\d+$/\n index = af.to_i\n else\n index = af\n end\n # Create storage if needed\n case pfields[fidx+1]\n when /^:/\n value[index] ||= {}\n when /^\\d+$/\n value[index] ||= []\n else\n value[index] ||= {}\n end\n value = value[index]\n end\n fidx += 1\n end\n\n # Assign new value to the leaf\n if store =~ /^:/\n value[store[1..-1].intern] = newval\n elsif store =~ /^\\d+$/\n value[store.to_i] = newval\n else\n value[store] = newval\n end\n end",
"title": ""
},
{
"docid": "474123ee42254e5d6bb45097dc140b43",
"score": "0.55268794",
"text": "def field(declaration, value = nil)\n if block_given?\n add_code_without_newline \"#{declaration} =\"\n add_raw_code ' '\n yield\n @code.gsub!(/\\n*\\Z/m, '')\n add_raw_code ';'\n newline\n elsif value\n add_code \"#{declaration} = #{value};\"\n else\n add_code \"#{declaration};\"\n end\n end",
"title": ""
},
{
"docid": "db78c16ee9a428d1e6f0ca609b9070e3",
"score": "0.55252534",
"text": "def define(*args, **kwargs)\n Field.new(self, *args, **kwargs)\n end",
"title": ""
},
{
"docid": "1436700d61794ab25062b7d4103f57fa",
"score": "0.5515069",
"text": "def method_missing(sym, *args, &block)\n setter = sym.to_s.include?('=')\n str = sym.to_s.chomp('=')\n var = \"@#{str}\".to_sym\n val = args.first\n\n if setter\n field_name = str.upcase\n @changed << field_name\n val = val.to_ruby\n self.instance_variable_set(var, val)\n else\n self.instance_variable_get(var)\n end\n end",
"title": ""
},
{
"docid": "a3942a100838762347cc502705ada61b",
"score": "0.55147445",
"text": "def method_missing(method_name, *args, &block)\n field_name = method_name\n is_set = field_name[-1,1] == '=' #true if is set, false if is get\n field_name = field_name[0,field_name.length-1] if is_set\n \n field = Field.where(:slug => field_name, :parent_id => self.id).first\n \n if field && is_set\n set_field(field_name, args[0])\n return args[0]\n elsif field && !is_set\n return field.get_value\n end\n \n super(method_name, *args, &block)\n \n end",
"title": ""
},
{
"docid": "28de39ca5659e1cf77326e8f89e453c5",
"score": "0.55023456",
"text": "def []=(field, value)\n field = field.to_sym\n\n raise ArgumentError, \"invalid field #{field}\" unless fields.include?(field)\n\n if value == UNSET_FIELD or value.nil?\n @fields.delete(field)\n else\n @fields.store(field, value)\n end\n\n value\n end",
"title": ""
},
{
"docid": "3e3cddefd06d9920c47e5f25fb9cce33",
"score": "0.54989284",
"text": "def field(name, options={})\n type = (options[:type] || :string).to_sym\n aliases = (options[:aliases] || [])\n\n aliases.each do |a|\n define_method(\"#{a}\") do\n send(name)\n end\n end\n\n case type\n when :string\n define_method(\"#{name}=\") do |v|\n set(name, v.to_s, options)\n end\n when :integer\n define_method(\"#{name}=\") do |v|\n set(name, v.to_i, options)\n end\n when :float\n define_method(\"#{name}=\") do |v|\n set(name, v.to_f, options)\n end\n when :bool\n define_method(\"#{name}=\") do |v|\n set(name, [\"true\", 1, true].include?(v), options)\n end\n define_method(\"#{name}?\") do\n send(name)\n end\n when :time\n define_method(\"#{name}=\") do |v|\n if v.is_a?(Fixnum)\n set(name, Time.at(v).to_datetime, options)\n else\n set(name, DateTime.parse(v), options)\n end\n end\n when :array\n define_method(\"#{name}=\") do |v|\n set(name, Array(v), options)\n end\n when :hash\n define_method(\"#{name}=\") do |v|\n set(name, Hash[v], options)\n end\n else\n options[:class_name] ||= type.to_s.camelize\n options[:many] = (name.to_s.singularize != name.to_s) unless options.key?(:many)\n klass = options[:class_name].constantize\n\n define_method(\"#{name}=\") do |v|\n if options[:many]\n set(name, Frenchy::Collection.new(Array(v).map {|vv| klass.new(vv)}))\n else\n set(name, klass.new(v))\n end\n end\n end\n\n self.fields[name.to_sym] = options\n\n attr_reader name.to_sym\n end",
"title": ""
},
{
"docid": "74ea5ba8380955b8d259b434cbf3e88a",
"score": "0.54941916",
"text": "def field(field_name, pdf_field, klass, default = nil, validate = nil, msg ='')\r\n pdf_field_editor = pdf_field.is_a?(String) ? IRSForms::Editors::SimpleEditor.new(pdf_field) : pdf_field\r\n fields[field_name] = pdf_field_editor\r\n\r\n # getter\r\n define_method field_name do\r\n instance_variable_get( \"@#{field_name}\" )\r\n end\r\n\r\n # setter (includes validations)\r\n define_method \"#{field_name}=\" do | val |\r\n instance_variable_set( \"@#{field_name}\", val )\r\n end\r\n end",
"title": ""
},
{
"docid": "b995d748d5a160d87e16ab66ac15b9b5",
"score": "0.54913163",
"text": "def define_setter\n _type = type\n\n klass.send(:define_method, \"#{attribute}=\") do |value|\n converted_value = StoreSchema::Converter.new(value, _type).to_db\n\n if converted_value\n super(converted_value)\n else\n super(nil)\n end\n end\n end",
"title": ""
},
{
"docid": "dc9e51fa80b5e6c49986d3eb667a3cc2",
"score": "0.54862756",
"text": "def set(field_name, value)\n f = get(field_name)\n (f.nil? || f.read_only?) ? false : f.value = value\n end",
"title": ""
},
{
"docid": "2e946350e44bf6acbd6fab203374b028",
"score": "0.548584",
"text": "def field(*args)\n result = self\n args.each do |name|\n result = result.get_field(name)\n end\n result\n end",
"title": ""
}
] |
2a5d28f49a3a772cd374f30f4afc81b1
|
Create a bag from scratch yo'
|
[
{
"docid": "b93f17429a67ab3dc066d21606df7fa2",
"score": "0.531401",
"text": "def build(opts)\n uuid = SecureRandom.uuid\n\n bag = BagIt::Bag.new File.join(@output_directory, uuid)\n path = File.join File.expand_path(opts[:location]), \"**\", \"*\"\n Dir.glob(path).each do |filepath|\n bag.add_file(File.basename(filepath), filepath)\n end\n\n dpn_info_opts = {\n dpnObjectID: uuid,\n localName: \"#{opts[:name]}\",\n ingestNodeName: @ingest_node_name,\n ingestNodeAddress: @ingest_node_address,\n ingestNodeContactName: @ingest_node_contact_name,\n ingestNodeContactEmail: @ingest_node_contact_email,\n version: 1,\n firstVersionObjectID: uuid,\n bagTypeName: opts[:type].to_s.downcase,\n interpretiveObjectIDs: opts[:interpretive],\n rightsObjectIDs: opts[:rights]\n }\n\n dpn_info_txt = Bookbag::DPNInfoTxt.new(dpn_info_opts)\n\n bag.add_tag_file(File.join(Bookbag::Settings[:bag][:dpn_dir], Bookbag::Settings[:bag][:dpn_info][:name])) do |io|\n io.puts dpn_info_txt.to_s\n end\n\n bag.write_bag_info(@bag_info)\n\n bag.manifest!\n end",
"title": ""
}
] |
[
{
"docid": "c7107a23c0e7fff2a88745ea065955d6",
"score": "0.6748993",
"text": "def make_bag\n move_files_to_bag\n bag.write_chipmunk_info(common_tags.merge(audio_metadata))\n bag.download_metadata\n bag.manifest!\n end",
"title": ""
},
{
"docid": "69a0117f51fbe116e42cc6af06f979ef",
"score": "0.62573516",
"text": "def create_bag(bag_name)\n # check that the name is valid\n begin\n Chef::DataBag.validate_name!(bag_name)\n rescue Chef::Exceptions::InvalidDataBagName => e\n ui.fatal(e.message)\n exit(1)\n end\n\n # create the data bag\n begin\n data_bag = Chef::DataBag.new\n data_bag.name(bag_name)\n data_bag.create\n ui.info(\"Created topology data bag [#{bag_name}]\")\n rescue Net::HTTPServerException => e\n raise unless e.to_s =~ /^409/\n data_bag = Chef::DataBag.load(bag_name)\n ui.info(\"Topology data bag #{bag_name} already exists\")\n end\n\n data_bag\n end",
"title": ""
},
{
"docid": "6e541b963c88d2eda553d8fa3cf4f53f",
"score": "0.62371486",
"text": "def clone\n self.class.new(self.info.select { |key, value| !key.to_s.ends_with?('_bag') })\n end",
"title": ""
},
{
"docid": "1e8a1611d8408c1be092051ab35fc4ec",
"score": "0.59920317",
"text": "def initialize(dictionary=Dictionary.new)\n @dictionary = dictionary\n @words = []\n @bag = Bag.new \n end",
"title": ""
},
{
"docid": "1d1b369473f8eba95963f4645277b71a",
"score": "0.5885598",
"text": "def build_bag\n [:red] * 3 + [:blue] * 4\nend",
"title": ""
},
{
"docid": "eeb238ab197372ea55434f94ca67fac5",
"score": "0.5855206",
"text": "def clone\n bag_clone = Bag.new\n bag_clone.copy_all(self)\n bag_clone\n end",
"title": ""
},
{
"docid": "cc08f6b6fbc76163cf63cb30cff4b464",
"score": "0.5851611",
"text": "def initialize\n @bets = Array.new()\n end",
"title": ""
},
{
"docid": "acebdb8ba01420055ed0ef25f2e2232f",
"score": "0.5814767",
"text": "def seed_bag_hash\n array = yield\n array.each_with_object({}).with_index{ |(seed_bag, hash), index| hash[\"#{index+1}. #{seed_bag.crop_type.crop_name}\"] = seed_bag}\n #=> {\"1. Turnip\"=> <seed_bag_instance>, \"2. Tomato\"=> <seed_bag_instance>}\n end",
"title": ""
},
{
"docid": "80b838581cb64d5e404713f3edba236a",
"score": "0.5800989",
"text": "def seed_bag_hash\n array = yield\n array.each_with_object({}).with_index { |(seed_bag, hash), index|\n hash[\"#{index+1}. #{seed_bag.crop_type.crop_name}\"] = seed_bag\n }\n #=> {\"1. Turnip\"=> <seed_bag_instance>, \"2. Tomato\"=> <seed_bag_instance>}\n end",
"title": ""
},
{
"docid": "65aad2ea568b4a212fc97b03ba49c3f5",
"score": "0.57858884",
"text": "def empty()\n hand = Clutch.new()\n # add all the items in the Bag to the new Clutch. also empties the bag\n hand.add(bag)\n hand\n end",
"title": ""
},
{
"docid": "7d052728f4840c2a764b729565601557",
"score": "0.576697",
"text": "def create_bag_sprite\n @bag_sprite = BagSprite.new(@viewport, @pocket_indexes)\n @bag_sprite.index = @socket_index\n end",
"title": ""
},
{
"docid": "d09863b40bfc92ee12f6693f56c98d00",
"score": "0.5757722",
"text": "def complete_bag_key(bag_name)\n File.join('bags', bag_name)\n end",
"title": ""
},
{
"docid": "08245b9c41e6c38a9ce4911868b7298e",
"score": "0.57468915",
"text": "def bag_id\n @bag_id ||= bag\n end",
"title": ""
},
{
"docid": "07473cada3f7604bc3128ad2654ce4af",
"score": "0.57303596",
"text": "def <<(bag)\n bag = FileSystemBag.instance(bag) if (bag.is_a?(String)|| bag.is_a?(Pathname))\n @bags << bag\n rescue Bag::PathNotFound\n @bags\n end",
"title": ""
},
{
"docid": "437d9c7178e0bb6e83bf86deb4537f5f",
"score": "0.57300866",
"text": "def create_basket items_string\n @baskets = Array.new if @baskets.nil?\n basket = SalesTaxes::Basket.new items_string\n @baskets << basket\n basket\n end",
"title": ""
},
{
"docid": "81154da32c60c5f659de0bed38698d8f",
"score": "0.5645131",
"text": "def e1334_random_bag (values)\n end",
"title": ""
},
{
"docid": "92fe459ffc825f0ad9e79862ffe5fba4",
"score": "0.56238633",
"text": "def create_all_data_bags\n DATA_BAGS_CONF.keys.each do |bag|\n next if list_data_bags.include? bag\n puts \"TRACE: creating missing data bag #{bag}\" if verbose\n create_data_bag(bag)\n end\nend",
"title": ""
},
{
"docid": "b243d3f31b9c8cc746f5b0b386806e20",
"score": "0.56206983",
"text": "def create_rubies\n @rubies = [[1, 1], [2, 2], [1, 1], [0, 3], [3, 0], [2, 2], [2, 2]]\n end",
"title": ""
},
{
"docid": "44a77504117c5727300481aa507b1fd8",
"score": "0.56043667",
"text": "def set_bag\n @bag = Bag.find(params[:id])\n end",
"title": ""
},
{
"docid": "44a77504117c5727300481aa507b1fd8",
"score": "0.56043667",
"text": "def set_bag\n @bag = Bag.find(params[:id])\n end",
"title": ""
},
{
"docid": "8974570998047ac2f8cb9269a82357c2",
"score": "0.5599196",
"text": "def create_data_bag_item(bag, item, value)\n unless data_bag_item_exist?(bag, item)\n require 'json'\n json = { 'id' => item, item => value }.to_json\n puts \"TRACE: creating missing data bag item #{bag}/#{item} -- #{json}\" if verbose\n puts \"TODO: \" + knife_cmd(\"data bag create #{bag} #{item}\")\n end\nend",
"title": ""
},
{
"docid": "6fd74b7347f210425b251310515e739c",
"score": "0.55970585",
"text": "def initialize(capacity = DEFAULT_CAPACITY) #the = means default\n @bike_collection = Array.new\n @capacity = capacity\n\n\n end",
"title": ""
},
{
"docid": "786d801eca515cd7c94120581c54dbf4",
"score": "0.5567809",
"text": "def initialize\n\t\t@basket = []\n\tend",
"title": ""
},
{
"docid": "288f5e2cf55ecaf50a41acbc3b1923ae",
"score": "0.55596894",
"text": "def write_build_data_bags(path)\n ## write data bags to build (must be fed as arg)\n new_resource.data_bags.each_pair do |bag, items|\n r = Chef::Resource::Directory.new(::File.join(path, bag), run_context)\n r.recursive(true)\n r.run_action(:create)\n\n items.each do |item|\n r = Chef::Resource::File.new(::File.join(path, bag, \"#{item}.json\"), run_context)\n r.sensitive(true)\n r.content(Chef::DataBagItem.load(bag, item).to_json)\n r.run_action(:create)\n end\n end\n end",
"title": ""
},
{
"docid": "b4e984b37ea03bdd519bdb23aa1eeb38",
"score": "0.54609686",
"text": "def generate_booster\n prepare_for_draft or return nil\n BoosterGenerator.generate(card_templates, booster_distr)\n end",
"title": ""
},
{
"docid": "3ab5af7b2be3dfdfd22bc77e40a96919",
"score": "0.5448289",
"text": "def create_item(data_bag, item_name, data = {}, metadata = {})\n item = ::SecureDataBag::Item.new(metadata)\n item.raw_data = { 'id' => item_name }.merge(data)\n item.data_bag data_bag\n item\n end",
"title": ""
},
{
"docid": "781c223618e1ce67f89f8ed40a73e501",
"score": "0.53982395",
"text": "def quote_bag\n QuoteBag.new quotes\n end",
"title": ""
},
{
"docid": "d30796c93f502d93afc98175d909037d",
"score": "0.53882694",
"text": "def add_letters_to_bag()\n\n bag = [\"Z\", \"X\", \"J\", \"K\", \"Q\"] # Letters which only appear once\n \n 2.times do # Letters which appear twice\n bag << \"V\"\n bag << \"W\"\n bag << \"B\"\n bag << \"C\"\n bag << \"F\"\n bag << \"H\"\n bag << \"M\"\n bag << \"Y\"\n bag << Blank.new\n bag << \"P\"\n end\n\n 3.times do bag << \"G\" end\n\n 4.times do\n bag << \"D\"\n bag << \"L\"\n bag << \"S\"\n bag << \"U\"\n end\n\n 6.times do\n bag << \"N\"\n bag << \"R\"\n bag << \"T\"\n end\n \n 8.times do bag << \"O\" end \n\n 9.times do\n bag << \"A\"\n bag << \"I\"\n end\n\n 12.times do bag << \"E\" end\n\n return bag\n end",
"title": ""
},
{
"docid": "46a2fbe81ce899ba08722a4a8f39cfa3",
"score": "0.5363722",
"text": "def bag_record\n @bag_record ||= begin\n response = admin_client.bag(bag)\n data = response.body\n raise \"Failed to retrieve bag record: #{data}\" unless response.success?\n OpenStruct.new(data)\n end\n end",
"title": ""
},
{
"docid": "f77d16e581072cb0ad4a8daf0e352aa8",
"score": "0.5349991",
"text": "def release_bike\n# the method will 'raise' an exception stating no bikes, if\n# the @rack array is empty\n raise \"No bikes available\" if @rack.empty?\n# Otherwise by implicit return it will instantiate a new Bike\n Bike.new\n end",
"title": ""
},
{
"docid": "5bc7c87457c1c85c42de27ff08e0863c",
"score": "0.53334653",
"text": "def load_from_file(bag_name, topo_name)\n \n topo_file = File.join(Dir.pwd, \"#{topologies_path}\", bag_name, topo_name + '.json')\n return unless (loader.file_exists_and_is_readable?(topo_file))\n \n item_data = loader.object_from_file(topo_file)\n item_data = if use_encryption\n secret = read_secret\n Chef::EncryptedDataBagItem.encrypt_data_bag_item(item_data, secret)\n else\n item_data\n end\n item = Chef::DataBagItem.new\n item.data_bag(bag_name)\n item.raw_data = item_data\n item\n end",
"title": ""
},
{
"docid": "f57205dc1403356242c930e942a75921",
"score": "0.5324908",
"text": "def part_1\n nodes = Set.new([SHINY_GOLD])\n growing = true\n size = nodes.size\n\n while growing\n @bag_rules.each do |key, bags|\n nodes.add(key) if bags.keys.to_set.intersect?(nodes)\n end\n growing = size != nodes.size\n size = nodes.size\n end\n\n nodes.size - 1\n end",
"title": ""
},
{
"docid": "ec2c860d992886bc399b972a1513dec5",
"score": "0.5321456",
"text": "def make_bike\n new_bike = Bike.new\n new_bike.brand = self\n end",
"title": ""
},
{
"docid": "cfb2df0ab718796bb352155c23e4fa4f",
"score": "0.5301628",
"text": "def release_bike\n Bike.new\n end",
"title": ""
},
{
"docid": "8c7a41e32a6d3611b25f304f8968a95a",
"score": "0.5274904",
"text": "def generate_all_data_bag_items\n DATA_BAGS_CONF.each_pair do |data_bag_name, config|\n config.each_pair do |item, value|\n next unless value\n create_data_bag_item(data_bag_name, item, value)\n end\n end\nend",
"title": ""
},
{
"docid": "b1b41d8726fcb59a86ef1852948000b1",
"score": "0.5270638",
"text": "def initialize(capacity = DEFAULT_CAPACITY)\n @capacity = capacity\n @bikes = []\n\n # @bikes << Bike.new\n end",
"title": ""
},
{
"docid": "10007017b56e46776d16f7629d4486b1",
"score": "0.52695245",
"text": "def deep_clone\n b = dup\n b.generate_token\n b.save\n basket_items.each {|i| b.basket_items << i.dup}\n b\n end",
"title": ""
},
{
"docid": "d935406d44ae948c2e487c9904af7d3e",
"score": "0.5253628",
"text": "def initialize\r\n @owner = msg.sender\r\n @counter = 0\r\n @bets = Mapping.of( Integer => Bet ) ## type mapping( uint => Bet )\r\n end",
"title": ""
},
{
"docid": "9d7d9f939f47dd7fd1b16ae2ccced0a6",
"score": "0.5233911",
"text": "def initialize(capacity = DEFAULT_CAPACITY)\n @bikes = []\n @capacity = capacity\n end",
"title": ""
},
{
"docid": "9d7d9f939f47dd7fd1b16ae2ccced0a6",
"score": "0.5233911",
"text": "def initialize(capacity = DEFAULT_CAPACITY)\n @bikes = []\n @capacity = capacity\n end",
"title": ""
},
{
"docid": "9d7d9f939f47dd7fd1b16ae2ccced0a6",
"score": "0.5233911",
"text": "def initialize(capacity = DEFAULT_CAPACITY)\n @bikes = []\n @capacity = capacity\n end",
"title": ""
},
{
"docid": "242f202e10ee576fd810ed0f97488821",
"score": "0.5217345",
"text": "def create_dictionary\n @dictionary = Scrabble::Dictionary.new()\n end",
"title": ""
},
{
"docid": "d6a83a83473e922e1b01989f0c20fe49",
"score": "0.5200611",
"text": "def setup\n\n bikeSizes = {size: 12,tire_size: 3.0}\n @road = RoadBike.new(bikeSizes.merge({tape_color: \"blue\"}))\n @mountainBike = MountainBike.new(bikeSizes.merge({front_shock: 20,rear_shock: 30}))\n\n # @mountain_bike = MountainBike.new({})\n\n\n end",
"title": ""
},
{
"docid": "4590f45e30512c6f7937ae38b468a43a",
"score": "0.5197571",
"text": "def initialize\n @docked_bikes = []\n end",
"title": ""
},
{
"docid": "ed4e62b7a47cf243cc28fb586753bf84",
"score": "0.51715285",
"text": "def scratch(name, schema=nil)\n define_collection(name)\n @tables[name] = Bud::BudScratch.new(name, self, schema)\n end",
"title": ""
},
{
"docid": "41d023932d7a665f384b273f9073c71a",
"score": "0.5168567",
"text": "def release_bike\n unless self.bikes.length > 0\n raise(\"No bikes available\")\n end\n bike = Bike.new\n return bike\n end",
"title": ""
},
{
"docid": "ffe9525b259846348fd48988e4dffdf8",
"score": "0.5163093",
"text": "def initialize\r\n @rooms = {}\r\n @pack = BackPack.new\r\n end",
"title": ""
},
{
"docid": "2f2c39f7dc91733cca354ae2285d87e5",
"score": "0.51529133",
"text": "def find_bag # the ||= is a conditional operator, if :book_bag exists, its value is returned, otherwise a new BookBag object is created\n session[:book_bag] ||= BookBag.new\n end",
"title": ""
},
{
"docid": "8fffbffe783ec529b7a25dba4d7d974a",
"score": "0.51385486",
"text": "def initialize(capacity = DEFAULT_CAPACITY)\n @capacity = capacity\n @bikes = []\n end",
"title": ""
},
{
"docid": "ec2892a3d55aac92f127f21c06da8417",
"score": "0.51360637",
"text": "def release_bike\n #fail 'No bikes available' if @bikes.empty?\n fail 'No bikes available' if empty?\n #use private helper method empty? Single Responsibility Principle\n #@bikes.pop use private attr_reader\n #Bike.new\n bikes.pop\n end",
"title": ""
},
{
"docid": "5eb86da2ac9041c0d2a005719e8890e6",
"score": "0.5123092",
"text": "def initialize(capacity=DEFAULT_CAPACITY)\n @capacity = capacity\n @bikes = []\n end",
"title": ""
},
{
"docid": "42b5b663c02f6a4845d1fc52a10f9ffc",
"score": "0.51210326",
"text": "def setup\n @bike = @object = Mountainbike.new\n end",
"title": ""
},
{
"docid": "2aa5019e546f8194330f388052f6d353",
"score": "0.51123685",
"text": "def docking(bike_collection)\n\n # If it is just a bike, no need to run through an array.\n if bike_collection.is_a?(Bike)\n if full? then storage.push(bike_collection) else raise 'no space' end\n\n # If array, loop through it and add\n elsif bike_collection.is_a?(Array)\n bike_collection.each do |bike|\n if full? then storage.push(bike) else raise 'no space' end\n end\n end\n\n end",
"title": ""
},
{
"docid": "dce25d4bf6cd916ebcf5417042563511",
"score": "0.51011777",
"text": "def dock(bike)\n# the method will 'raise' an exception stating no capacity, if\n# the @rack array is at capacity\n raise \"Dock at Capacity\" if @rack.length >= 20 \n# the bike variable created via our Bike class is pushed to be stored\n# in the @rack array ### more info needed\n @rack << bike\n end",
"title": ""
},
{
"docid": "20efa3b9bfcaf2f33ae1ed1f78dfcc77",
"score": "0.5099807",
"text": "def bag_key(bag_name)\n File.join(complete_bag_key(bag_name), 'data')\n end",
"title": ""
},
{
"docid": "3082cd7771703630925d78d12186d141",
"score": "0.5086744",
"text": "def build_cookbook(cookbook)\n berksfile = Berkshelf::Berksfile.from_file(File.join(cookbook[:path], \"Berksfile\"))\n berksfile.vendor(\"berks-cookbooks\")\n\n File.open(\"berks-cookbooks/Berksfile\", 'w') { |file|\n file.write(\"source \\\"https://supermarket.chef.io\\\"\\n\\n\")\n file.write(\"cookbook \\\"#{cookbook[:name]}\\\", path: \\\"./#{cookbook[:name]}\\\"\")\n }\n\n if cookbook[:cookbook_filename].end_with? \".zip\"\n zf = ZipFileGenerator.new(\"berks-cookbooks\", cookbook[:cookbook_filename])\n zf.write\n elsif cookbook[:cookbook_filename].end_with? \".tar.gz\"\n system(\"tar -czvf #{cookbook[:cookbook_filename]} -C berks-cookbooks . > /dev/null 2>&1\")\n end\n end",
"title": ""
},
{
"docid": "c1192c794066df12a11a6d4d94cb4998",
"score": "0.50781345",
"text": "def add(rc)\n # iterate over given rc and store each item in this Bag's list\n rc.items.each do |item|\n # use the Bag's store method to ensure items are reset\n self.store(item)\n end\n # empty the given rc using its own empty method\n rc.items = []\n end",
"title": ""
},
{
"docid": "8dd32cd3ba1b15d72f89e58b8a81534f",
"score": "0.5074033",
"text": "def initialize(def_capacity=DEFAULT_CAPACITY)\n @bikes = []\n @def_capacity = def_capacity\n @broken_bikes = []\n end",
"title": ""
},
{
"docid": "5daa875f5e9553439d134a3981c5f8a0",
"score": "0.50715035",
"text": "def initialize\n @cook_id = 0\n @recipe_id = 0\n @hungry = true\n @recipes = []\n @cooking_shortcuts = []\n init_cooking_shortcuts\n end",
"title": ""
},
{
"docid": "bf57a5196dbe25444ce827561c45b2f0",
"score": "0.506834",
"text": "def load(bike)\n self.full? ? \"Full!\" : @bikes << bike\n end",
"title": ""
},
{
"docid": "af3a6808126dcc6cb8d9cd564a360fb0",
"score": "0.5062289",
"text": "def intialize\n @buns = [:wheat, :lettuce, :cheeto, :cotton_candy, :seaweed, :classic]\n end",
"title": ""
},
{
"docid": "f2d6eeed84e1c0e127ce41b519ade18d",
"score": "0.50583166",
"text": "def buy(blueprint, attributes = {})\n raise BlueprintCantSaveError.new(blueprint) unless blueprint.respond_to?(:make!)\n\n shelf = @back_room[blueprint, attributes]\n if shelf.empty?\n object = blueprint.outside_transaction { blueprint.make!(attributes) }\n @warehouse[blueprint, attributes] << blueprint.box(object)\n object\n else\n blueprint.unbox(shelf.shift)\n end\n end",
"title": ""
},
{
"docid": "0f9f6389d28973486d682eaf3fb54a9a",
"score": "0.50470465",
"text": "def initialize(attributes = {}, prefix = {}, bag = nil)\n @bag = bag || Resource::DataBag.fetch(prefix[:bag])\n\n id = attributes.delete(:id) || attributes.delete(\"id\")\n super({ id: id, data: attributes }, prefix)\n end",
"title": ""
},
{
"docid": "9f37e15324cf4941ccf4d38367f51e2b",
"score": "0.50455344",
"text": "def cook\n @bread.mix\n @bread.let_rise\n @bread.bake\n end",
"title": ""
},
{
"docid": "8832c895a2696f6edb8e5562b54c9733",
"score": "0.5034557",
"text": "def prep_bombs\n 10.times { @bombs << \"X\" }\n 71.times { @bombs << \"O\" }\n @bombs = @bombs.shuffle\n end",
"title": ""
},
{
"docid": "2a14336ed6f75ce3db803f9219a5b22c",
"score": "0.5025692",
"text": "def create_deck\n @deck = CARDS.product(SUITS).shuffle\n end",
"title": ""
},
{
"docid": "fdd8b86729eef5b0b9f0b4ee6f7d9d3d",
"score": "0.50238353",
"text": "def initialize(capacity = DEFAULT_CAPACITY)\n @bikes = []\n @capacity = capacity\n end",
"title": ""
},
{
"docid": "236df6408bd443ede322634078ba46f0",
"score": "0.502309",
"text": "def new\n @bike = Bike.new\n end",
"title": ""
},
{
"docid": "4250552368d902513e8a83da3f29dfc8",
"score": "0.500458",
"text": "def initialize(initial_name)\n puts \"I was created\"\n @name = initial_name\n @bag = Array.new\n @balance = 100\n @dollars = []\n end",
"title": ""
},
{
"docid": "c1251beea0d28543d631dbd62a730995",
"score": "0.50013775",
"text": "def list_data_bag_items(data_bag_name)\n @items = {} if @items.nil?\n @items[data_bag_name] = @items[data_bag_name] || knife_output_as_array(\"data bag show #{data_bag_name}\")\nend",
"title": ""
},
{
"docid": "545b8945e9ea28ac4b73989f98a76168",
"score": "0.498966",
"text": "def create_bin_before(course, bin)\n index = bins.index(bin)\n\n if index.nil?\n raise SomeoneElsesBin.new(\"bin not owned by this user.\")\n end\n\n new_bin = bins.build(courses: [course])\n User.where(_id: self.id).update_all(\"$push\" => {\n bins: { \"$each\" => [new_bin.serializable_hash],\n \"$position\" => index }})\n\n bin = bins.find(new_bin._id)\n return bin\n end",
"title": ""
},
{
"docid": "2d4e28964ff8e36e3ed69d92d5f0d5f7",
"score": "0.49874446",
"text": "def dock(bike)\n fail 'Capacity full' if full?\n @bikes << bike\n end",
"title": ""
},
{
"docid": "fb26982c53d56256c1d19141e620246f",
"score": "0.49734828",
"text": "def bake\n return unbake unless @data\n @baked_lines = []\n @data.ysize.times do |i|\n line = ''\n @data.xsize.times do |j|\n line << @tileset.fetch(@data[j, i], @default)\n end\n @baked_lines << line\n end\n end",
"title": ""
},
{
"docid": "bdb1fe05fab553b77424c943ddae77c2",
"score": "0.4968148",
"text": "def create\n @bagtype = Bagtype.new(params[:bagtype])\n\n respond_to do |format|\n if @bagtype.save\n format.html { redirect_to @bagtype, notice: 'Bagtype was successfully created.' }\n format.json { render json: @bagtype, status: :created, location: @bagtype }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bagtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ef0a8f1f223110ea99e76220971e1f2b",
"score": "0.49646464",
"text": "def fill_bag_from(source)\n self.class.bag.columns.each do |column|\n column_name = column.name\n if source.respond_to?(column_name) && self.send(column_name).blank?\n self.send(\"#{column_name}=\", source.send(column_name)) \n end\n end\n end",
"title": ""
},
{
"docid": "6cdfa1f6a037e344549f60786272ade9",
"score": "0.49552187",
"text": "def add_toy_to_bag(toy_name, child_name)\n\tchild_id = ''\n\ttoy_id = ''\n\t# check the children hash for child_name\n\tif !check_arr(child_name, Children[\"children\"], \"child_name\")\n\t\t# if empty, add a new child to children\n\t\tadd_new_child(child_name)\n\t\t# get child_id\n\t\tchild_id = get_id(child_name, Children[\"children\"], \"child_name\", \"child_id\")\n\telse\n\t\t# else if included, get child_id\n\t\tchild_id = get_id(child_name, Children[\"children\"], \"child_name\", \"child_id\")\n\tend\n\t# check the toys hash for toy_name\n\tif !check_arr(toy_name, Toys[\"toys\"], \"toy_name\")\n\t\t# if empty, add a new toy to toys\n\t\tadd_new_toy(toy_name)\n\t\t# get toy_id\n\t\ttoy_id = get_id(toy_name, Toys[\"toys\"], \"toy_name\", \"toy_id\")\n\telse\n\t\t# else if included, get toy_id\n\t\ttoy_id = get_id(toy_name, Toys[\"toys\"], \"toy_name\", \"toy_id\")\n\tend\n\t# check bag keys for child_id\n\tif !LootBag.toy_bag.key?(child_id)\n\t\t# if does not exist create a new key\n\t\tLootBag.toy_bag[child_id] = [toy_id]\n\t\t# else if exists\n\telse\n\t\t# push toy_id\n\t\tLootBag.toy_bag[child_id].push(toy_id)\n\tend\n\tupdate_file('bag.yaml', LootBag.toy_bag)\nend",
"title": ""
},
{
"docid": "c419b1386edf1b2e78ee6674ba70a08f",
"score": "0.49467632",
"text": "def generate_cookbooks_list\n cookbooks = YARD::Registry.all(:cookbook).uniq.sort_by{|cookbook| cookbook.name.to_s}\n generate_full_list(cookbooks, 'Cookbooks', 'cookbooks')\nend",
"title": ""
},
{
"docid": "36fef1003270a486ed62e567bdd5611a",
"score": "0.49419373",
"text": "def buy_dog(name)\n#know sabout its dogs\n pets[:dogs] << Dog.new(name)\n end",
"title": ""
},
{
"docid": "bc00c9d2b678535953bdc96cfbfbd9b4",
"score": "0.49316952",
"text": "def create_bed_new\n count = no_of_beds.to_i\n count.times do\n beds.create()\n end\n end",
"title": ""
},
{
"docid": "95ad50365a5fea9b927ba9e0cdc24a5c",
"score": "0.48872867",
"text": "def new\n BikeObject.new(self, 'Object', @type, @name)\n end",
"title": ""
},
{
"docid": "eeacdce3dc2a815e3620c1464fd50c13",
"score": "0.48864228",
"text": "def get_from_data_bags_cache(data_bag)\n encrypted_data_bags[data_bag]\n end",
"title": ""
},
{
"docid": "888c3d80ba2ab226b42e0544bd21b370",
"score": "0.48811933",
"text": "def bag_params\n params.require(:bag).permit(:user_id, :quantity, :product_id, :product_variant_id, :purchased)\n end",
"title": ""
},
{
"docid": "b6f68e15d9a676ebfe13cf594f4f02c1",
"score": "0.48780635",
"text": "def Cobble(name, *args, &block)\n Cobble.create(name, *args, &block)\nend",
"title": ""
},
{
"docid": "b519f0629999067ee15360a34f5f23d6",
"score": "0.48763284",
"text": "def get_bag(pokemon)\n return $scene.enemy_party.bag\n end",
"title": ""
},
{
"docid": "b5df69a0021f822c5f228636e1738316",
"score": "0.48747602",
"text": "def prepare_mega_evolve(pokemon, bag)\n @mega_evolved_trainer_ids << pokemon.trainer_id\n @prepared_mega_evolve << [pokemon, bag]\n end",
"title": ""
},
{
"docid": "93af2b5e27c9f9332b2a303f9b6ec02c",
"score": "0.48685512",
"text": "def create_empty\n EadGenerator.generate_empty\n end",
"title": ""
},
{
"docid": "199c57baa30631e3e027dbeb8acdbcf7",
"score": "0.48681158",
"text": "def create_skeleton!; (@skeletons << Bvh::Skeleton.new).last; end",
"title": ""
},
{
"docid": "be95424154098b6d4109b80489f6235d",
"score": "0.4867678",
"text": "def pack_box\n\t\t# @packages = ActiveShipping::Package.new((WEIGHT * 16), DIMENSIONS, UNITS)\n\t\t@packages = ActiveShipping::Package.new((WEIGHT * 16), DIMENSIONS, UNITS)\n\tend",
"title": ""
},
{
"docid": "9b26e869c04ff6bc0dddd701471e0fb8",
"score": "0.48571166",
"text": "def to_kit(name = $0)\n Kit.new name, build_commands(self.class.__commands)\n end",
"title": ""
},
{
"docid": "d2d0905819e2ddfac04ea9c49f304328",
"score": "0.48550293",
"text": "def initialize(capacity = DEFAULT_CAPACITY) # <--- Initializes the array that represents the dock and its capacity ~\n\t\t@bikes = []\n\t\t@capacity = capacity\n\tend",
"title": ""
},
{
"docid": "a09462c884e602bca066ba6a5751e86d",
"score": "0.48543152",
"text": "def release_bike\n fail 'No bikes available' if empty?\n @bike = @dock.pop\n end",
"title": ""
},
{
"docid": "6c93fab60abe14ebe690d6701e2d599a",
"score": "0.4851821",
"text": "def bags_directory\n ENV.fetch('BAGS_DIR', 'tmp')\n end",
"title": ""
},
{
"docid": "43bc9156a6d12b86a8ae0b6bd14b763a",
"score": "0.48490784",
"text": "def release_bike\n fail 'No bikes available' if working_bikes.empty?\n bikes.delete working_bikes.pop\n end",
"title": ""
},
{
"docid": "15b309bb607a87b33a94514dcd443996",
"score": "0.48398983",
"text": "def add_boating_test (hash)\n BoatingTest.new(hash)\n end",
"title": ""
},
{
"docid": "a18a90b3fb825204e726891260b34194",
"score": "0.48375115",
"text": "def index\n @bags = Bag.all\n end",
"title": ""
},
{
"docid": "aeef82ace3ac36e9b7971275a525e725",
"score": "0.48246315",
"text": "def in_bag(inside)\n baggage = []\n inside.each_with_index do |m, index|\n baggage << @names[index] if m == 1\n end\n baggage\n end",
"title": ""
},
{
"docid": "3e811c2745402bf13ac41113a8319a3e",
"score": "0.48202243",
"text": "def initialize\n # @all_bikes_in_van = [] \n @broken_bikes_for_garage = []\n @fixed_bikes_to_distribute = []\n end",
"title": ""
},
{
"docid": "0ef5c471657596a9f9fca162e1b63d46",
"score": "0.4819632",
"text": "def create\n @sugar_bag = SugarBag.new(params[:sugar_bag])\n\n respond_to do |format|\n if @sugar_bag.save\n format.html { redirect_to @sugar_bag, notice: 'Sugar bag was successfully created.' }\n format.json { render json: @sugar_bag, status: :created, location: @sugar_bag }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sugar_bag.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a9e25ea3fdc21e4f1e4bcefe394b2578",
"score": "0.48126528",
"text": "def buy_cat(name)\n pets[:cats] << Cat.new(name)\n end",
"title": ""
},
{
"docid": "21a037daa90e080c1d9161a33f10d079",
"score": "0.48031074",
"text": "def get_container_bag_names(target, bags)\n containing_bags = bags[target].clone\n bags[target].each do |bag_name,v|\n containing_bags.merge! get_container_bag_names(bag_name, bags)\n end\n return containing_bags\nend",
"title": ""
}
] |
de25bdeba3ba376a3b152ef383804f06
|
Update an item's state. ==== Return On response returns true. Failure on incorrect item id. ==== Parameters item_id:: the external id of the items whose state to set. state:: state will be set to 'activated' if state is true. Otherwise state will be set to 'suspended'.
|
[
{
"docid": "e87f4eac6e0d2a69a51a4d929ee018f7",
"score": "0.85662454",
"text": "def update_item_state(item_id, state)\n !send_pairwise_request(\"items/#{item_id}/#{state ? 'activate' : 'suspend'}\", nil, 'Get').nil?\n end",
"title": ""
}
] |
[
{
"docid": "8d05489a0da1c75f5800fc9242a83663",
"score": "0.6487289",
"text": "def offer_an_item(item)\r\n item.status = true\r\n end",
"title": ""
},
{
"docid": "748346392d0fcf725b79b496a90a933f",
"score": "0.62296295",
"text": "def set_item_status\n @item_status = ItemStatus.find(params[:id])\n end",
"title": ""
},
{
"docid": "ee65f14d0ccd291322eeb40f1e9a5940",
"score": "0.59071",
"text": "def set_status_item\n @status_item = StatusItem.find(params[:id])\n end",
"title": ""
},
{
"docid": "482254d357329d3e513a455f01ce9475",
"score": "0.5905134",
"text": "def update_state(state, active)\n if !active.nil?\n @states.each do |s, v|\n v[1] = active if s == state\n classify_state v\n end\n end\n end",
"title": ""
},
{
"docid": "92e6f96d165e4fc7964a16734d63eb3c",
"score": "0.5891069",
"text": "def set_status\n\t @id=params[:id]\n\t @state = State.find(@id)\n\t @status = @state.status\n if @status == true\n @state.update_attributes(status: 'false')\n flash[:success] = \"Status upadated In-Active\"\n else\n @state.update_attributes(status: 'true')\n flash[:success] = \"Status updated Active\"\n end\n redirect_to states_path\n end",
"title": ""
},
{
"docid": "ce150dc8ffd7c378c7f4a3898d8a2a6f",
"score": "0.5783998",
"text": "def on_state_while(state_id, item = nil)\n end",
"title": ""
},
{
"docid": "95c6a1ab0b36b663ebc767d4fd8a3aa2",
"score": "0.5781955",
"text": "def updateTransaction(state, id)\n parameters={state: state}\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/json'\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4050/transactions/\" + id.to_s , options) # put pending state\n return results\n end",
"title": ""
},
{
"docid": "73aba3dc74a01cbf4f7c9215cd68f18b",
"score": "0.5725282",
"text": "def state=(state)\n validator = EnumAttributeValidator.new('String', [\"active\", \"expired\", \"on_hold\", \"pending\"])\n unless validator.valid?(state)\n fail ArgumentError, \"invalid value for 'state', must be one of #{validator.allowable_values}.\"\n end\n @state = state\n end",
"title": ""
},
{
"docid": "f967659a2ddbb2bcd3e842750e8a4b43",
"score": "0.5715166",
"text": "def set_state\n @state = State.find(params[:id])\n end",
"title": ""
},
{
"docid": "f967659a2ddbb2bcd3e842750e8a4b43",
"score": "0.5715166",
"text": "def set_state\n @state = State.find(params[:id])\n end",
"title": ""
},
{
"docid": "f967659a2ddbb2bcd3e842750e8a4b43",
"score": "0.5715166",
"text": "def set_state\n @state = State.find(params[:id])\n end",
"title": ""
},
{
"docid": "f967659a2ddbb2bcd3e842750e8a4b43",
"score": "0.5715166",
"text": "def set_state\n @state = State.find(params[:id])\n end",
"title": ""
},
{
"docid": "f967659a2ddbb2bcd3e842750e8a4b43",
"score": "0.5715166",
"text": "def set_state\n @state = State.find(params[:id])\n end",
"title": ""
},
{
"docid": "f967659a2ddbb2bcd3e842750e8a4b43",
"score": "0.5715166",
"text": "def set_state\n @state = State.find(params[:id])\n end",
"title": ""
},
{
"docid": "f967659a2ddbb2bcd3e842750e8a4b43",
"score": "0.5715166",
"text": "def set_state\n @state = State.find(params[:id])\n end",
"title": ""
},
{
"docid": "f967659a2ddbb2bcd3e842750e8a4b43",
"score": "0.5715166",
"text": "def set_state\n @state = State.find(params[:id])\n end",
"title": ""
},
{
"docid": "95b04f38d5e973ab040a9841a9cea2d6",
"score": "0.57066965",
"text": "def change_item_state(checklist, item)\n\tid = item.id\n\tpos = item.pos\n # checked = item.state_was == \"complete\" ? true : false\n name = item.name\n checklist.delete_checklist_item(id)\n checklist.add_item(name, true, pos)\n checklist.save\nend",
"title": ""
},
{
"docid": "c5ba82a6cdcc46ade08a6f006e5e0b31",
"score": "0.56984854",
"text": "def set_item\n @item = Item.active.find(params[:id])\n end",
"title": ""
},
{
"docid": "7f227b177a525eab2ed05cc49bee265f",
"score": "0.56788796",
"text": "def change_item_state(checklist, item)\n id = item.id\n pos = item.pos\n # checked = item.state_was == \"complete\" ? true : false\n name = item.name\n checklist.delete_checklist_item(id)\n checklist.add_item(name, true, pos)\n checklist.save\nend",
"title": ""
},
{
"docid": "96139eccf2b480ad83e9d54c23b24c07",
"score": "0.56784606",
"text": "def toggle_active\n @menu_item = MenuItem.find(params[:id])\n ok = @menu_item.update_attributes(:is_active => !@menu_item.is_active)\n if ok\n flash[:notice] = t('ubiquo.menu_item.updated')\n else\n flash[:error] = t('ubiquo.menu_item.update_error')\n end\n respond_to do |format|\n format.html { redirect_to(ubiquo.edit_menu_path(@menu_item.menu)) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "1adfdef155b333ce89b5fb24ef734272",
"score": "0.5663464",
"text": "def state=(state)\n validator = EnumAttributeValidator.new('String', [\"active\", \"deactivated\"])\n unless validator.valid?(state)\n fail ArgumentError, \"invalid value for \\\"state\\\", must be one of #{validator.allowable_values}.\"\n end\n @state = state\n end",
"title": ""
},
{
"docid": "50dd4913e7b0eb1c565c6e7c8b229819",
"score": "0.5630439",
"text": "def set_state(state)\n self.state = state\n self.save\n end",
"title": ""
},
{
"docid": "2707bb6a442a59f1267aeddea214c8e2",
"score": "0.56137633",
"text": "def update\n @itemstatus = Itemstatus.find(params[:id])\n\n respond_to do |format|\n if @itemstatus.update_attributes(params[:itemstatus])\n format.html { redirect_to @itemstatus, notice: 'Itemstatus was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @itemstatus.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f8a5f719cf45e4b08d819b54a941b9ef",
"score": "0.55976105",
"text": "def set_state\n @state = State.find(params[:id])\n end",
"title": ""
},
{
"docid": "f8a5f719cf45e4b08d819b54a941b9ef",
"score": "0.55976105",
"text": "def set_state\n @state = State.find(params[:id])\n end",
"title": ""
},
{
"docid": "6fed56991df772d7572a4848b12daf29",
"score": "0.55974567",
"text": "def update\n if @state.update(state_params)\n render json: @state\n # 'State was successfully updated.'\n else\n render json: @state.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "f6eb32f4065b7a231f0f342e6f681445",
"score": "0.5586215",
"text": "def set_state_update\n @customer = Customer.find(customer_id)\n\n Order.find(id).update_column(:state_id, @customer.state_id)\n end",
"title": ""
},
{
"docid": "61aed5af50b9dde8437801f70bde4250",
"score": "0.5569182",
"text": "def set_state\n @state = State.find(params[:id])\n end",
"title": ""
},
{
"docid": "32a0a4c16e94509996fc4b667d474c7c",
"score": "0.5552639",
"text": "def set_item(item_id)\n @kind = 2\n @item_id = item_id\n end",
"title": ""
},
{
"docid": "2a7ac8695d844ca0359e9352864117cc",
"score": "0.5532316",
"text": "def update_item\n begin\n @volume = services.block_storage.get_volume(params[:id])\n @target_state = params[:target_state]\n respond_to do |format|\n format.js do\n if @volume and @volume.status != @target_state\n @volume.task_state = @target_state\n end\n end\n end\n rescue => e\n return nil\n end\n end",
"title": ""
},
{
"docid": "038510dc7e3f089ddf8463f7392c0265",
"score": "0.5530346",
"text": "def state=(state)\n validator = EnumAttributeValidator.new('String', [\"ACTIVE\", \"SUSPENDED\", \"TERMINATED\", \"UNSUPPORTED\", \"UNACTIVATED\"])\n unless validator.valid?(state)\n fail ArgumentError, \"invalid value for \\\"state\\\", must be one of #{validator.allowable_values}.\"\n end\n @state = state\n end",
"title": ""
},
{
"docid": "0fd2be2fccc3f03daa925bc82d3f0daf",
"score": "0.5528142",
"text": "def set_state\n @state = State.friendly.find(params[:id])\n end",
"title": ""
},
{
"docid": "2b6a7c16da81d549692c4e17c68a2585",
"score": "0.5526482",
"text": "def update\n if @item.update(item_params)\n return success_item_show\n else\n return error_item_save\n end\n end",
"title": ""
},
{
"docid": "0898956b97c742a65bac815b07a00783",
"score": "0.55254835",
"text": "def update\n @api_state = Api::State.find(params[:id])\n\n if @api_state.update(api_state_params)\n head :no_content\n else\n render json: @api_state.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "7ce5d2b4febf7ea28a617031a72ec234",
"score": "0.5517034",
"text": "def set_sellable_item_state(state_result)\n if !state_result[:inventory_item].nil?\n if (state_result[:inventory_item].quantity > state_result[:inventory_item].item.quantity_threshold)\n state_result[:inventory_item].update(id: state_result[:inventory_item].id, inventory_item_state: InventoryItemState.find_by(name: \"Available\"))\n elsif (state_result[:inventory_item].quantity == 0)\n state_result[:inventory_item].update(id: state_result[:inventory_item].id, inventory_item_state: InventoryItemState.find_by(name: \"Out_of_Stock\"), inventory_item_condition: InventoryItemCondition.find_by(name: \"Not_Sellable\"))\n else\n state_result[:inventory_item].update(id: state_result[:inventory_item].id, inventory_item_state: InventoryItemState.find_by(name: \"CriticaL_Level\"))\n end\n end\n end",
"title": ""
},
{
"docid": "f43094b019d194a8bab94498a4083bcd",
"score": "0.5474239",
"text": "def update_item(item_id)\n request_body = {\n 'name' => 'Malted Milkshake'\n }\n\n response = Unirest.put CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully updated item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item update failed'\n puts response.body\n return nil\n end\nend",
"title": ""
},
{
"docid": "48ffe02f957c147f1850c06039105f6a",
"score": "0.54421914",
"text": "def update_state(product, state, order_line)\n hash = {\n item_id: order_line.item_id,\n transaction_id: order_line.transaction_id\n }\n if state == 'paid'\n hash.merge!(paid: true)\n elsif state == 'shipped'\n hash.merge!(shipped: true)\n end\n\n response = @allegro.complete_sale(hash)\n #Rails.logger.info response.inspect\n response\n end",
"title": ""
},
{
"docid": "dd18553cd54acd84f646a589b2cb20e2",
"score": "0.5412782",
"text": "def update\n @task_state = TaskState.find(params[:id])\n\n respond_to do |format|\n if @task_state.update_attributes(params[:task_state])\n format.html { redirect_to(@task_state, :notice => t(\"screens.notice.successfully_updated\")) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @task_state.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "829098b442704c0c52c5132fbe2d790b",
"score": "0.5394288",
"text": "def update\n state = task_params[:state]\n prev_state = @task.state\n\n # Restrict access for non-admins unless\n # new state is 'in progress' or 'done' or missed in params\n check_if_admin unless ['in progress', 'done', nil].include?(state) and (\n # task belongs to user\n @task.user_id == @person.id or\n # user assigns task for himself AND task has not owner AND task is open\n task_params[:user_id] == @person.id && @task.user_id.nil? && prev_state == 'open')\n\n if @task.update(task_params)\n @task.decrease_reward if state == 'failed' && prev_state != 'failed'\n send_reward if state == 'verified' && prev_state != 'verified'\n render :show, status: :ok, location: @task\n else\n render json: @task.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "bbcfaeda16ff15cc602d72ea7ef563cb",
"score": "0.53924066",
"text": "def update\n item = current_user.item_infos(params[:id])\n item.assign_attributes(params[:item])\n response = current_user.update_item(item)\n unless response.is_a? StandardError\n redirect_to items_path, notice: \"Item mis a jour\"\n else\n redirect_to edit_item_path(item), alert: response.message\n end\n end",
"title": ""
},
{
"docid": "1fcbe38aba49434621e07382eb353ab1",
"score": "0.53842485",
"text": "def item_update(item)\n @item = item\n end",
"title": ""
},
{
"docid": "677ea1d8cd75249ab3a51b9c15867f5c",
"score": "0.53837156",
"text": "def state\n @state_wrapper ||= ActionItemInternal::ActionItemStateWrapper.new(@item)\n end",
"title": ""
},
{
"docid": "22ebd43c50b0ff5237c7091ed4cf9601",
"score": "0.53807455",
"text": "def update\n if @item.update(item_params)\n render json: @item, status: :ok\n else\n render json: @item.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "309fc523f596a0313e9f7231307d77cd",
"score": "0.53743255",
"text": "def set_state(state)\n @state = state\n self[:action] = state\n @health = @health.clamp(0, 100)\n trigger 'change'\n send_status_notification unless dead?\n save\n end",
"title": ""
},
{
"docid": "c7a516d30f2c0df926c411921ebd9a5f",
"score": "0.5369044",
"text": "def update\n if @item.update_attributes(item_params)\n render json: @item, status: :ok\n else\n render_error(@item, :unprocessable_entity)\n end\n end",
"title": ""
},
{
"docid": "f89bd7ff726d6eda8ac727b61a45b36f",
"score": "0.5361357",
"text": "def update\n @item = @receipt.items.find_by(id: params[:id])\n\n unless @item\n return render_error_code(:not_found,\n :db_failure,\n item: 'was not found')\n end\n\n if @item.update(permitted_params)\n render_ok\n else\n render_error_code(:bad_request, :db_failure, @item.errors)\n end\n end",
"title": ""
},
{
"docid": "67af691078eecb3f4528b164e5d9601b",
"score": "0.53344446",
"text": "def update\n @state = State.find(params[:id])\n\n respond_to do |format|\n if @state.update_attributes(params[:state])\n format.html { redirect_to(states_path, :notice => 'State was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @state.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b8d322f39553c9234495b886e2664db1",
"score": "0.53233284",
"text": "def enemy_change_state(id, add, state_id)\n # for all target enemies\n get_enemies(id).each {|enemy|\n # if actually existing enemy\n if enemy.battler != nil\n # clear immortal flag if state is dead state\n enemy.battler.immortal = false if $data_states[state_id].zero_hp\n # add or remove state\n add ? enemy.battler.add_state(state_id) :\n enemy.battler.remove_state(state_id)\n end}\n end",
"title": ""
},
{
"docid": "e0f78c74bc0fa6608c9700597e5fd569",
"score": "0.5308457",
"text": "def set_state(state, actor = nil)\n write_attribute(:state, Fl::Framework::List::ListItem.state_to_db(state))\n write_attribute(:state_updated_at, Time.new)\n\n self.state_updated_by = (actor.nil?) ? self.owner : actor\n\n # setting the state will cause the update time on the list to be bumped\n\n @bump_list_update_time = true\n end",
"title": ""
},
{
"docid": "8eef034389f88cb6df84ae395504395f",
"score": "0.52981436",
"text": "def water_manager_update(id)\n wm = WaterManager.find(id)\n # change state\n wm.update(state: (wm.state == ACTIVE ? STANDBY : ACTIVE))\n wm = WaterManager.find(id)\n # log \"wm.state --> #{wm.state}\\n\"\n \n if wm.state == ACTIVE\n # log \"wm.arm\\n\"\n arm\n else\n # log \"wm.disarm\\n\"\n disarm\n end\n end",
"title": ""
},
{
"docid": "dd63648c75ccf38dcc089f8a9f68ef94",
"score": "0.5297883",
"text": "def update\n @purchase_item_status = PurchaseItemStatus.find(params[:id])\n\n respond_to do |format|\n if @purchase_item_status.update_attributes(params[:purchase_item_status])\n format.html { redirect_to @purchase_item_status, notice: 'Purchase item status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @purchase_item_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a29314bc0f3c42bbbc1d9dddd1837c60",
"score": "0.5286829",
"text": "def state=(state)\n validator = EnumAttributeValidator.new('String', [\"Trial\", \"Provisioned\", \"Paid\", \"AwaitingPayment\", \"Cancelled\", \"Failed\", \"Expired\"])\n unless validator.valid?(state)\n fail ArgumentError, \"invalid value for 'state', must be one of #{validator.allowable_values}.\"\n end\n @state = state\n end",
"title": ""
},
{
"docid": "a29314bc0f3c42bbbc1d9dddd1837c60",
"score": "0.5286829",
"text": "def state=(state)\n validator = EnumAttributeValidator.new('String', [\"Trial\", \"Provisioned\", \"Paid\", \"AwaitingPayment\", \"Cancelled\", \"Failed\", \"Expired\"])\n unless validator.valid?(state)\n fail ArgumentError, \"invalid value for 'state', must be one of #{validator.allowable_values}.\"\n end\n @state = state\n end",
"title": ""
},
{
"docid": "a29314bc0f3c42bbbc1d9dddd1837c60",
"score": "0.5286829",
"text": "def state=(state)\n validator = EnumAttributeValidator.new('String', [\"Trial\", \"Provisioned\", \"Paid\", \"AwaitingPayment\", \"Cancelled\", \"Failed\", \"Expired\"])\n unless validator.valid?(state)\n fail ArgumentError, \"invalid value for 'state', must be one of #{validator.allowable_values}.\"\n end\n @state = state\n end",
"title": ""
},
{
"docid": "bd857bde078bba9d02a9d3c5a7b4e19a",
"score": "0.5286446",
"text": "def update\n @state = State.find(params[:id])\n\n respond_to do |format|\n if @state.update_attributes(params[:state])\n format.html { redirect_to @state, notice: 'State was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bd857bde078bba9d02a9d3c5a7b4e19a",
"score": "0.5286446",
"text": "def update\n @state = State.find(params[:id])\n\n respond_to do |format|\n if @state.update_attributes(params[:state])\n format.html { redirect_to @state, notice: 'State was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bd857bde078bba9d02a9d3c5a7b4e19a",
"score": "0.5286446",
"text": "def update\n @state = State.find(params[:id])\n\n respond_to do |format|\n if @state.update_attributes(params[:state])\n format.html { redirect_to @state, notice: 'State was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "dfc8852864ce2b5745943210118fb1e7",
"score": "0.5279379",
"text": "def set_user_state\n @user_state = UserState.find(params[:id])\n end",
"title": ""
},
{
"docid": "dfc8852864ce2b5745943210118fb1e7",
"score": "0.5279379",
"text": "def set_user_state\n @user_state = UserState.find(params[:id])\n end",
"title": ""
},
{
"docid": "8ea249b6b5d98df96a25ea74e6e2d599",
"score": "0.52790105",
"text": "def state=(state)\n validator = EnumAttributeValidator.new('String', [\"Pending\", \"Unsent\", \"Sent\"])\n unless validator.valid?(state)\n fail ArgumentError, \"invalid value for 'state', must be one of #{validator.allowable_values}.\"\n end\n @state = state\n end",
"title": ""
},
{
"docid": "1c8863b26f1c8742fb79fb3f570627ef",
"score": "0.5277913",
"text": "def set_state(new_state)\n failure_message = \"Failed to set pending_op #{self._id.to_s} state to #{new_state.to_s} for domain #{self.domain.namespace}\"\n updated_op = update_with_retries(5, failure_message) do |current_domain, current_op, op_index|\n Domain.where({ \"_id\" => current_domain._id, \"pending_ops.#{op_index}._id\" => current_op._id }).update({\"$set\" => { \"pending_ops.#{op_index}.state\" => new_state }})\n end\n\n # set the state in the object in mongoid memory for access by the caller\n self.state = updated_op.state\n end",
"title": ""
},
{
"docid": "2bbc231b2f168c3ce328553b9557241d",
"score": "0.5277362",
"text": "def set_state(new_state)\n Torrent::STATES.each_with_index do |allowed_state, index|\n if allowed_state == new_state\n self.state = index\n end\n end\n end",
"title": ""
},
{
"docid": "2d01e5c99bfde1ccb31239629d35220e",
"score": "0.526789",
"text": "def update_item\n @item = Item.find(params[:id])\n @item.update(params[:item])\n redirect \"/items/#{@item.id}\"\n end",
"title": ""
},
{
"docid": "4836fcac49d965c5a9a8e9fcb146512c",
"score": "0.52648515",
"text": "def state=(value)\n @state = value\n end",
"title": ""
},
{
"docid": "ef28e2a82252153a8d66f919dde755a5",
"score": "0.5258847",
"text": "def update\n @item ||= Item.find_by_id_or_name(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9723fe84333309a4fbe1a7ecd7ce1ec9",
"score": "0.5258748",
"text": "def state_change(id, state)\n raise ArgumentError, \"state (#{state}) must be one of #{STATES}\" unless STATES.include?(state)\n\n body = {\n data: {\n type: \"state-change\",\n attributes: {\n message: \"This is has been triaged internally.\",\n state: state\n }\n }\n }\n post(\"reports/#{id}/state_changes\", body)\n end",
"title": ""
},
{
"docid": "6fae85968e25c7aa98e8c12abaa697ca",
"score": "0.5252373",
"text": "def update\n @order_line_item = OrderLineItem.find(params[:id])\n\n if @order_line_item.update(order_line_item_params)\n # set to manually completd\n @order_line_item.status = \"Manually Completed\"\n @order_line_item.save\n render json: @order_line_item\n else\n render json: @order_line_item.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "8a8019b2a02117c500c822b5b1b0fba9",
"score": "0.52503633",
"text": "def update_product_state(shop_id, sku, state)\n request :patch, \"shops/#{shop_id}/products/#{sku}\", body: {\n state: state,\n }\n end",
"title": ""
},
{
"docid": "7c1ca2e0e06e95326d293954c5314efd",
"score": "0.5250066",
"text": "def update\n @accounting_item = Accounting::Item.find_by(id: params[:id], user_id: @current_user.id)\n logger.info @accounting_item.inspect\n\n respond_to do |format|\n if @accounting_item.update(item_params)\n format.json { head :no_content }\n else\n format.json { render json: @accounting_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f354332ea500152e9dbf0248dd94e9a8",
"score": "0.52477485",
"text": "def update_item_in_guest_cart(item_id, item)\n put_wrapper(\"/V1/guest-carts/#{guest_cart_key}/items/#{item_id}\", item.to_json, default_headers)\n end",
"title": ""
},
{
"docid": "851be1b1f988f81792efc2065194aeb7",
"score": "0.52469057",
"text": "def updateItem(app, repo_url, item, id)\n headers = defaultHeaders(app[\"token\"])\n data = id.merge(item).to_json\n response = HTTParty.post(repo_url,\n headers: headers,\n body: data)\n response \nend",
"title": ""
},
{
"docid": "a4dbd08fcbaa3c9c5f5c7ef64940ea65",
"score": "0.5226385",
"text": "def state=(state)\n validator = EnumAttributeValidator.new('String', ['WAITING', 'RUNNING', 'FINISHED'])\n unless validator.valid?(state)\n fail ArgumentError, 'invalid value for \"state\", must be one of #{validator.allowable_values}.'\n end\n @state = state\n end",
"title": ""
},
{
"docid": "00b167f25c0e9327c843fb7aa3376e5c",
"score": "0.5222392",
"text": "def set_state(new_state)\n # in order to facilitate execution of pre-save ops, \n # we check whether the application is persisted to mongo\n if pending_app_op_group.application.persisted?\n failure_message = \"Failed to set pending_op #{self._id.to_s} state to #{new_state.to_s} for application #{self.pending_app_op_group.application.name}\"\n updated_op = update_with_retries(5, failure_message) do |current_app, current_op_group, current_op, op_group_index, op_index|\n Application.where({ \"_id\" => current_app._id, \"pending_op_groups.#{op_group_index}._id\" => current_op_group._id, \"pending_op_groups.#{op_group_index}.pending_ops.#{op_index}._id\" => current_op._id }).update({\"$set\" => { \"pending_op_groups.#{op_group_index}.pending_ops.#{op_index}.state\" => new_state }})\n end\n # set the state in the object in mongoid memory for access by the caller\n self.state = updated_op.state\n else\n self.state = new_state\n end\n end",
"title": ""
},
{
"docid": "4f5761fa245144c146622f4dff3cbc1e",
"score": "0.5204315",
"text": "def update_status(id, status)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id)\n\t\t\tclient.add_param(kparams, 'status', status)\n\t\t\tclient.queue_service_action_call('inboxmessage', 'updateStatus', 'bool', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"title": ""
},
{
"docid": "cbb685041943561d3540cbc6d584547c",
"score": "0.5197175",
"text": "def update_item(position,status)\n\n\tposition - 1\n\t@items[position].update_status(status)\nend",
"title": ""
},
{
"docid": "bf37f466b91a7103c9c01575191dbc91",
"score": "0.51969546",
"text": "def update_status!(\n item = nil,\n file: true,\n data: true,\n ready: true,\n overwrite: true,\n **added\n )\n item ||= default_to_self\n file &&= overwrite || item[:file_status].nil?\n data &&= overwrite || item[:data_status].nil?\n ready &&= overwrite || item[:ready_status].nil?\n item[:file_status] = evaluate_file_status(item, **added) if file\n item[:data_status] = evaluate_data_status(item, **added) if data\n item[:ready_status] = evaluate_ready_status(item, **added) if ready\n # noinspection RubyMismatchedReturnType\n item\n end",
"title": ""
},
{
"docid": "ba9917b8d6acdc932092103e329e9392",
"score": "0.5178694",
"text": "def set_item\n @item = Item.find(params[:id])\n render json: {error: 'not allowed'}, status: 401 unless @item.user == @current_user\n\n end",
"title": ""
},
{
"docid": "524ee8c26af20f85cb928a467faccfc6",
"score": "0.5170163",
"text": "def update_final_state(to_be_modified_inventory_item, inventory_item_params, next_state)\n\n return_params = Hash.new(0)\n count = inventory_item_params[:count]\n\n if to_be_modified_inventory_item.nil?\n\n result = create_inventory_item(inventory_item_params, next_state)\n return_params = result\n else\n new_quantity = to_be_modified_inventory_item.quantity + count\n begin\n if to_be_modified_inventory_item.update(id: to_be_modified_inventory_item.id, quantity: new_quantity, inventory_item_condition_id: inventory_item_params[:inventory_item_condition_id])\n return_params[:inventory_item] = to_be_modified_inventory_item\n else\n return_params[:errors] = inventory_item.errors.full_messages\n end\n\n rescue StandardError\n puts 'there is a problem in dropping incoming quantity from initial state'\n end\n end\n return return_params\n end",
"title": ""
},
{
"docid": "65deab6e920cd689a9bbcbbf9592f195",
"score": "0.5161714",
"text": "def update\n item = Item.find(params[:id])\n if item.user == current_user\n if item.update(item_params)\n render json: item\n else\n render json: {errors: item.errors}, status: :unprocessable_entity\n end\n else\n render json: {errors: \"you can't do it\"}, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "1e50470e30617555c49a63b54bce3500",
"score": "0.51616627",
"text": "def update_purchased_status(database, purchased, item)\n $database.execute(\"UPDATE shopping SET purchased = ('true') WHERE item = (?)\", [item])\nend",
"title": ""
},
{
"docid": "660fb80bd841a968a0fc06d396e10abb",
"score": "0.5151776",
"text": "def update(type, name, state)\n key = (make_key(type, name))\n entry = @state[key]\n if entry\n (entry.state != state) && @changed = true\n entry.state = state\n else\n @state.store(key, StateEntry.new(type, name, state))\n @changed = true\n end\n end",
"title": ""
},
{
"docid": "48bb489c912b8a4e6ba27ba87e983839",
"score": "0.51481783",
"text": "def update\n @item = Item.find(params[:id])\n already_complete = @item.completed\n respond_to do |format|\n if @item.update_attributes(params[:item])\n just_completed = @item.completed && !already_complete \n if (just_completed && @item.reschedule)\n new = Item.new()\n [email protected]\n new.completed=false\n [email protected]\n new.save!\n end\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(items_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "abc6518b902131c7bc963057a8ca68f2",
"score": "0.5147005",
"text": "def state=(value)\n @state = value\n end",
"title": ""
},
{
"docid": "abc6518b902131c7bc963057a8ca68f2",
"score": "0.5147005",
"text": "def state=(value)\n @state = value\n end",
"title": ""
},
{
"docid": "abc6518b902131c7bc963057a8ca68f2",
"score": "0.5147005",
"text": "def state=(value)\n @state = value\n end",
"title": ""
},
{
"docid": "abc6518b902131c7bc963057a8ca68f2",
"score": "0.5147005",
"text": "def state=(value)\n @state = value\n end",
"title": ""
},
{
"docid": "abc6518b902131c7bc963057a8ca68f2",
"score": "0.5147005",
"text": "def state=(value)\n @state = value\n end",
"title": ""
},
{
"docid": "abc6518b902131c7bc963057a8ca68f2",
"score": "0.5147005",
"text": "def state=(value)\n @state = value\n end",
"title": ""
},
{
"docid": "abc6518b902131c7bc963057a8ca68f2",
"score": "0.5147005",
"text": "def state=(value)\n @state = value\n end",
"title": ""
},
{
"docid": "abc6518b902131c7bc963057a8ca68f2",
"score": "0.5147005",
"text": "def state=(value)\n @state = value\n end",
"title": ""
},
{
"docid": "abc6518b902131c7bc963057a8ca68f2",
"score": "0.5147005",
"text": "def state=(value)\n @state = value\n end",
"title": ""
},
{
"docid": "abc6518b902131c7bc963057a8ca68f2",
"score": "0.5147005",
"text": "def state=(value)\n @state = value\n end",
"title": ""
},
{
"docid": "c6dce5115cac3ee4f3e81d61841ef933",
"score": "0.514696",
"text": "def _check_and_set_state(job_id, update_id, prev_state, post_state)\n return false unless @job_states[prev_state].include?(job_id)\n return false unless @jobs[job_id].update_id == update_id\n _set_state(job_id, post_state)\n return true\n end",
"title": ""
},
{
"docid": "6fcdb3acdc5552063835992af8e199e6",
"score": "0.5145034",
"text": "def state=(state) # :nodoc:\n state = state.to_sym if state\n state = nil if state == :available\n if state && !VALID_STATES.include?(state)\n raise ArgumentError, \"Invalid Status (#{state}), use: #{VALID_STATES*' '}\"\n end\n\n set_content_for :show, state\n end",
"title": ""
},
{
"docid": "c7b5ca897cbe64fa0181a706a19c4f12",
"score": "0.51411694",
"text": "def check_item_states(card_id, options = {})\n card_resource(card_id, \"check_item_states\", options)\n end",
"title": ""
},
{
"docid": "8d4c93b8c95d72ef11a20ccae789c163",
"score": "0.51375216",
"text": "def set_state(state)\n stop if state == :error and [:initializing, :ready, :running_sm].include? resource_status\n record.set_state(state)\n end",
"title": ""
},
{
"docid": "0dc6c4033d5675729d997db1c43e3709",
"score": "0.51375145",
"text": "def update\n respond_to do |format|\n if @state.update(state_params)\n format.html { redirect_to @state, notice: 'State was successfully updated.' }\n format.json { render :show, status: :ok, location: @state }\n else\n format.html { render :edit }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0dc6c4033d5675729d997db1c43e3709",
"score": "0.51375145",
"text": "def update\n respond_to do |format|\n if @state.update(state_params)\n format.html { redirect_to @state, notice: 'State was successfully updated.' }\n format.json { render :show, status: :ok, location: @state }\n else\n format.html { render :edit }\n format.json { render json: @state.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "fc312046a726f0ee2a306a4b363c0d48",
"score": "0.5136405",
"text": "def update\n @item = NavItem.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(extract_item(params))\n format.html { redirect_to nav_items_url, notice: t('nav_items.saved') }\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": "34f5fb8e67cc1ba033c19582960b5fa9",
"score": "0.5134376",
"text": "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { respond_with_bip(@item) }\n else\n format.html { render action: 'edit' }\n format.json { respond_with_bip(@item) }\n end\n end\n end",
"title": ""
}
] |
344f8725c8979827594ed85e4becf361
|
POST /supplier_categories POST /supplier_categories.json
|
[
{
"docid": "ea84dcf007d2f480d7083aaae3df75eb",
"score": "0.7046655",
"text": "def create\n @supplier_category = SupplierCategory.new(supplier_category_params)\n\n respond_to do |format|\n if @supplier_category.save\n format.html { redirect_to admin_supplier_category_path(@supplier_category), notice: 'Supplier category was successfully created.' }\n format.json { render :show, status: :created, location: @supplier_category }\n else\n format.html { render :new }\n format.json { render json: @supplier_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "7e576fc88fa7852c520ed28909d3591e",
"score": "0.7684449",
"text": "def create\n get_supplier\n @supplier_category = @supplier.categories.create(params[:supplier_category])\n end",
"title": ""
},
{
"docid": "b91b948a7de0305ac4ad698b74ba08f5",
"score": "0.6661895",
"text": "def new\n get_supplier\n get_categories\n @supplier_category = @supplier.categories.new\n end",
"title": ""
},
{
"docid": "de1019d3d161e462915d4ceb82ed94b7",
"score": "0.64695776",
"text": "def create_category payload\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.post CATEGORIES, payload )\n\t\t\t\tend",
"title": ""
},
{
"docid": "35e1bce36bbfd4669ef38c6ad0890d00",
"score": "0.6448449",
"text": "def create\n @supplier = current_merchant.suppliers.new(supplier_params)\n\n respond_to do |format|\n if @supplier.save\n format.html { redirect_to @supplier, notice: 'Supplier was successfully created.' }\n format.json { render :show, status: :created, location: @supplier }\n else\n format.html { render :new }\n format.json { render json: @supplier.errors, status: :unprocessable_entity }\n end\n end\n @supplier.ordering_method_ids = params[:supplier][:ordering_method_ids]\n @supplier.delivery_location_ids = params[:supplier][:delivery_location_ids]\n @supplier.online_retail_service_type_ids = params[:supplier][:online_retail_service_type_ids]\n @supplier.product_category_ids = params[:supplier][:product_category_ids]\n end",
"title": ""
},
{
"docid": "2e413155a54df8bd90ccd162b27efc30",
"score": "0.6434784",
"text": "def CreateCategory params = {}\n \n APICall(path: 'categories.json',method: 'POST',payload: params.to_json)\n \n end",
"title": ""
},
{
"docid": "d52dfe68ef644a52c1ddb424b0ce06e2",
"score": "0.6376081",
"text": "def supplier_category_params\n params.require(:supplier_category).permit(:title, :status)\n end",
"title": ""
},
{
"docid": "58f100bd42ad2dfd121248de83b2fbc9",
"score": "0.63409144",
"text": "def create\n json_create(category_params, Category)\n end",
"title": ""
},
{
"docid": "153b901fad5f94186ed02c8df7d71327",
"score": "0.6204257",
"text": "def supplier_category_params\n params.require(:supplier_category).permit(:name, :description, :image, :parent_id, :provider_id)\n end",
"title": ""
},
{
"docid": "7d4b12214bdc985a6ff5faee3cdd9d41",
"score": "0.6159237",
"text": "def create\n @catalogs_supplier = Catalogs::Supplier.new(catalogs_supplier_params)\n\n respond_to do |format|\n if @catalogs_supplier.save\n format.html { redirect_to @catalogs_supplier, notice: 'Supplier was successfully created.' }\n format.json { render :show, status: :created, location: @catalogs_supplier }\n else\n format.html { render :new }\n format.json { render json: @catalogs_supplier.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "21547d3fbbac3d2696b6d9d49658a36c",
"score": "0.609829",
"text": "def index\n @supplier_categories = SupplierCategory.all\n end",
"title": ""
},
{
"docid": "0a174b56469c984b3211f44a88591a1b",
"score": "0.6078852",
"text": "def create\n @admin_supplier = Admin::Supplier.new(params[:admin_supplier])\n\n respond_to do |format|\n if @admin_supplier.save\n format.html { redirect_to admin_suppliers_url }\n format.json { render json: @admin_supplier, status: :created, location: @admin_supplier }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_supplier.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1e352d8bf7246ff533f956c3977a245c",
"score": "0.6068365",
"text": "def create\n @catalog_supplier = Catalog::Supplier.new(catalog_supplier_params)\n\n respond_to do |format|\n if @catalog_supplier.save\n format.html { redirect_to @catalog_supplier, notice: 'Supplier was successfully created.' }\n format.json { render :show, status: :created, location: @catalog_supplier }\n else\n format.html { render :new }\n format.json { render json: @catalog_supplier.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1120e906df8a6d0ffba23eb5c91d43f5",
"score": "0.6051352",
"text": "def create\n @category = Category.new(category_params)\n @category.save\n render json: { params: params, notice: 'Categoria registrada exitosamente' }\n end",
"title": ""
},
{
"docid": "2398a142df0082d2299652ce0ea677ac",
"score": "0.6013752",
"text": "def create\n if @category.save\n render json: @category, status: :created, location: @category\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "86c877fcf57fac89c1161f1ad8145fcf",
"score": "0.6009576",
"text": "def create\n @categoria = Categoria.new(categoria_params)\n if @categoria.save\n render json: @categoria\n else\n render json: @categoria.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "1185341ff27286507fc855a60e3b4a2d",
"score": "0.60074925",
"text": "def create\n category = @current_user.categories.create!(category_params)\n render json: { category: category }\n end",
"title": ""
},
{
"docid": "bf0849f42c2d7aa723ba0f780d8c1a1e",
"score": "0.59588814",
"text": "def user_category\n # byebug\n @user = User.where(contact: params[:contact]).first\n params[:category_ids].each do |category|\n @user.user_categories.create!(category_id: category, user_id: @user.id)\n end\n render json: {status: \"SUCCESS\", message: \"user-data\", data: \"category saved\"}, status: :ok\n end",
"title": ""
},
{
"docid": "21c26647e369f0459864797dfa407952",
"score": "0.59258956",
"text": "def create\n @supplier = Supplier.new(params[:supplier])\n\n respond_to do |format|\n if @supplier.save\n format.html { redirect_to @supplier, notice: 'Supplier was successfully created.' }\n format.json { render json: @supplier, status: :created, location: @supplier }\n else\n format.html { render action: \"new\" }\n format.json { render json: @supplier.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "204018fe38114e1be73978d1fe87c110",
"score": "0.59225416",
"text": "def create\n @incidentcategory = Incidentcategory.new(incidentcategory_params)\n\n if @incidentcategory.save\n json_response(@incidentcategory)\n else\n render json: @incidentcategory.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "ad5c2fa46134bb221f292643c1e719b1",
"score": "0.59094006",
"text": "def set_supplier_category\n @supplier_category = SupplierCategory.find(params[:id])\n end",
"title": ""
},
{
"docid": "357fd3fdb12ea999b2b343e978640283",
"score": "0.59023803",
"text": "def create\n @lab_supplier = LabSupplier.new(params[:lab_supplier])\n\n respond_to do |format|\n if @lab_supplier.save\n format.html { redirect_to @lab_supplier, notice: 'Lab supplier was successfully created.' }\n format.json { render json: @lab_supplier, status: :created, location: @lab_supplier }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lab_supplier.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6ab5c14866edd7ad9d5e5221320d1e52",
"score": "0.5877719",
"text": "def create\n @supplier = Supplier.new(params[:supplier])\n\n respond_to do |format|\n if @supplier.save\n format.html { redirect_to @supplier, :notice => 'Dobavljac je uspjesno kreiran.' }\n format.json { render :json => @supplier, :status => :created, :location => @supplier }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @supplier.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "48bc9a57e319eeb380bffeaf5b6b104f",
"score": "0.5870887",
"text": "def create\n category = Category.create(category_params)\n\n \n if category\n render json:{\n status: :created,\n category: category}\n else\n render json: { status: 500 }\n end\n end",
"title": ""
},
{
"docid": "abdab6de8f80c97efd3e9c0d6055142d",
"score": "0.5867803",
"text": "def create\n @men_shop_collection_category = MenShopCollectionCategory.new(men_shop_collection_category_params)\n\n respond_to do |format|\n if @men_shop_collection_category.save\n format.html { redirect_to @men_shop_collection_category, notice: 'Men shop collection category was successfully created.' }\n format.json { render :show, status: :created, location: @men_shop_collection_category }\n else\n format.html { render :new }\n format.json { render json: @men_shop_collection_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2878580e5f33843c517a82aafd2e23a0",
"score": "0.585168",
"text": "def create\n @category = Category.new(category_params)\n respond_to do |format|\n if @category.save\n format.html { redirect_to management_categories_path }\n format.json { render json: @category, status: :created }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d9ac308adda6de6b8ac1dde8045f2d78",
"score": "0.5848419",
"text": "def create\n if params[:categoria_producto]\n p = Producto.find(params[:producto_id])\n c = Categoria.find(params[:categoria_id])\n\n if p.categorias << c\n render json: c, status: :created\n else\n render json: {:errors => {categoria: [\"No se ha podido agregar categoria\"]}}, status: :unprocessable_entity\n end\n\n else\n @categoria = Categoria.new(parametros_categoria)\n\n if @categoria.save\n render json: @categoria, status: :created\n else\n render json: @categoria.errors, status: :unprocessable_entity\n end\n end\n end",
"title": ""
},
{
"docid": "2c7392d40bb4e56b19f1b745e1d60ee0",
"score": "0.5829047",
"text": "def set_supplier_category\n @supplier_category = SupplierCategory.find(params[:id])\n end",
"title": ""
},
{
"docid": "35daaf07196707a2fbbfd64afd54bd3c",
"score": "0.5826302",
"text": "def create\n @supplier = Supplier.new(supplier_params)\n\n respond_to do |format|\n if @supplier.save\n format.html { redirect_to @supplier, notice: 'Supplier was successfully created.' }\n format.json { render :show, status: :created, location: @supplier }\n else\n format.html { render :new }\n format.json { render json: @supplier.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "22142984b2c7062d0280d30955d9a6e8",
"score": "0.5823899",
"text": "def create\n @category = Category.new(category_params)\n authorize! :create, @category\n if @category.save\n render json: @category, status: :created\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "cc01d3076940a3c7e91a0f18004bacaf",
"score": "0.58097017",
"text": "def create\n category = Category.create!(category_params)\n render json: {\n :html => render_to_string(\n :partial => \"setups/category\",\n :layout => false,\n :locals => {:category => category})\n }\n end",
"title": ""
},
{
"docid": "a2eb56bb13efdee8f3016e9764b419f6",
"score": "0.5783833",
"text": "def create\n @supplier = current_user.suppliers.new(supplier_params)\n\n respond_to do |format|\n if @supplier.save\n @supplier.update(uid: \"s_\" + @supplier.id.to_s)\n @dis = @supplier.supplier_name.to_s + '$' + @supplier.supplier_address.to_s + '$' + @supplier.supplier_contact.to_s + '$' + @supplier.supplier_email.to_s\n \n Log.create!(description: @dis, username: current_user.name, uid: \"s_\" + @supplier.id.to_s, user_id: current_user.user_id)\n\n params[:paymentterm_description].each do | payment |\n @pt = PaymentTerm.find(payment)\n @pay = SupplierPaymentTerm.find_by(payment_term_id: payment, supplier_id: @supplier.id)\n if !@pay\n SupplierPaymentTerm.create(payment_term_description: @pt.paymentterm_description, supplier_id: @supplier.id, payment_term_id: payment)\n end\n end\n format.html { redirect_to suppliers_url, notice: 'Supplier was successfully created.' }\n format.json { render :show, status: :created, location: @supplier }\n else\n format.html { render :new }\n format.json { render json: @supplier.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b35aec93ae8d0606144c97a0ec4b9ad6",
"score": "0.5777476",
"text": "def create\n @categorization = Categorization.new(params[:categorization])\n @categories = category_list\n respond_to do |format|\n if @categorization.save\n format.html { redirect_to(admin_categorization_path(@categorization), :notice => 'Categorization was successfully created.') }\n format.xml { render :xml => @categorization, :status => :created, :location => @categorization }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @categorization.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "205785cb12d8abc8a9f2a3f8bb577427",
"score": "0.57723427",
"text": "def create\n @consumer_category = ConsumerCategory.new(params[:consumer_category])\n\n respond_to do |format|\n if @consumer_category.save\n format.html { redirect_to @consumer_category, notice: 'Consumer category was successfully created.' }\n format.json { render json: @consumer_category, status: :created, location: @consumer_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @consumer_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b94ebf604dad4a96628741ba83aa4ed4",
"score": "0.57719934",
"text": "def supplier_params\n params.require(:supplier).permit(:name, {:suppliertype_ids => []})\n end",
"title": ""
},
{
"docid": "597e735b8046df0eba42e7ead0c6d075",
"score": "0.57622063",
"text": "def create\n @product_category = ProductCategory.new(product_categories_params)\n\n respond_to do |format|\n if @product_category.save\n format.html { redirect_to admins_product_categories_path, :notice => 'Store category was successfully created.' }\n format.json { render :json => @product_category, :status => :created, :location => @product_category }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @product_category.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4e2fc4233fcf2cf364f52e9a65068d78",
"score": "0.5743192",
"text": "def create\n @store = Store.new(params[:store])\n @store.user_id = @user.id\n @store.categories = Category.find(params[:category_ids]) if params[:category_ids]\n respond_to do |format|\n if @store.save\n format.html { redirect_to(@store, :notice => 'Store was successfully created.') }\n format.xml { render :xml => @store, :status => :created, :location => @store }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @store.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "be6a54b6a863df02742feb70e1594b90",
"score": "0.5740604",
"text": "def create\n @desserts_category = DessertsCategory.new(desserts_category_params)\n\n respond_to do |format|\n if @desserts_category.save\n format.html { redirect_to @desserts_category}\n format.json { render :show, status: :created, location: @desserts_category }\n else\n format.html { render :new }\n format.json { render json: @desserts_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "27aed4b8af66efcc7516d6497295c201",
"score": "0.5735876",
"text": "def create\n @categoria_proveedor = CategoriaProveedor.new(categoria_proveedor_params)\n\n respond_to do |format|\n if @categoria_proveedor.save\n format.html { redirect_to @categoria_proveedor, notice: 'Categoria proveedor was successfully created.' }\n format.json { render :show, status: :created, location: @categoria_proveedor }\n else\n format.html { render :new }\n format.json { render json: @categoria_proveedor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7f7094198250528d00572ee5c7cc180c",
"score": "0.5732414",
"text": "def create\n \n @categorias_tipo = CatTipo.new(params[:cat_tipo])\n\n\t\trespond_to do |format|\n\t\t\tif @categorias_tipo.save\n \t\t\tcategories = @categorias_tipo.update_attributes(:tipo_acc_ids =>params[:tipo_accs])\n\t\t\t\t@categorias_tipo.update_attributes(:estado_ids =>params[:estados])\n\t\t\t\t\n\t\t\t\n\n format.html { redirect_to cat_tipos_path, notice: 'OK' }\n format.json { render json: @categorias_tipo, status: :created, location: @categorias_tipo }\n\t\t\telse\n format.html { render action: \"new\" }\n format.json { render json: @categorias_tipo.errors, status: :unprocessable_entity }\n \tend\t\n\t\tend\n\tend",
"title": ""
},
{
"docid": "ecf2badfca33f55423a2ca6db6a69073",
"score": "0.57259524",
"text": "def create\n @category = current_user.categories.new(name: params[:name])\n if @category.save\n render \"create.json.jbuilder\", status: :created\n else\n render json: { errors: @category.errors.full_messages }, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "2d83a5a67252eed38122490cb9a90711",
"score": "0.572129",
"text": "def create\n @expense = @current_user.expenses.create(params[:expense])\n params[:expense][:categories].each do |category_id|\n category_id = category_id.to_i\n if category_id > 0\n @expense.categories << Category.find(category_id)\n end\n end\n respond_to do |format|\n if @expense.save\n flash[:notice] = 'Expense was successfully created.'\n format.html { redirect_to(@expense) }\n format.xml { render :xml => @expense, :status => :created, :location => @expense }\n format.iphone { redirect_to(@expense) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @expense.errors, :status => :unprocessable_entity }\n format.iphone { render :action => \"new\" }\n end\n end\n end",
"title": ""
},
{
"docid": "ecf1bddecefbd4ff306151766049f8fb",
"score": "0.5720453",
"text": "def create\n @exhibitior_category = ExhibitiorCategory.new(params[:exhibitior_category])\n\n respond_to do |format|\n if @exhibitior_category.save\n format.html { redirect_to @exhibitior_category, notice: 'Exhibitior category was successfully created.' }\n format.json { render json: @exhibitior_category, status: :created, location: @exhibitior_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exhibitior_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1b057f6feef310937664c4f2cf2a16de",
"score": "0.5700577",
"text": "def create\n @category = current_mall.categories.new(params[:category])\n\n if @category.save\n render json: @category, status: :created\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "ee56bc5f186a04dec003319066681b4a",
"score": "0.5698531",
"text": "def create\n @technology = Technology.new(params[:technology])\n @categories = Category.find(:all)\n\n respond_to do |format|\n if @technology.save\n flash[:success] = 'Technology was successfully created.'\n format.html { redirect_to @technology }\n format.json { render json: @technology, status: :created, location: @technology }\n else\n format.html { render action: \"new\" }\n format.json { render json: @technology.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "d2b996c04540904f8ce0a2b7bdaf3760",
"score": "0.56967956",
"text": "def create\n @category = Category.create(params[:category])\n respond_with(@category, location: categories_url)\n end",
"title": ""
},
{
"docid": "b883c7b3bb7ca91a8a059c7d23b9c186",
"score": "0.56881183",
"text": "def create\n @catalog_category = CatalogCategory.new(catalog_category_params)\n\n respond_to do |format|\n if @catalog_category.save\n format.html { redirect_to catalog_categories_url }\n format.json { render :show, status: :created, location: @catalog_category }\n else\n format.html { render :new }\n format.json { render json: @catalog_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9eaa8c47bf1217eac58a330c4442e8c3",
"score": "0.56852305",
"text": "def create\n @categ = Categ.new(categ_params)\n\n respond_to do |format|\n if @categ.save\n format.html { redirect_to @categ, notice: 'Categ was successfully created.' }\n format.json { render :show, status: :created, location: @categ }\n else\n format.html { render :new }\n format.json { render json: @categ.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bd603f56fe0c77807e4b578848179255",
"score": "0.56789714",
"text": "def create\n @sys_category = Sys::Category.new(sys_category_params)\n\n respond_to do |format|\n if @sys_category.save\n format.html { redirect_to @sys_category, notice: 'Category was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sys_category }\n else\n format.html { render action: 'new' }\n format.json { render json: @sys_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "f08eddbb69357b9e5230ac47be83a7f1",
"score": "0.56708956",
"text": "def create\n @product_supplier = ProductSupplier.new(product_supplier_params)\n\n respond_to do |format|\n if @product_supplier.save\n format.html { redirect_to @product_supplier, notice: 'Product supplier was successfully created.' }\n format.json { render :show, status: :created, location: @product_supplier }\n else\n format.html { render :new }\n format.json { render json: @product_supplier.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ffb432a039928d76b38b5b5975d8d279",
"score": "0.5669815",
"text": "def create\n @specialization_category = SpecializationCategory.new(specialization_category_params)\n\n respond_to do |format|\n if @specialization_category.save\n format.html { redirect_to @specialization_category, notice: 'Specialization category was successfully created.' }\n format.json { render :show, status: :created, location: @specialization_category }\n else\n format.html { render :new }\n format.json { render json: @specialization_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ccf017f3f5ddbc96e26fb2ca064a9bd8",
"score": "0.56602526",
"text": "def create\n \n category = params[:category]\n category_name = category['name']\n \n write_log(\"category.to_s: #{category.to_s}\",\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s)\n \n cats = []\n if category_name != nil\n cats = category_name.split(\" \")\n end\n \n write_log(\"cats.size: #{cats.size}\",\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s)\n\n if cats.size > 1\n \n flag = true\n counter = 0\n \n cats.each do |cat|\n # @category = Category.new(params[:category])\n # @category = Category.new(name=cat)\n @category = Category.new({\"name\"=> cat, \"genre_id\"=> category['genre_id']})\n \n if @category.save\n else\n counter += 1\n end\n end#cats.each do |cat|\n \n respond_to do |format|\n format.html { redirect_to @category, \n notice: \"New categories: Created => #{cats.size - counter}, Failed => #{counter}\" }\n format.json { render json: @category, status: :created, location: @category }\n end\n \n else#if cats.size > 1\n @category = Category.new(params[:category])\n \n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end#if cats.size > 1\n \n \n # @category = Category.new(params[:category])\n# \n # respond_to do |format|\n # if @category.save\n # format.html { redirect_to @category, notice: 'Category was successfully created.' }\n # format.json { render json: @category, status: :created, location: @category }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @category.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"title": ""
},
{
"docid": "144ce5f1d55c79ca0265f9bfd1ac6788",
"score": "0.5641046",
"text": "def create\n @ledger_category = LedgerCategory.new(ledger_category_params)\n\n respond_to do |format|\n if @ledger_category.save\n format.html { redirect_to @ledger_category, notice: 'Ledger category was successfully created.' }\n format.json { render :show, status: :created, location: @ledger_category }\n else\n format.html { render :new }\n format.json { render json: @ledger_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9d615905b91b4f2f5f2509f1c79238b1",
"score": "0.5634439",
"text": "def create\n @suggested_category = SuggestedCategory.new(suggested_category_params)\n\n respond_to do |format|\n if @suggested_category.save\n format.html { redirect_to @suggested_category, notice: 'Suggested category was successfully created.' }\n format.json { render :show, status: :created, location: @suggested_category }\n else\n format.html { render :new }\n format.json { render json: @suggested_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "ca1f012e301495decc9cd669ea4b579e",
"score": "0.563295",
"text": "def create\n # @student_category = StudentCategory.new(params[:student_category])\n\n respond_to do |format|\n if @student_category.save\n format.html { redirect_to @student_category, notice: 'Student category was successfully created.' }\n format.json { render json: @student_category, status: :created, location: @student_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "41c14e51723fd357a3b1984c801c760b",
"score": "0.56321436",
"text": "def create\n @st_category = StCategory.new(st_category_params)\n\n respond_to do |format|\n if @st_category.save\n format.html { redirect_to @st_category, notice: 'St category was successfully created.' }\n format.json { render :show, status: :created, location: @st_category }\n else\n format.html { render :new }\n format.json { render json: @st_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0f0d7768a23a36b177dc85bc15ecce2e",
"score": "0.5631765",
"text": "def create\n @resource = Integral::Category.new(resource_params)\n\n if @resource.save\n flash[:notice] = notification_message('creation_success')\n render json: { redirect_url: request.referrer }, status: :created\n else\n render json: { message: notification_message('creation_failure') }, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "7cd57850e5f6508847c06550a08e746b",
"score": "0.5630869",
"text": "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to api_v1_categories_path, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "77d11ffb01943a7b1956dbcec1b1468a",
"score": "0.56274176",
"text": "def create\n # Create the new product object from the parameters received\n @product = Product.create(product_params)\n\n respond_to do |format|\n # Try and save the product to the database\n if @product.save\n update_nil_values(@product)\n # Product saved successfully. We will create the entry in the product_categories table\n @category = Category.find(params[:category_id])\n @product.product_categories.create(category: @category)\n\n # Redirect to the products list indicating success\n format.html { redirect_to admin_products_url, notice: 'Product was successfully added.' }\n else\n # Product did not save successfully. Redirect to the products list indicating failure\n\n # Retrieve the categories to display in the caterogy filter dropdown\n @all_categories = Category.order(:name)\n\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c5518d9f64c258ed1995759eea691465",
"score": "0.5622213",
"text": "def create\n @service_category = ServiceCategory.new(service_category_params)\n\n respond_to do |format|\n if @service_category.save\n format.html { redirect_to [:admin, @service_category], notice: 'Service category was successfully created.' }\n format.json { render :show, status: :created, location: [:admin, @service_category] }\n else\n format.html { render :new }\n format.json { render json: @service_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5a96ca15ce46b79e7b2a7c506ebb3ab9",
"score": "0.56187665",
"text": "def create\n @exhibitor_category = ExhibitorCategory.new(params[:exhibitor_category])\n\n respond_to do |format|\n if @exhibitor_category.save\n format.html { redirect_to @exhibitor_category, notice: 'Exhibitor category was successfully created.' }\n format.json { render json: @exhibitor_category, status: :created, location: @exhibitor_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exhibitor_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "faa751377df1bdc8802e743a005a2d89",
"score": "0.5617509",
"text": "def create\n @supplier = Supplier.new(params[:supplier])\n @reorder_url = reorder_suppliers_url\n respond_to do |format|\n if @supplier.save\n flash[:notice] = 'Supplier was successfully created.'\n format.html { \n redirect_to suppliers_url\n }\n format.xml { \n render :xml => @supplier, :status => :created, :location => @supplier\n }\n format.js {\n @suppliers = Supplier.paginate(:page => params[:page])\n }\n else\n flash[:notice] = \"Creating supplier failed due to errors.\"\n format.html { render :action => \"new\" }\n format.xml { render :xml => @supplier.errors, :status => :unprocessable_entity }\n format.js { render :action => 'new', :layout => false }\n end\n end\n end",
"title": ""
},
{
"docid": "9e60a49499568d70af62da9f36c8bbd2",
"score": "0.56171066",
"text": "def create\n @contractor_category = ContractorCategory.new(contractor_category_params)\n\n respond_to do |format|\n if @contractor_category.save\n format.html { redirect_to @contractor_category, notice: 'Contractor category was successfully created.' }\n format.json { render :show, status: :created, location: @contractor_category }\n else\n format.html { render :new }\n format.json { render json: @contractor_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "56c1d0ae36b21b9437a7182a6aea8212",
"score": "0.5610513",
"text": "def create\n @expense = Expense.new(params[:expense])\n unless @expense.date\n @expense.date = Time.now.to_s[0,10]\n end\n @expense.currency_id = Currency.find_by_name('Euro').id\n @expense.user_id = current_user.id\n @expense.categories = params[:categories].split(',')\n\n respond_to do |format|\n if @expense.save\n add_tagger_to_taggings(@expense)\n format.html { redirect_to @expense, notice: 'Expense was successfully created.' }\n format.json { render json: @expense, status: :created, location: @expense }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @expense.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"title": ""
},
{
"docid": "0f77fb611dba595ff3c08fb70b23822c",
"score": "0.56071705",
"text": "def create\n @category = CategoryService.create\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "7936576ed5eb494d88e910ff505f966f",
"score": "0.5604561",
"text": "def create\n @exercise_category = ExerciseCategory.new(params[:exercise_category].permit(:name, :organization_id))\n\n respond_to do |format|\n if @exercise_category.save\n format.html { redirect_to exercise_categories_path }\n format.json { render json: exercise_categories_path, status: :created, location: @exercise_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exercise_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "b22b22d7af574feaa42ae5f316cd4dd1",
"score": "0.5603683",
"text": "def destroy\n get_supplier\n @supplier_category = @supplier.categories.find(params[:id])\n @supplier_category.destroy\n end",
"title": ""
},
{
"docid": "1af9bf7b7259f2f3b991b3e901545e12",
"score": "0.560298",
"text": "def update\n get_supplier\n @supplier_category = @supplier.categories.find(params[:id])\n @supplier_category.update_attributes(params[:supplier_category])\n end",
"title": ""
},
{
"docid": "fb20ba00ef1871fa0d058a95ed641e4c",
"score": "0.5601998",
"text": "def create\n @company_category = CompanyCategory.new(company_category_params)\n\n respond_to do |format|\n if @company_category.save\n format.html { redirect_to @company_category, notice: 'Company category was successfully created.' }\n format.json { render :show, status: :created, location: @company_category }\n else\n format.html { render :new }\n format.json { render json: @company_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "04779fc6a7223751fb3e79f2b7a6f82c",
"score": "0.55996436",
"text": "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end",
"title": ""
},
{
"docid": "7909b37981ca31957b4ce3e8d604627c",
"score": "0.5595593",
"text": "def create\n @service_category = ServiceCategory.new(service_category_params)\n if current_user.role_id != Role.find_by_name(\"Super Admin\").id\n @service_category.company_id = current_user.company_id\n end\n\n respond_to do |format|\n if @service_category.save\n format.html { redirect_to service_categories_path, notice: 'Categoría de Servicios creada exitosamente.' }\n format.json { render action: 'show', status: :created, location: @service_category }\n else\n format.html { render action: 'new' }\n format.json { render json: @service_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "6352e6cfd64228e3aa3e08cbfcfd3286",
"score": "0.5589879",
"text": "def create\n @category = CategoryService.create(category_params)\n\n respond_to do |format|\n unless @category.errors.any?\n format.html { redirect_to backoffice_categories_path,\n notice: notification_alert('success', 'Created!', \"Category [#{@category.description}] was successfully created.\") \n }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "1e8730389416cdf13546829fdec3f638",
"score": "0.5588238",
"text": "def create\n @admin_category = Admin::Category.new(admin_category_params)\n\n respond_to do |format|\n if @admin_category.save\n format.html { redirect_to admin_categories_url }\n format.json { render :show, status: :created, location: @admin_category }\n else\n format.html { render :new }\n format.json { render json: @admin_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "dbeda129a02e042d34c608b028e3c1f9",
"score": "0.5581641",
"text": "def create\n @categor = Categor.new(categor_params)\n\n respond_to do |format|\n if @categor.save\n format.html { redirect_to @categor, notice: 'Categor was successfully created.' }\n format.json { render :show, status: :created, location: @categor }\n else\n format.html { render :new }\n format.json { render json: @categor.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a2db2cd9acaa67d60f732b71dbf42ccd",
"score": "0.5581358",
"text": "def create\n @categories_category_expense = manager.create(categories_category_expense_params, current_user)\n\n respond_to do |format|\n if @categories_category_expense.save\n format.html { redirect_to categories_category_expenses_path, notice: 'Category expense was successfully created.' }\n format.json { render :show, status: :created, location: @categories_category_expense }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @categories_category_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0eab0702132d325154b1e7d548080c49",
"score": "0.55804354",
"text": "def create\n @supplier = Supplier.find(params[:supplier_id])\n @service = @supplier.services.create(service_params)\n\n respond_to do |format|\n if @service.save\n format.html { redirect_to supplier_path(@supplier), notice: 'Service was successfully created.' }\n format.json { render action: 'show', status: :created, location: @service }\n else\n format.html { render action: 'new' }\n format.json { render json: @service.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9677240692641b3a9ccdc4b1644910ce",
"score": "0.55766463",
"text": "def create\n #Creates the category to be saved in the db\n @category = Category.new(params[:category])\n @all_categories = Category.all\n\n #Set Component Group to nil\n if([email protected]_id.nil?)\n @category.parent_id = nil\n end\n #Sets Component Group with new params\n if(!params[:parent_ids].nil?)\n for id in params[:parent_ids]\n @category.parent_id = id\n end\n end\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5de5c50d70e0fd847ed24c16bda92ad8",
"score": "0.5574875",
"text": "def create\n @vessel_category = VesselCategory.new(vessel_category_params)\n\n respond_to do |format|\n if @vessel_category.save\n format.html { redirect_to @vessel_category, notice: 'Vessel class was successfully created.' }\n format.js\n format.json { render action: 'show', status: :created, location: @vessel_category }\n else\n format.html { render action: 'new' }\n format.json { render json: @vessel_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "13d1e548845b79a29a4e7d385cc4201e",
"score": "0.55717355",
"text": "def create\n @fundstore_category = FundstoreCategory.new(fundstore_category_params)\n\n respond_to do |format|\n if @fundstore_category.save\n format.html { redirect_to @fundstore_category, notice: 'Fundstore category was successfully created.' }\n format.json { render :show, status: :created, location: @fundstore_category }\n else\n format.html { render :new }\n format.json { render json: @fundstore_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a9bb0b95827db9fc30498aa9e54e8945",
"score": "0.5570681",
"text": "def create\n @taxonomy_category = TaxonomyCategory.new(params[:taxonomy_category])\n\n respond_to do |format|\n if @taxonomy_category.save\n format.html { redirect_to @taxonomy_category, notice: 'Taxonomy category was successfully created.' }\n format.json { render json: @taxonomy_category, status: :created, location: @taxonomy_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @taxonomy_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "edb38383f7afc712016f35c9da7d8387",
"score": "0.55701286",
"text": "def create\n @pagetitle = \"New supplier\"\n \n @company = Company.find(params[:supplier][:company_id])\n @supplier = Supplier.new(params[:supplier])\n\n respond_to do |format|\n if @supplier.save\n format.html { redirect_to(@supplier, :notice => 'Supplier was successfully created.') }\n format.xml { render :xml => @supplier, :status => :created, :location => @supplier }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @supplier.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5837d290bdd84c55f9994396f2bcf113",
"score": "0.5569875",
"text": "def create\n @status_category = StatusCategory.new(status_category_params)\n\n respond_to do |format|\n if @status_category.save\n format.html { redirect_to @status_category, notice: 'Status category was successfully created.' }\n format.json { render :show, status: :created, location: @status_category }\n else\n format.html { render :new }\n format.json { render json: @status_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "78365872dc4e57667b9e56739b7a7c09",
"score": "0.5567098",
"text": "def create\n authorize Category\n @category = Category.new(staff_category_params)\n respond_to do |format|\n if @category.save\n format.html { redirect_to staff_categories_path, notice: \"Category '#{@category.name}' was successfully created.\" }\n else\n @categories = Category.order(:name)\n skip_policy_scope\n format.html { render :index }\n end\n end\n end",
"title": ""
},
{
"docid": "51492b8ff75cb5e495a353d57c0b6694",
"score": "0.5563115",
"text": "def create\n @spore_type_count = SporeTypeCount.new(spore_type_count_params)\n\n @category_count = [[\"Rare: 1 to 10\",\"Rare: 1 to 10\"], [\"Low: 11 to 100\",\"Low: 11 to 100\"], [\"Medium: 101 to 1000\",\"Medium: 101 to 1000\"], [\"High: > 1000\",\"High: > 1000\"]] \n @tape_bulk_coc = @spore_type_count.tape_bulk_coc_sample.tape_bulk_coc\n\n respond_to do |format|\n if @spore_type_count.save\n format.html { redirect_to tape_bulk_coc_path(@spore_type_count.tape_bulk_coc_sample.tape_bulk_coc), notice: 'Spore type count was successfully created.' }\n format.json { render :show, status: :created, location: @spore_type_count }\n format.js\n else\n format.html { render :new }\n format.json { render json: @spore_type_count.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e95f1f6af2bdcf1c50902fd452d21d76",
"score": "0.55628306",
"text": "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to admin_dashboard_categories_path, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e583069fdca2ff282b6231a47cb4e92d",
"score": "0.55613625",
"text": "def create\n @category_classified = CategoryClassified.new(category_classified_params)\n\n respond_to do |format|\n if @category_classified.save\n format.html { redirect_to @category_classified, notice: 'Category classified was successfully created.' }\n format.json { render :show, status: :created, location: @category_classified }\n else\n format.html { render :new }\n format.json { render json: @category_classified.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8f9d854eb99560a286523f06e406f8fd",
"score": "0.5558654",
"text": "def create\n @category = @current_branch.categories.build(category_params)\n @category.shop = @current_shop\n respond_to do |format|\n if @category.save\n format.html { redirect_to backend_shop_branch_category_path(@current_shop.slug, @current_branch, @category), notice: t('Category was successfully created.') }\n format.json { render action: 'show', status: :created, location: @category }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "39b67a4cacb8455d77838fa69d723267",
"score": "0.555242",
"text": "def create\n @supplier = Supplier.find(params[:supplier_id])\n @product = @supplier.products.build(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @supplier, :notice => 'Product was successfully created.' }\n format.json { render :json => @product, :status => :created, :location => @product }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5a11e4328eef30f6dfb07b98998dd87f",
"score": "0.5550874",
"text": "def postEntityCategory( entity_id, category_id, category_type)\n params = Hash.new\n params['entity_id'] = entity_id\n params['category_id'] = category_id\n params['category_type'] = category_type\n return doCurl(\"post\",\"/entity/category\",params)\n end",
"title": ""
},
{
"docid": "a9cecc601e7e9c8566833bc1f08144a0",
"score": "0.55410516",
"text": "def create\n init = params[:category][:name][0]\n division = Division.find_by_name(params[:division_id].upcase)\n category_number = Category.create_number(params)\n @category = Category.new(category_params.merge(:code => (('%03d' % ((Category.last.code.to_i rescue 0)+1)))).merge(:division_id => division.id))\n if @category.save\n flash[:notice] = 'Category was successfully added'\n redirect_to categories_path\n else\n flash[:error] = @category.errors.full_messages\n render \"new\"\n end\n end",
"title": ""
},
{
"docid": "37866dac257fb22ce860fe872438bef3",
"score": "0.55403906",
"text": "def create\n @delivery_category = DeliveryCategory.new(params[:delivery_category])\n\n respond_to do |format|\n if @delivery_category.save\n format.html { redirect_to admin_delivery_category_path(@delivery_category), notice: 'Delivery category was successfully created.' }\n format.json { render json: @delivery_category, status: :created, location: @delivery_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @delivery_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "001b2379964b352954d0029c3e75b809",
"score": "0.55388194",
"text": "def create\n @pcategory = Pcategory.new(params[:pcategory])\n\n respond_to do |format|\n if @pcategory.save\n format.html { redirect_to @pcategory, notice: 'La categoria se creo satisfactoriamente.' }\n format.json { render json: @pcategory, status: :created, location: @pcategory }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pcategory.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "a67d847b8ba17a2a5d302476bcc5b525",
"score": "0.5533642",
"text": "def create\n @data_collection = DataCollection.new\n @data_collection.name = params[:data_collection][:name]\n @data_collection.description = params[:data_collection][:description]\n @data_collection.institution = params[:data_collection][:institution]\n @data_collection.collection_name = params[:data_collection][:collection_name]\n @data_collection.country_id = params[:data_collection][:country_id]\n @data_collection.province_id = params[:data_collection][:province_id]\n @data_collection.city_id = params[:data_collection][:city_id]\n\n params[:categories].each do |category|\n\n collection_category = DataCollectionCategory.new\n collection_category.data_collection = @data_collection\n collection_category.category_id = category\n collection_category.save\n\n end\n\n respond_to do |format|\n if @data_collection.save\n format.html { redirect_to importador_csv_path (@data_collection.id), notice: 'Data collection was successfully created.' }\n format.json { render action: 'show', status: :created, location: @data_collection, params:data_collection_params }\n else\n format.html { render action: 'new' }\n format.json { render json: @data_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "c0609739ff24c602aed68ecc9f256a4f",
"score": "0.5522896",
"text": "def create\n @cathegory = Cathegory.new(cathegory_params)\n\n respond_to do |format|\n if @cathegory.save\n format.html { redirect_to @cathegory, notice: 'Cathegory was successfully created.' }\n format.json { render :show, status: :created, location: @cathegory }\n else\n format.html { render :new }\n format.json { render json: @cathegory.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "322fe54c5f0703666a77da532d2fb062",
"score": "0.5521008",
"text": "def category_params\n params.require(:category).permit(:title, :handle, :shopify_collection_id, :collection_id)\n end",
"title": ""
},
{
"docid": "a4d3c7929c9edd023fc989c7c45e3b42",
"score": "0.5519576",
"text": "def create\n @categorialivro = Categorialivro.new(params[:categorialivro])\n\n respond_to do |format|\n if @categorialivro.save\n format.html { redirect_to @categorialivro, :notice => 'Categorialivro was successfully created.' }\n format.json { render :json => @categorialivro, :status => :created, :location => @categorialivro }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @categorialivro.errors, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9edc4a628be55b5a37d2774023caee92",
"score": "0.5516265",
"text": "def create\n @vendor_category = VendorCategory.new(vendor_category_params)\n\n respond_to do |format|\n if @vendor_category.save\n format.html { redirect_to @vendor_category, notice: 'Vendor category was successfully created.' }\n format.json { render :show, status: :created, location: @vendor_category }\n else\n format.html { render :new }\n format.json { render json: @vendor_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "119d7537481ded1917fee9c077b6f6aa",
"score": "0.5512936",
"text": "def create\n @prod_category = ProdCategory.new(prod_category_params)\n\n respond_to do |format|\n if @prod_category.save\n format.html { redirect_to @prod_category, notice: 'Prod category was successfully created.' }\n format.json { render :show, status: :created, location: @prod_category }\n else\n format.html { render :new }\n format.json { render json: @prod_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "8062bc4891a59ddaa415a9722f69f3ad",
"score": "0.5505668",
"text": "def create\n @brand_category = BrandCategory.new(brand_category_params)\n\n if @brand_category.save\n render json: @brand_category, status: :created, location: @brand_category\n else\n render json: @brand_category.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "e1630470525a0fab8e9ce98ae36a50e5",
"score": "0.5497792",
"text": "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to admin_category_path(@category), notice: 'Category was successfully created.' }\n format.json { render action: 'show', status: :created, location: @category }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "980030b2526f298cde780e5f4f4c08d5",
"score": "0.54966974",
"text": "def create\n notice = 'Category created successfully.'\n error = 'Could not create Category.'\n \n @shop_category.attributes = params[:shop_category]\n \n begin\n @shop_category.save!\n \n respond_to do |format|\n format.html {\n redirect_to [:edit_admin, @shop_category] if params[:continue]\n redirect_to admin_shop_categories_path unless params[:continue]\n }\n format.js { render :partial => '/admin/shop/categories/index/category', :locals => { :product => @shop_category } }\n format.json { render :json => @shop_category.to_json }\n end\n rescue Exception => error\n respond_to do |format|\n format.html { \n flash[:error] = error\n render :new\n }\n format.js { render :text => error, :status => :unprocessable_entity }\n format.json { render :json => { :error => error }, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
c7fb724858446d5b6a1d70e6f5d1f1d3
|
setup form context to allow child components like inputs to access the form configuration
|
[
{
"docid": "a2f4850bfc46d4be166872252fe27bc1",
"score": "0.6145664",
"text": "def initialize(html_tag = nil, text = nil, options = {}, &block)\n previous_form_context = Matestack::Ui::VueJs::Components::Form::Context.form_context\n Matestack::Ui::VueJs::Components::Form::Context.form_context = self\n super(html_tag, text, options, &block)\n Matestack::Ui::VueJs::Components::Form::Context.form_context = previous_form_context\n end",
"title": ""
}
] |
[
{
"docid": "adcf99ccfd064a0e96428363c9ccc1ed",
"score": "0.7157151",
"text": "def context\n unless @instance_context\n @instance_context = FormContext.new(@version , @params['form_type'])\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "a11b4951823ec11fc676569ee161a582",
"score": "0.7027681",
"text": "def context\n unless @instance_context\n @instance_context = FormContext.new(@version, @params['form_type'], )\n end\n @instance_context\n end",
"title": ""
},
{
"docid": "6202aee254ea117ff0e39be3778aab0a",
"score": "0.69229347",
"text": "def form_setup\n\tend",
"title": ""
},
{
"docid": "b3b09a9c9c1a6edc630c5ca12336afc3",
"score": "0.68474287",
"text": "def set_form\n end",
"title": ""
},
{
"docid": "9ae3acbbaab7e651b22a36864b8c9f67",
"score": "0.65694964",
"text": "def init_forms\n if ! @fw.nil?\n # was already called in child class - do not re-init forms\n return\n end\n\n @form_params = {}\n\n @fw = FrameWork.new\n\n @co = ConfigOptions.new\n @fw = @co.get_fw_forms_specs(@fw)\n end",
"title": ""
},
{
"docid": "163912cf5be0146a50d793fc184ec343",
"score": "0.6478795",
"text": "def initialize(context, form)\n self.context = context\n self.form = form\n self.url = CGI.unescapeHTML(form[\"action\"])\n self.inputs = []\n self.submits = []\n fill_in_initial_values!\n end",
"title": ""
},
{
"docid": "60682dbd3a48f35bff989686901abfb1",
"score": "0.638813",
"text": "def get_form_config\n @form[@name]\n end",
"title": ""
},
{
"docid": "8e1e5f0e82f9a2ead8b78b0878a034c5",
"score": "0.6328746",
"text": "def form(*args, &blk)\n _singleton_form_context.form(*args, &blk)\n end",
"title": ""
},
{
"docid": "e959365b92511d774b90fa980ba3a147",
"score": "0.63116765",
"text": "def form(*arguments)\n instance = DSL::Form.new(*arguments)\n yield instance\n form = Configure::Form.new(*instance.data)\n @configure.forms << form\n form\n end",
"title": ""
},
{
"docid": "f0f3730af288f32a2791604031612511",
"score": "0.6295965",
"text": "def form_attributes_config\n {}\n end",
"title": ""
},
{
"docid": "6ac85f42ac76cc1eaf8d0ef3c9b0206b",
"score": "0.6273389",
"text": "def initialize(p_form, p_parent)\n\t\t\t@form = p_form\n\t\t\t@parent = p_parent\n super(p_parent)\n\n # Initialize attributes\n @@settings = nil\n @configuration = nil\n end",
"title": ""
},
{
"docid": "96f116d7c679874332863e93010012fc",
"score": "0.62360036",
"text": "def element_form(context={}, aspect_model)\n \n app = context[:app]\n \n renderer = ::UI::FieldSetRender.new('hobbies', app) \n contact_form = renderer.render('form', 'em') \n \n end",
"title": ""
},
{
"docid": "499754b85b6cac37c74fd8230263c836",
"score": "0.6204546",
"text": "def prepare_and_render_form\n # this method lives in the QuestionFormable concern\n setup_qing_form_support_objs\n render(:form)\n end",
"title": ""
},
{
"docid": "499754b85b6cac37c74fd8230263c836",
"score": "0.6204546",
"text": "def prepare_and_render_form\n # this method lives in the QuestionFormable concern\n setup_qing_form_support_objs\n render(:form)\n end",
"title": ""
},
{
"docid": "8c6aeb937195e0fc5e9b92b872768107",
"score": "0.61971223",
"text": "def element_form(context={}, aspect_model)\n \n app = context[:app]\n \n renderer = ::UI::FieldSetRender.new('event', app) \n contact_form = renderer.render('form', 'em') \n \n end",
"title": ""
},
{
"docid": "bba18ce8c06d8aedb2e09eafe9cb06dc",
"score": "0.6188211",
"text": "def element_form(context={}, aspect_model)\n \n app = context[:app]\n \n renderer = ::UI::FieldSetRender.new('resourceaccesscontrol', app) \n contact_form = renderer.render('form', 'em') \n \n end",
"title": ""
},
{
"docid": "7b925c8e8425b395a2381339630d8b0e",
"score": "0.6182931",
"text": "def initialize(form, attributes, context = nil, params = nil, &blk)\n super()\n\n @context = context\n @blk = blk\n @verb = nil\n @csrf_token = nil\n\n # Nested form\n if @context.nil? && attributes.is_a?(Values)\n @values = attributes\n @attributes = {}\n @name = form\n else\n @form = form\n @name = form.name\n @values = Values.new(form.values, params || @context.params)\n @attributes = attributes\n @verb_method = verb_method\n @csrf_token = csrf_token\n end\n end",
"title": ""
},
{
"docid": "1bb75ae7f6853a99f76e7f0932a0916f",
"score": "0.61808366",
"text": "def process_options\n\t\t# set the scope names\n\t\t@slot_scope = @options.delete(:slot_scope) || SLOT_SCOPE\n\t\t@parent_scope = @options.delete(:parent_scope)\n\n\t\t# this is a step if it says it is or the form is a wizard\n\t\t@is_step = @options.has_key?(:is_step) ? @options[:is_step] : @form_builder.options[:wizard]\n\t\t@in_step = @options.has_key?(:in_step) ? @options[:in_step] : @form_builder.options[:in_wizard]\n\n\t\t# get the after method information\n\t\t@after_method = @options.delete(:after_method) || @options.delete(:after_content)\n\t\t@after_method_args = @options.delete(:after_method_args)\n\n\t\t#merge in place because this is the options object that's given to the input\n\t\t@input_options.reverse_merge!(input_options)\n\t\t#get the options for the other parts of the field\n\t\t@error_wrapper_options = error_wrapper_options\n\t\t@error_inner_options = error_inner_options\n\t\t@label_options = label_options\n\tend",
"title": ""
},
{
"docid": "2541ea95eafd7f40aa2c00fe65afb1c1",
"score": "0.6173752",
"text": "def element_form(context={}, aspect_model)\n \n app = context[:app]\n \n renderer = ::UI::FieldSetRender.new('contact', app) \n contact_form = renderer.render('form', 'em') \n \n end",
"title": ""
},
{
"docid": "5bb2576149fb276191bc23fa234bc576",
"score": "0.6110783",
"text": "def attributes\n super.merge(embeddable_forms: embeddable_forms_config)\n end",
"title": ""
},
{
"docid": "979ade0fa6c6edb3d6393690e2f55101",
"score": "0.60572815",
"text": "def configure(req, form)\n set_values_from_form(form)\n save\n true\n end",
"title": ""
},
{
"docid": "7f7bff472dd94cc9cebcd46a549c4f1b",
"score": "0.6036654",
"text": "def prepare_and_render_form\n @options = Option.accessible_by(current_ability).all\n render(:form)\n end",
"title": ""
},
{
"docid": "9cb8c2e5bd7c4711bd23bcd98a46923d",
"score": "0.602436",
"text": "def set_form(easy)\n end",
"title": ""
},
{
"docid": "77dcaf41048cfedf0b722737ca7eb34c",
"score": "0.6021522",
"text": "def initialized_edit_form\n form_class.from_intake(current_intake)\n end",
"title": ""
},
{
"docid": "9b0c1fc206916b14eff6fdfeeca9c99f",
"score": "0.6021387",
"text": "def _forme_form_options(obj, attr, opts)\n super\n\n opts[:_after] = lambda do |form|\n if (obj = form.opts[:obj]) && obj.respond_to?(:forme_inputs) && (forme_inputs = obj.forme_inputs)\n columns = []\n valid_values = {}\n\n forme_inputs.each do |field, input|\n next unless col = obj.send(:forme_column_for_input, input)\n col = col.to_s\n columns << col\n\n next unless validation = obj.send(:forme_validation_for_input, field, input)\n validation[0] = validation[0].to_s\n has_nil = false\n validation[1] = validation[1].map do |v|\n has_nil ||= v.nil?\n v.to_s\n end\n validation[1] << nil if has_nil\n valid_values[col] = validation\n end\n\n return if columns.empty?\n\n data = {}\n data['columns'] = columns\n data['namespaces'] = form.opts[:namespace]\n data['csrf'] = form.opts[:csrf]\n data['valid_values'] = valid_values unless valid_values.empty?\n data['form_version'] = form.opts[:form_version] if form.opts[:form_version]\n\n data = data.to_json\n form.tag(:input, :type=>:hidden, :name=>:_forme_set_data, :value=>data)\n form.tag(:input, :type=>:hidden, :name=>:_forme_set_data_hmac, :value=>OpenSSL::HMAC.hexdigest(OpenSSL::Digest::SHA512.new, self.class.opts[:forme_set_hmac_secret], data))\n end\n end\n end",
"title": ""
},
{
"docid": "2f406f6a8452b1f928df627bb2bd17d0",
"score": "0.60058707",
"text": "def additional_form_locals\n {}\n end",
"title": ""
},
{
"docid": "2f406f6a8452b1f928df627bb2bd17d0",
"score": "0.60058707",
"text": "def additional_form_locals\n {}\n end",
"title": ""
},
{
"docid": "8901875ac94dd08ee3393a045e997b76",
"score": "0.5956004",
"text": "def configure_field\n end",
"title": ""
},
{
"docid": "8901875ac94dd08ee3393a045e997b76",
"score": "0.5956004",
"text": "def configure_field\n end",
"title": ""
},
{
"docid": "8737abb4445776d07b8211e4221a51ca",
"score": "0.59394926",
"text": "def configure_field\n end",
"title": ""
},
{
"docid": "4c5ddadeffb8658af85b4d31d78c26f0",
"score": "0.5936657",
"text": "def form; end",
"title": ""
},
{
"docid": "975245dc3818b5dec438eff522ae6f03",
"score": "0.5901495",
"text": "def initialize(form)\r\n @form = form\r\n end",
"title": ""
},
{
"docid": "86b9bd05afc8764a205e0bc9531c2e2d",
"score": "0.5879215",
"text": "def fields_for(name, attrs = {}, &blk)\n attrs ||= {}\n with_form_context(name, attrs.delete(:builder)) do\n current_form_context.concat(attrs, &blk)\n end\n end",
"title": ""
},
{
"docid": "dd61af3399963ff8b505a8f80ff0a7b2",
"score": "0.5878772",
"text": "def xx_form_with(**options, &block)\n options[:model] = ActiveSupport::InheritableOptions.new(_values.symbolize_keys) unless options.key?(:model)\n\n form_with(**options, &block)\n end",
"title": ""
},
{
"docid": "f4ed829cddb096176f6303724758649e",
"score": "0.5878273",
"text": "def set_form\n @form = FormKit::Form.find(params[:form_id])\n end",
"title": ""
},
{
"docid": "5e0df3b983d184443617811fcdf50793",
"score": "0.5877517",
"text": "def set_form\n @form = @workflow.form\n end",
"title": ""
},
{
"docid": "9687eb1ffe07f0f8a313da9f70820cc1",
"score": "0.58722246",
"text": "def embeddable_forms_config\n @attributes[:embeddable_forms].to_h.map { |key, attrs|\n [key, attrs.merge(form: attrs[:form].to_ast)]\n }.to_h\n end",
"title": ""
},
{
"docid": "f8dbf5ccce4688fb90cc52b3576ba183",
"score": "0.58691585",
"text": "def initialized_update_form\n form_class.new(current_intake, form_params)\n end",
"title": ""
},
{
"docid": "f8dbf5ccce4688fb90cc52b3576ba183",
"score": "0.58691585",
"text": "def initialized_update_form\n form_class.new(current_intake, form_params)\n end",
"title": ""
},
{
"docid": "a2b883324cfd84e28a4bcc48fe002abe",
"score": "0.5863692",
"text": "def uhook_ubiquo_setting_form form\n ''\n end",
"title": ""
},
{
"docid": "03e61f9e27fe1ec55708996009354bda",
"score": "0.58533835",
"text": "def setup_resources\n defaults = {\n :asset_map => asset_map,\n :template_map => template_map,\n :asset_class => asset_class,\n :cloneable => cloneable?\n }\n @form = OregonDigital::Metadata::IngestFormContainer.new(params.merge(defaults))\n end",
"title": ""
},
{
"docid": "c50f72808a75c8e197bb8cf2fd0c1ed0",
"score": "0.5846021",
"text": "def form_object(obj)\n @page_config.form_object = obj\n end",
"title": ""
},
{
"docid": "a1ed6915f561cd6c47ca7efaa8a115e9",
"score": "0.58318865",
"text": "def initialize object_name, object, template, options\n options[:html]||={}\n html = options[:html]\n @form_class = options[:class]\n html[:class]=\"#{html[:class]} #{@form_class}\"\n html[:role]=\"form\"\n html[:autocomplete]||='off'\n html[:id]=options[:id] if options[:id]\n @builder_container = options[:parent_builder] || self\n if parent?\n @validations = {}\n html[:id]||=\"#{object_name}_#{object.object_id}\"\n @parent_id = html[:id]\n end\n super object_name, object, template, options\n end",
"title": ""
},
{
"docid": "fb500befe75c80fba9c6057d006bb14d",
"score": "0.5826785",
"text": "def default_form_builder; end",
"title": ""
},
{
"docid": "7d9bfbe1fd1e10925271d671e1367777",
"score": "0.582345",
"text": "def form_config(binding: nil)\n return @form_config if @form_config\n\n raise AppNotFound, \"This app does not exist under the directory '#{root}'\" unless root.directory?\n file = form_file(root: root)\n raise AppNotFound, \"This app does not supply a form file under the directory '#{root}'\" unless file\n hsh = read_yaml_erb(path: file, binding: binding)\n if sub_app\n file = form_file(root: sub_app_root, name: sub_app)\n raise AppNotFound, \"This app does not supply a sub app form file under the directory '#{sub_app_root}'\" unless file\n hsh = hsh.deep_merge read_yaml_erb(path: file, binding: binding)\n end\n @form_config = hsh\n rescue AppNotFound => e\n @validation_reason = e.message\n return {}\n rescue StandardError, Exception => e\n @validation_reason = \"#{e.class.name}: #{e.message}\"\n return {}\n end",
"title": ""
},
{
"docid": "62a6ef2b7c19c3e9f88743f7edba1b63",
"score": "0.5815224",
"text": "def view_users_form(context)\n extend_form(context)\n end",
"title": ""
},
{
"docid": "4371253eee0adc8c4ef458f90e917cea",
"score": "0.5807374",
"text": "def form_for(name, *args, &block)\n options = args.extract_options!\n # substitute our own form builder for the default one\n super(name, *(args << options.merge(:builder => StandardFormBuilder)), &block)\n end",
"title": ""
},
{
"docid": "8c46e2c1c5cd7641496bbf03b074a0f7",
"score": "0.5799794",
"text": "def initialize( container, how, what )\n @container = container\n @formHow = how\n @formName = what\n \n log \"Get form formHow is #{@formHow} formName is #{@formName} \"\n count = 1\n doc = @container.document\n doc.forms.each do |thisForm|\n next unless @form == nil\n\n wrapped = FormWrapper.new(thisForm)\n\n log \"form on page, name is \" + wrapped.name\n \n @form =\n case @formHow\n when :name \n wrapped.name == @formName ? thisForm : nil\n when :id\n wrapped.id == @formName.to_s ? thisForm : nil\n when :index\n count == @formName.to_i ? thisForm : nil\n when :method\n wrapped.method.downcase == @formName.downcase ? thisForm : nil\n when :action\n @formName.matches(wrapped.action) ? thisForm : nil\n else\n raise MissingWayOfFindingObjectException\n end\n count = count +1\n end\n \n super(@form)\n \n copy_test_config container\n end",
"title": ""
},
{
"docid": "56b4dc7e7baae191072ca7bb15c51aa5",
"score": "0.5786908",
"text": "def prepare_form\r\n @secret = CaptchaSecret.create!(:timestamp => DateTime.now)\r\n @encrypted_attributes = encrypt_attributes(@list_of_attributes|@list_of_additional_attributes)\r\n \r\n $captcha_techniques.each { |technique| technique.prepare_form if technique.respond_to?(\"prepare_form\") }\r\n end",
"title": ""
},
{
"docid": "0a9acaaa6140aa91d0ebb5c6cd37195d",
"score": "0.5783709",
"text": "def form_fields\n @form_fields ||= RademadeAdmin::Model::Configuration::FormFields.new\n end",
"title": ""
},
{
"docid": "328d13e0f2892411f9c30270bf85c62d",
"score": "0.57805216",
"text": "def initialize(form)\n @form = form\n end",
"title": ""
},
{
"docid": "1415d4a21f83a2dace424b4a23cf8266",
"score": "0.57764167",
"text": "def baseForm\n\t@baseForm ||=BaseForm.new\nend",
"title": ""
},
{
"docid": "1415d4a21f83a2dace424b4a23cf8266",
"score": "0.57764167",
"text": "def baseForm\n\t@baseForm ||=BaseForm.new\nend",
"title": ""
},
{
"docid": "b4a04b8249603d5d38b0f808a48a190e",
"score": "0.5775623",
"text": "def setup\n DataMetaForm::Fmt.loadFormRules\n end",
"title": ""
},
{
"docid": "479e0da8fdaa99af4bc059d7f5c1a4a7",
"score": "0.5774678",
"text": "def render_nested_form(associated, opts = {})\n opts[:fields_for] = { :builder => KingForm::Builder::DefinitionList, :config => @config }\n super(associated, opts)\n end",
"title": ""
},
{
"docid": "c16ec1a64caad3d06c73f24ad7f574a4",
"score": "0.5771529",
"text": "def context\n return @context unless @context.nil?\n @context = @client.context(@base_form, @index)\n end",
"title": ""
},
{
"docid": "e2998c1905cd6bb84ea2c88d0992dbb0",
"score": "0.57691884",
"text": "def pre_form\n\n end",
"title": ""
},
{
"docid": "abd99cfb4193343a3c1210c46f710a60",
"score": "0.5764586",
"text": "def setup_form\n if action_name == 'new' && curation_concern.respond_to?(:contributor)\n curation_concern.contributor << current_user.name if curation_concern.contributor.empty? && !current_user.can_make_deposits_for.any?\n end\n curation_concern.record_editors << current_user.person if curation_concern.record_editors.blank? && action_name == 'new'\n curation_concern.record_editors.build\n curation_concern.record_editor_groups.build\n curation_concern.record_viewers.build\n curation_concern.record_viewer_groups.build\n end",
"title": ""
},
{
"docid": "719ebc45a368c3232985c33b7742bdc2",
"score": "0.5761555",
"text": "def initialize(attribute, options, form_builder, template)\n\t\t@attribute = attribute\n\t\t@form_builder = form_builder\n\t\t@input_options = options\n\n\t\t#easy access\n\t\t@template = template\n\t\t@object = form_builder.object\n\t\t@object_name = @form_builder.object_name\n\n\t\t@options = HashWithIndifferentAccess.new(options.delete(:field_options) || {}).merge(options.extract! *FIELD_OPTIONS)\n\t\tdo_setup\n\tend",
"title": ""
},
{
"docid": "a1163492845f095474e1d262f6f26c62",
"score": "0.5734902",
"text": "def set__form\n @_form = Form.find(params[:id])\n end",
"title": ""
},
{
"docid": "609879d610a4b29be18441958d6df42c",
"score": "0.5731704",
"text": "def form_options\n opts = {}\n\n # Do we need this ?\n # opts[:klass] = node.master_class(ActiveRecord::Base).to_s\n\n if @context[:in_add]\n opts[:id] = \"#{node.dom_prefix}_add\"\n opts[:style] = 'display:none;'\n elsif @markup.tag == 'table'\n # the normal id goes to the form wrapping the table\n opts[:id] = \"#{node.dom_prefix}_tbl\"\n form_id = node.dom_prefix\n end\n\n form_id ||= \"#{node.dom_prefix}_form_t\"\n if @context[:template_url]\n opts[:form_tag] = \"<% remote_form_for(:#{node.form_name}, #{node}, :html => {:id => #{form_id.inspect}}) do |f| %>\"\n opts[:form_helper] = 'f'\n else\n opts[:form_tag] = \"<% form_for(:#{node.form_name}, #{node}, :html => {:id => #{form_id.inspect}}) do |f| %>\"\n opts[:form_helper] = 'f'\n end\n\n opts\n end",
"title": ""
},
{
"docid": "dae6a60098f7b2896cd2bb195d6e1574",
"score": "0.5721425",
"text": "def set_form_wrapper\n @form_wrapper = FormWrapper.find(params[:id])\n end",
"title": ""
},
{
"docid": "95c512e74df12e1a99f52b3295e88b50",
"score": "0.57154155",
"text": "def with_form_context model, &block\n form_context.push model\n result = yield\n form_context.pop\n result\n end",
"title": ""
},
{
"docid": "d9c57d4d76a4ed4b3b57a04a1d8f5942",
"score": "0.5710382",
"text": "def form_params\n FormParamsController.instance\n end",
"title": ""
},
{
"docid": "c38225f703eec616c36d35bc80eecea5",
"score": "0.5695715",
"text": "def initialize(form_object)\n @form_object = form_object\n end",
"title": ""
},
{
"docid": "c38225f703eec616c36d35bc80eecea5",
"score": "0.5695715",
"text": "def initialize(form_object)\n @form_object = form_object\n end",
"title": ""
},
{
"docid": "5fef068d5f7922473da1bc3020cdb221",
"score": "0.56883",
"text": "def set_form_input(args)\n set_types_collection(args)\n set_circles_collection\n set_form_values\n end",
"title": ""
},
{
"docid": "b5b699f9c0408709a59dfc8c09105b94",
"score": "0.5673607",
"text": "def fill_form_with(attributes)\n fill_title_input_with attributes[\"title\"]\n fill_description_input_with attributes[\"description\"]\n fill_summary_input_with attributes[\"summary\"]\n # fill_youtube_link_with attributes[\"youtube_link\"]\n # fill_category_input_with attributes[:category]\n end",
"title": ""
},
{
"docid": "277b1f5ba3e811a14d230e6d91367f92",
"score": "0.56556755",
"text": "def preconfigure_record_window(c)\n super\n c.form_config.klass = UserForm\n end",
"title": ""
},
{
"docid": "13cc55742e33ba99e3e0ea83a472d934",
"score": "0.5654761",
"text": "def get_form_parameters\n \t {}\n end",
"title": ""
},
{
"docid": "4749928a41335f66bf0843e25b1b2053",
"score": "0.56346035",
"text": "def attach_form c\n c.form = @form\n c.override_graphic @graphic\n c.parent_component = self\n end",
"title": ""
},
{
"docid": "08a2eda4126c3f6c8e412beff251c798",
"score": "0.5632857",
"text": "def set_form\n @form = ::Form.in_account(current_user.account.id).find(params[:form_id])\n end",
"title": ""
},
{
"docid": "89d9edd4e7f70eb5af5464227663f06c",
"score": "0.56312114",
"text": "def init_forms\n @fw = FrameWork.new\n @ir = InterfaceResults.new\n\n @optgroup = \"test_packaging\"\n init_fields\n end",
"title": ""
},
{
"docid": "a7c93859447254385e4fcc8fc0b6e4ab",
"score": "0.562135",
"text": "def form\n @form ||= OpenStruct.new\n end",
"title": ""
},
{
"docid": "ec713a7fdbf686e30d67d506c76dab24",
"score": "0.5606911",
"text": "def initialize(instance)\n @form = instance.form_version.form\n @instance = instance\n @is_new = @instance.id.nil?\n @controls = []\n form_metadata = FD::Metadata::Form.new(instance.form_version.metadata)\n @tree, @controls = build_tree(form_metadata)\n @connections = build_connections(form_metadata)\n end",
"title": ""
},
{
"docid": "e30b32b68b191eaa8d43f3cdd00f0934",
"score": "0.56017065",
"text": "def set_form_field_input\n @form_field_input = FormFieldInput.find(params[:id])\n end",
"title": ""
},
{
"docid": "0c1898c6251af1884ba58cda844b7829",
"score": "0.55911905",
"text": "def before_form_yield\n # _before_post and _before hooks are only for internal use\n opts[:_before_post].call(self) if opts[:_before_post] && post?\n opts[:_before].call(self) if opts[:_before]\n\n # before hook is for external use\n opts[:before].call(self) if opts[:before]\n end",
"title": ""
},
{
"docid": "7aaf2e90c5c98f58f0b964cf1bdd233d",
"score": "0.5585058",
"text": "def set_form\n @form = SampleForm.build(params.merge(get_form))\n end",
"title": ""
},
{
"docid": "630220110c00b06dd8a4dc17850a5969",
"score": "0.5583163",
"text": "def form_data\n user_specified_options[:form_data]\n end",
"title": ""
},
{
"docid": "15069de2ee7bb125c0d43e99f1f3eb19",
"score": "0.557317",
"text": "def form_for(name, attrs = {}, &blk)\n with_form_context(name, attrs.delete(:builder)) do\n current_form_context.form(attrs, &blk)\n end\n end",
"title": ""
},
{
"docid": "5250455ad98f1fa145cc6cb6b6c6a991",
"score": "0.5553594",
"text": "def set_form\n @field = Field.find(params[:id])\n end",
"title": ""
},
{
"docid": "41aee868ebdb54482c0cc19d24d5058a",
"score": "0.55413187",
"text": "def set_form\n @form = Form.find(params[:form_id])\n end",
"title": ""
},
{
"docid": "68d608e2ea9ab35033b78fde3951685c",
"score": "0.5536963",
"text": "def set_nested_form\n @nested_form = FormKit::NestedForm.find(params[:nested_form_id])\n end",
"title": ""
},
{
"docid": "ca0b99a4c8448217b0906dab345034e9",
"score": "0.55352724",
"text": "def initialize(context)\n @application = context[:application]\n @component_name = self.class.to_s.space_case\n @configuration = context[:configuration]\n @droplet = context[:droplet]\n end",
"title": ""
},
{
"docid": "e1a5d2ce2a033da423ab6a9b95a13366",
"score": "0.5525035",
"text": "def set_form_vars\n @in_a_form_props = true\n session[:field_data] = {}\n @edit = {}\n session[:edit] = {}\n @edit[:ae_class_id] = @ae_class.id\n @edit[:new] = {}\n @edit[:current] = {}\n @edit[:new_field] = {}\n @edit[:rec_id] = @ae_class.id || nil\n @edit[:key] = \"aeclass_edit__#{@ae_class.id || \"new\"}\"\n\n @edit[:new][:name] = @ae_class.name\n @edit[:new][:display_name] = @ae_class.display_name\n @edit[:new][:description] = @ae_class.description\n @edit[:new][:namespace] = @ae_class.namespace\n @edit[:new][:inherits] = @ae_class.inherits\n @edit[:inherits_from] = MiqAeClass.all.collect { |c| [c.fqname, c.fqname] }\n @edit[:current] = @edit[:new].dup\n @right_cell_text = if @edit[:rec_id].nil?\n _(\"Adding a new Automate Class\")\n else\n _(\"Editing Automate Class \\\"%{name}\\\"\") % {:name => @ae_class.name}\n end\n session[:edit] = @edit\n @in_a_form = true\n end",
"title": ""
},
{
"docid": "846b1d7dc850ce2bf50ba6d8f86af905",
"score": "0.5521719",
"text": "def set_form\n @form = Form.find(params[:form_id])\n end",
"title": ""
},
{
"docid": "b5d58fdc910b018605d9d3bcf6ef656b",
"score": "0.55210364",
"text": "def set_form\n @form = ::Form.in_account(current_user.account.id).find(params[:id])\n end",
"title": ""
},
{
"docid": "25ace4c63e572957d5210a42cdc21cb5",
"score": "0.5520919",
"text": "def _forme_form_class\n ::Forme::ERB::Form\n end",
"title": ""
},
{
"docid": "0394121218200722eb0ba50d92050f0c",
"score": "0.5512588",
"text": "def _forme_form_options(options)\n options\n end",
"title": ""
},
{
"docid": "76086a1cd6c9ce69c4363c7f156d2a7c",
"score": "0.5508968",
"text": "def setup(easy)\n @easy = easy\n if params.empty?\n easy.url = url\n else\n set_params(easy)\n end\n set_form(easy) unless form.empty?\n easy.set_attributes(options)\n end",
"title": ""
},
{
"docid": "5e863ca84d251aab6b36c58da754a100",
"score": "0.55048543",
"text": "def form_fill\n options = {\n # Vet's ID\n # Veteran name is filled out through autosize text box, not pdf fields\n form_fields.middle_initial => form_data.veteran.middle_initial,\n form_fields.ssn_first_three => form_data.veteran_ssn_first_three,\n form_fields.ssn_second_two => form_data.veteran_ssn_second_two,\n form_fields.ssn_last_four => form_data.veteran_ssn_last_four,\n # Veteran file number is filled out through autosize text box, not pdf fields\n form_fields.veteran_birth_month => form_data.veteran.birth_month,\n form_fields.veteran_birth_day => form_data.veteran.birth_day,\n form_fields.veteran_birth_year => form_data.veteran.birth_year,\n form_fields.insurance_policy_number => form_data.veteran.insurance_policy_number,\n form_fields.mailing_address_state => form_data.veteran.state_code,\n form_fields.mailing_address_country => form_data.veteran.country_code,\n form_fields.veteran_homeless => form_data.veteran_homeless,\n form_fields.veteran_phone_area_code => form_data.veteran_area_code,\n form_fields.veteran_phone_prefix => form_data.veteran_phone_prefix,\n form_fields.veteran_phone_line_number => form_data.veteran_phone_line_number,\n\n # Claimant\n # Claimant name is filled out through autosize text box, not pdf fields\n form_fields.claimant_middle_initial => form_data.claimant.middle_initial,\n form_fields.claimant_first_three_ssn => form_data.claimant_ssn_first_three,\n form_fields.claimant_second_two_ssn => form_data.claimant_ssn_second_two,\n form_fields.claimant_last_four_ssn => form_data.claimant_ssn_last_four,\n form_fields.claimant_birth_month => form_data.claimant.birth_month,\n form_fields.claimant_birth_day => form_data.claimant.birth_day,\n form_fields.claimant_birth_year => form_data.claimant.birth_year,\n form_fields.claimant_mailing_address_state => form_data.claimant.state_code,\n form_fields.claimant_mailing_address_country => form_data.claimant.country_code,\n form_fields.claimant_phone_area_code => form_data.claimant_area_code,\n form_fields.claimant_phone_prefix => form_data.claimant_phone_prefix,\n form_fields.claimant_phone_line_number => form_data.claimant_phone_line_number,\n\n # Benefit Type\n form_fields.benefit_type(0) => form_data.benefit_type('education'),\n form_fields.benefit_type(1) => form_data.benefit_type('nationalCemeteryAdministration'),\n form_fields.benefit_type(2) => form_data.benefit_type('veteransHealthAdministration'),\n form_fields.benefit_type(3) => form_data.benefit_type('lifeInsurance'),\n form_fields.benefit_type(4) => form_data.benefit_type('loanGuaranty'),\n form_fields.benefit_type(5) => form_data.benefit_type('fiduciary'),\n form_fields.benefit_type(6) => form_data.benefit_type('veteranReadinessAndEmployment'),\n form_fields.benefit_type(7) => form_data.benefit_type('pensionSurvivorsBenefits'),\n form_fields.benefit_type(8) => form_data.benefit_type('compensation'),\n\n # Optional Informal Conference\n form_fields.informal_conference => form_data.informal_conference,\n form_fields.conference_8_to_12 => form_data.informal_conference_time('veteran', '800-1200 ET'),\n form_fields.conference_12_to_1630 => form_data.informal_conference_time('veteran', '1200-1630 ET'),\n form_fields.conference_rep_8_to_12 => form_data.informal_conference_time('representative', '800-1200 ET'),\n form_fields.conference_rep_12_to_1630 => form_data.informal_conference_time('representative',\n '1200-1630 ET'),\n # Rep name should be filled with autosize text boxes, not pdf fields\n form_fields.rep_phone_area_code => form_data.rep_phone_area_code,\n form_fields.rep_phone_prefix => form_data.rep_phone_prefix,\n form_fields.rep_phone_line_number => form_data.rep_phone_line_number,\n\n # Section V: SOC/SSOC Opt-In\n form_fields.sso_ssoc_opt_in => form_data.soc_opt_in,\n\n # Section VI: Issues (allows 13 in fields)\n # Dates filled via fill_contestable_issues_dates!, below.\n # Issue text is filled out through autosize text boxes.\n\n # Section VII: Cert & Sig\n form_fields.date_signed_month => form_data.date_signed_mm,\n form_fields.date_signed_day => form_data.date_signed_dd,\n form_fields.date_signed_year => form_data.date_signed_yyyy\n\n # Section VIII: Authorized Rep Sig\n # NOT YET SUPPORTED\n }\n\n fill_contestable_issues_dates!(options)\n end",
"title": ""
},
{
"docid": "df8a8831a61101252cf4515069139306",
"score": "0.5501998",
"text": "def the_form( options={}, &proc)\n self.expects(:ubiquo_user_path).returns(\"/ubiquo/users/1\")\n options[:builder] = Ubiquo::Helpers::UbiquoFormBuilder\n user = User.new\n form_for([:ubiquo,user], options, &proc)\n @rendered = \"\"\n end",
"title": ""
},
{
"docid": "a0317febbd79b92aa2f7c2c9438f68c2",
"score": "0.55017555",
"text": "def form\n fieldset.form\n end",
"title": ""
},
{
"docid": "59ca2e13f79e3fb9ee793f71ab195695",
"score": "0.5494445",
"text": "def relative_form(attrs=nil, &block)\n tag(:form, attrs) do\n @form = Form.new\n block.call(self)\n backup = {}\n (@parameters.to_hash.keys - @form.values).each do |key|\n backup[key] = @parameters.value_array(key)\n end\n hidden_hash(backup)\n @form = nil\n end\n end",
"title": ""
},
{
"docid": "617c48b931fbf59b764d8b8f9ae09392",
"score": "0.5488729",
"text": "def form\n @form ||= form_class.new\n end",
"title": ""
},
{
"docid": "617c48b931fbf59b764d8b8f9ae09392",
"score": "0.5488729",
"text": "def form\n @form ||= form_class.new\n end",
"title": ""
},
{
"docid": "27f86409827395704f33e3731a184a31",
"score": "0.5488253",
"text": "def set_form_comp\n @form_comp = ::FormComp.find(params[:id]) #.in_account()\n end",
"title": ""
},
{
"docid": "0e507ddc0a0990231c5f74944834959c",
"score": "0.5486109",
"text": "def build_session_context\n attributes.each(&:validate!)\n BatchConnect::SessionContext.new(attributes, form_config.fetch(:cacheable, nil))\n end",
"title": ""
},
{
"docid": "a67dfbc9f8cb183f5e589ab16e6bddf7",
"score": "0.54804045",
"text": "def bind( form )\n fail \"parameter #{name} is already bound\" if @form\n @form = form\n self\n end",
"title": ""
}
] |
64cff00e023ab79006dbed842e221fcf
|
Return a hash containing the defaults for command line parser. Returns: hash of default options
|
[
{
"docid": "4cf01d37d759b1abc9880a943120d92f",
"score": "0.6396172",
"text": "def default_options\n options = {\n :endpoint => nil,\n :certificates => [],\n :servers => [],\n :log_level => Logger::INFO,\n :renew_days => nil,\n :dry_run => false,\n :check_config => false,\n }\n options\n end",
"title": ""
}
] |
[
{
"docid": "c42cfe6865a7c2322ffac0ff3336cc88",
"score": "0.7507207",
"text": "def default_options\n\t\toptions = OpenStruct.new({\n\t\t\t:command => nil,\n\t\t\t:loglevel => :warn,\n\t\t})\n\n\t\treturn options\n\tend",
"title": ""
},
{
"docid": "5e27e7cd292b9e09b4514dbc00a5ebc0",
"score": "0.74131894",
"text": "def default_options\n @default_options ||= {\n validator_client: \"chef-validator\",\n attributes: Hash.new,\n run_list: Array.new,\n environment: \"_default\",\n sudo: true,\n hints: Hash.new\n }\n end",
"title": ""
},
{
"docid": "0a48b458791c00fd3cf9a49c34540a25",
"score": "0.7360718",
"text": "def default_options\n @default_options ||=\n Hash[options.select{|opt| !opt[2].nil? }.\n collect{|opt| [opt[0], opt[2]]}]\n end",
"title": ""
},
{
"docid": "2fd0cca234a536ed50ef614b047e072d",
"score": "0.72860956",
"text": "def defaults\n @options.inject({}) do |m, (k,v)|\n m[v.name] = v.default unless v.default.nil? ; m\n end\n end",
"title": ""
},
{
"docid": "4e862a9cdb4bd008b852319c20881c72",
"score": "0.72482663",
"text": "def get_default_options\n { \n :scutil_verbose => false,\n :scutil_force_pty => false,\n :scutil_pty_regex => DEFAULT_PTY_REGEX,\n :scutil_sudo_passwd_regex => DEFAULT_SUDO_PASSWD_REGEX,\n :scutil_sudo_passwd_failed_regex => DEFAULT_SUDO_PASSWD_FAILED_REGEX,\n :scutil_sudo_passwd => nil\n }\n end",
"title": ""
},
{
"docid": "d1a2e19b1ad600d2030624398aca1102",
"score": "0.71396965",
"text": "def options_and_defaults_hash\n options_and_defaults.inject({}) do |memo, option|\n memo[option[0]] = option[1].to_h \n memo\n end\n end",
"title": ""
},
{
"docid": "204cc5fe935c27ac87627761b7021771",
"score": "0.7102505",
"text": "def default_options\n CONFIG[:runner_defaults] || {}\n end",
"title": ""
},
{
"docid": "b870b0422cf0e2bfe9aca80c9d28fd63",
"score": "0.7084476",
"text": "def options\n option_defaults = {}\n option_defs.each do |option_name, option_settings|\n option_defaults[option_name] = option_settings[:default]\n end\n\n option_defaults.merge Yuyi::Menu.options(self.class.file_name)\n end",
"title": ""
},
{
"docid": "e6006f059dce40bf4863bbee02c94a78",
"score": "0.6999046",
"text": "def option_defaults(defaults={})\n @command[:option_defaults].update(defaults)\n end",
"title": ""
},
{
"docid": "f6960fe790b09bedabb59babab3ad032",
"score": "0.6997597",
"text": "def makeDefaultOptionHash()\n\t\toptionHash = Hash.new()\n\t\[email protected] do |optDef|\n\t\t\tdefault = optDef.getDefault()\n\t\t\tunless default.nil?\n\t\t\t\toptionHash[optDef.getKey()] = default\n\t\t\tend\n\t\tend\n\t\treturn optionHash\n\tend",
"title": ""
},
{
"docid": "467d402063ad4195bb03a0a41714da71",
"score": "0.6987368",
"text": "def options_and_defaults\n get_default_options.merge(options_as_hash)\n end",
"title": ""
},
{
"docid": "97bdef3c7b8dc84a56c85a02d2bf4178",
"score": "0.69019955",
"text": "def defaults\n @defaults ||= {\n :in => STDIN,\n :out => STDOUT\n }\n end",
"title": ""
},
{
"docid": "863a64f0270faddca5738f2efa564e53",
"score": "0.68341637",
"text": "def default_options\n {}\n end",
"title": ""
},
{
"docid": "863a64f0270faddca5738f2efa564e53",
"score": "0.68341637",
"text": "def default_options\n {}\n end",
"title": ""
},
{
"docid": "863a64f0270faddca5738f2efa564e53",
"score": "0.68341637",
"text": "def default_options\n {}\n end",
"title": ""
},
{
"docid": "863a64f0270faddca5738f2efa564e53",
"score": "0.68341637",
"text": "def default_options\n {}\n end",
"title": ""
},
{
"docid": "863a64f0270faddca5738f2efa564e53",
"score": "0.68341637",
"text": "def default_options\n {}\n end",
"title": ""
},
{
"docid": "9fbee5daff141ac826266815fbfba19a",
"score": "0.68108976",
"text": "def defaults\n @options[:app] = false\n @options[:verbose] = false\n @options[:logging] = false\n @options[:confdir] = nil\n end",
"title": ""
},
{
"docid": "293a3bf86f99514c19f946772fc1e03b",
"score": "0.67773896",
"text": "def default_options\n @default_options ||= Harpoon::Config.new\n end",
"title": ""
},
{
"docid": "e72a4bd0f56e00fe1b96f8ba817a59c4",
"score": "0.67706037",
"text": "def default_options\n {}\n end",
"title": ""
},
{
"docid": "e72a4bd0f56e00fe1b96f8ba817a59c4",
"score": "0.67706037",
"text": "def default_options\n {}\n end",
"title": ""
},
{
"docid": "8ab08b5f61f666b7de7d63fde42d3e7e",
"score": "0.67670953",
"text": "def get_defaults()\n defaults = {}\n defaults[:timeout] = (ENV[\"timeout\"].nil?)? DEFAULT_TIMEOUT : ENV[\"timeout\"]\n defaults[:error_value] = (ENV[\"error_value\"].nil?)? DEFAULT_ERROR_VALUE : ENV[\"error_value\"]\n defaults[:regex_error_value] = (ENV[\"regex_error_value\"].nil?)? DEFAULT_REGEX_ERROR_VALUE : ENV[\"regex_error_value\"]\n defaults[:grep_opts] = (ENV[\"grep_opts\"].nil?)? DEFAULT_GREP_OPTS : ENV[\"grep_opts\"]\n defaults[:wget_opts] = (ENV[\"wget_opts\"].nil?)? DEFAULT_WGET_OPTS : ENV[\"wget_opts\"]\n defaults[:join_lines] = (ENV[\"join_lines\"].nil?)? DEFAULT_JOIN_LINES : ENV[\"join_lines\"]\n defaults[:warning] = (ENV[\"warning\"].nil?)? DEFAULT_WARNING : ENV[\"warning\"]\n defaults[:critical] = (ENV[\"critical\"].nil?)? DEFAULT_CRITICAL : ENV[\"critical\"]\n defaults[:max] = (ENV[\"max\"].nil?)? DEFAULT_MAX : ENV[\"max\"]\n defaults[:proto] = (ENV[\"proto\"].nil?)? DEFAULT_PORTO : ENV[\"proto\"]\n defaults[:port] = (ENV[\"port\"].nil?)? DEFAULT_PORT : ENV[\"port\"]\n defaults[:path] = (ENV[\"path\"].nil?)? DEFAULT_PATH : ENV[\"path\"]\n return defaults\nend",
"title": ""
},
{
"docid": "e4ce41a2b52955f46d09a885fbf08328",
"score": "0.6758504",
"text": "def defaults\n c = ActiveSupport::OrderedOptions.new\n \n c\n end",
"title": ""
},
{
"docid": "129d0549766d9a7bbc907ab30692893f",
"score": "0.6717434",
"text": "def default_options(opts={})\n @default_options ||= {}\n @default_options.merge opts\n end",
"title": ""
},
{
"docid": "0613c3553ffa9188e895722831d4a6fe",
"score": "0.6715442",
"text": "def default_options\n @default_options ||= self.class.default_options.dup rescue {}\n end",
"title": ""
},
{
"docid": "0c542700617051be5d17d6e8069e671b",
"score": "0.6711553",
"text": "def parse_options\n setup_command_line_options\n parser = Slop::Parser.new(@opts)\n result = parser.parse(ARGV.dup)\n result.to_hash\n end",
"title": ""
},
{
"docid": "057407fa56bf08ba831e3551069d8d36",
"score": "0.6695375",
"text": "def default_options\n @default_options ||= Utils::Hash.symbolize({\n PROJECT_NAME => project_name,\n TEST_KEY => DEFAULT_TEST_SUITE,\n TEMPLATE_KEY => DEFAULT_TEMPLATE\n }).freeze\n end",
"title": ""
},
{
"docid": "1aa4a7b0a551f1411970393f47e0a5b8",
"score": "0.66880685",
"text": "def options\n defaults.merge!(@options)\n end",
"title": ""
},
{
"docid": "1aa4a7b0a551f1411970393f47e0a5b8",
"score": "0.66880685",
"text": "def options\n defaults.merge!(@options)\n end",
"title": ""
},
{
"docid": "7e58431b15e05906f932d4b02c6bc347",
"score": "0.66830933",
"text": "def command_line_options\n opts = GetoptLong.new(*ARG_SPEC)\n options = {}\n opts.each do |opt,arg|\n opt[0,2] = ''\n opt = opt.gsub(/-/, '_').to_sym\n case opt\n when :help\n puts usage\n exit 0\n else\n options[opt] = arg ? arg : true\n end\n end\n options\nend",
"title": ""
},
{
"docid": "36785be99227bd08fedf79a4aa6f7e70",
"score": "0.6663445",
"text": "def parse_command_line_options( default_options )\n options = self\n \n # Parse internal commands before extension commands & options to avoid any conflicts & to avoid extension invocation\n # in case a internal command is called.\n OptionParser.new do |opts|\n\n default_options.each do | name, details |\n # translate options default value if defined\n if details.key?(:default) == true\n options[name] = details[:default]\n end\n\n cl_type = details[:type].to_s == \"DateTime\" ? String : details[:type]\n cl_sub = details[:type].to_s == \"DateTime\" ? \"Date\" : details[:type]\n\n cl_option = \"--#{name.to_s.gsub(\"_\",\"-\")} [#{cl_sub}]\"\n\n if details.key?(:short_flag) == true && details.key?(:type) == true\n opts.on( details[:short_flag], cl_option, cl_type, details[:definition] ) do |o|\n options[ name ] = prepare_input( details, o )\n end \n elsif details.key?(:short_flag) == true && details.key?(:type) == false\n opts.on( details[:short_flag], \"--#{name.to_s.gsub(\"_\",\"-\")}\", details[:definition] ) do |o|\n options[ name ] = prepare_input( details, o )\n end \n elsif details.key?(:short_flag) == false \n opts.on( cl_option, cl_type, details[:definition] ) do |o|\n options[ name ] = prepare_input( details, o )\n end\n end\n\n end\n \n opts.banner = \"Usage: lewt -x EXTRACTOR -p PROCESSOR -o RENDERER\"\n opts.version = LEWT::VERSION\n \n end.parse!(ARGV)\n \n return options\n end",
"title": ""
},
{
"docid": "5e6872ddb45b90bb2c7e7ae11d31d23a",
"score": "0.6646525",
"text": "def default_options\n return @default_options if @default_options\n @default_options = superclass.respond_to?(:default_options) ? superclass.default_options : {}\n end",
"title": ""
},
{
"docid": "ff202fcc598977dd5b5b0fb3d89dee45",
"score": "0.6633298",
"text": "def defaults\n return {} unless manifest\n manifest[:defaults].nil? ? {} : manifest[:defaults]\n end",
"title": ""
},
{
"docid": "d0df52c1895cdb25cb7cbe952e9e5c07",
"score": "0.66050166",
"text": "def cli_options\n @@cli_options ||={}\n @@cli_options\n end",
"title": ""
},
{
"docid": "b0345f83caefe9f051bca8241926f51f",
"score": "0.6595412",
"text": "def default_options\n @default_options = definition.default_options\n end",
"title": ""
},
{
"docid": "7f327f29998ea5900189327db1c2c388",
"score": "0.6588976",
"text": "def options\n defaults.merge!(@options)\n end",
"title": ""
},
{
"docid": "7f327f29998ea5900189327db1c2c388",
"score": "0.6588976",
"text": "def options\n defaults.merge!(@options)\n end",
"title": ""
},
{
"docid": "0ca35c86c8208f024d6d528120435457",
"score": "0.6568034",
"text": "def default_options\n {\n name: nil,\n key_: nil,\n hostid: nil,\n delay: 60,\n history: 60,\n status: 0,\n type: 7,\n snmp_community: '',\n snmp_oid: '',\n value_type: 3,\n data_type: 0,\n trapper_hosts: 'localhost',\n snmp_port: 161,\n units: '',\n multiplier: 0,\n delta: 0,\n snmpv3_securityname: '',\n snmpv3_securitylevel: 0,\n snmpv3_authpassphrase: '',\n snmpv3_privpassphrase: '',\n formula: 0,\n trends: 365,\n logtimefmt: '',\n valuemapid: 0,\n delay_flex: '',\n authtype: 0,\n username: '',\n password: '',\n publickey: '',\n privatekey: '',\n params: '',\n ipmi_sensor: ''\n }\n end",
"title": ""
},
{
"docid": "cc70843cf3ebdaccc557f93b885a1bc0",
"score": "0.65578043",
"text": "def options( opts = nil ) # :doc:\n if opts\n space.merge_default_options( opts )\n else\n space.default_options\n end\n end",
"title": ""
},
{
"docid": "323ae340b88ea5bb15ce91fd2d52e49a",
"score": "0.6548848",
"text": "def parse_options\n options = Instagram::Options.new(@defaults)\n parse_with_optparse(options)\n rescue OptionParser::ParseError => e\n Logger.log_error_message(e)\n exit\n else\n options.to_hash\n end",
"title": ""
},
{
"docid": "59a2ddd0653f349e608031f15dd766fb",
"score": "0.65249807",
"text": "def options\n parse_arguments(ARGV) if @options.nil?\n @options\n end",
"title": ""
},
{
"docid": "9f326819d285e9dd27c8f08d74b335db",
"score": "0.65184253",
"text": "def default_parse_options # :nodoc:\n { :offset => 0,\n :memoize => false,\n :consume => false\n }\n end",
"title": ""
},
{
"docid": "9f326819d285e9dd27c8f08d74b335db",
"score": "0.65184253",
"text": "def default_parse_options # :nodoc:\n { :offset => 0,\n :memoize => false,\n :consume => false\n }\n end",
"title": ""
},
{
"docid": "a5e34deb6768bcc5e60a402d5c502bd4",
"score": "0.6516796",
"text": "def parseCommandLineOptions\n\t\n\t# default options\n\toptions = {\n\t\t:random => false,\n\t\t:report => nil,\n\t\t:mentions => false,\n\t\t:searches => false,\n\t\t:dm => false,\n\t\t:tweet => 0};\n\t\n\top = OptionParser.new\n\t\n\t# configure the options\n\t\n\top.on(\"--random\") do |v|\n\t\toptions[:random] = true\n\tend\n\t\n\top.on(\"--report SATELLITE\", String) do |v|\n\t\toptions[:report] = v\n\tend\n\t\n\top.on(\"--mentions\") do |v|\n\t\toptions[:mentions] = true\n\tend\n\t\n\top.on(\"--searches\") do |v|\n\t\toptions[:searches] = true\n\tend\n\t\n\top.on(\"--dm\") do |v|\n\t\toptions[:dm] = true\n\tend\n\t\n\top.on(\"--tweet ID\", Integer) do |v|\n\t\tif v <= 0\n\t\t\traise OptionParser::InvalidArgument, v\n\t\tend\n\t\toptions[:tweet] = v\n\tend\n\t\n\t# parse the options; report and quit if problems are encountered\n\tbegin\n\t\top.parse!\n\trescue OptionParser::ParseError => err\n\t\tputs STDERR, err.to_s\n\t\t$logger.fatal {err}\n\t\texit 1\n\tend\n\t\n\treturn options\nend",
"title": ""
},
{
"docid": "a89b766df899154d05d44da7660ba5f2",
"score": "0.6515644",
"text": "def defaults\n @values = Hash[self.class.options.select { |_, c| c.key?(:default) }.map { |n,c| [n, c[:default]] }].merge(@values)\n end",
"title": ""
},
{
"docid": "cc71cf47df6ab5c6e48bb65d7ba4ac7c",
"score": "0.6513029",
"text": "def option_hash\n @defaults.merge(@customs)\n end",
"title": ""
},
{
"docid": "61193043d389426a9eb5e97f826dce66",
"score": "0.65105873",
"text": "def default_options\n {}\n end",
"title": ""
},
{
"docid": "61193043d389426a9eb5e97f826dce66",
"score": "0.65105873",
"text": "def default_options\n {}\n end",
"title": ""
},
{
"docid": "9de98dfb27d6a529321a7c108d9d7cd9",
"score": "0.6507848",
"text": "def default_options\n { :charset => nil, :line_break => nil, :nomunge => nil,\n :preserve_semi => nil, :disable_optimizations => nil }\n end",
"title": ""
},
{
"docid": "9de98dfb27d6a529321a7c108d9d7cd9",
"score": "0.6507848",
"text": "def default_options\n { :charset => nil, :line_break => nil, :nomunge => nil,\n :preserve_semi => nil, :disable_optimizations => nil }\n end",
"title": ""
},
{
"docid": "358e23a6dfeed14eef0919142ed3ddd4",
"score": "0.65049636",
"text": "def defaults\n Hash.new.freeze\n end",
"title": ""
},
{
"docid": "f4cd7ad3ce07e881f0accc284a71db66",
"score": "0.64992297",
"text": "def default_options\n {\n dir_mode: :normal, dir: daemon_home, multiple: false, log_output: true,\n stop_proc: :terminate\n }\n end",
"title": ""
},
{
"docid": "cb1c7f859efab94ac88da536f2c0195c",
"score": "0.6496764",
"text": "def parse_options(args,config=nil)\n command_configs = {}\n if config.nil?\n config = {}\n else\n command_configs = config.delete(GLI::InitConfig::COMMANDS_KEY) if !config.nil?\n end\n global_options,command,options,arguments = parse_options_helper(args.clone,config,nil,Options.new,Array.new,command_configs)\n flags.each { |name,flag| global_options[name] = flag.default_value if !global_options[name] }\n command.flags.each { |name,flag| options[name] = flag.default_value if !options[name] }\n return [global_options,command,options,arguments]\n end",
"title": ""
},
{
"docid": "61024e625bdf5701e89c921554c701e9",
"score": "0.6485251",
"text": "def options\n parse(@file) ||\n parse(DOT_FILE) ||\n parse(SYSTEM_CONFIG_FILE) ||\n {}\n end",
"title": ""
},
{
"docid": "20069178b04f151ab2fe9e2be634ce2a",
"score": "0.6482833",
"text": "def parse_options\n\toptions=OpenStruct.new\n\toptions.unit_tests =false\n\toptions.use_test_data=false\n\toptions.print_tokens =false\n\toptions.print_all =false\n\toptions.auto =false\n\toptions.verbose =false\n\toptions.filenames =[]\n\n\twhile arg=ARGV.shift do\n\t\tif arg==\"--test-data\" then options.use_test_data=true\n\t\telsif arg==\"--print-all\" then options.print_all =true\n\t\telsif arg==\"--print-tokens\" then options.print_tokens =true\n\t\telsif arg==\"-t\" then options.unit_tests =true\n\t\telsif arg==\"-a\" then options.auto =true\n\t\telsif arg==\"-v\" then options.verbose =true\n\t\telse filenames << arg\n\t\tend\n\tend\n\n\toptions.filenames+=list_automatic_files if options.auto\n\n\tif options.filenames.empty? && !options.use_test_data && !options.unit_tests\n\t\thelp_message\n\t\texit 1\n\tend\n\n\treturn options\nend",
"title": ""
},
{
"docid": "8b685dc073523a23473930619ea526dc",
"score": "0.6482082",
"text": "def console_defaults\n\t\t\t{}\n\t\tend",
"title": ""
},
{
"docid": "feb5b766b37c5a217bbf5d445227c3f9",
"score": "0.6481919",
"text": "def load_options!(opts={})\n require 'optparse'\n OptionParser.new do |op|\n op.banner = opts[:banner] if opts[:banner]\n op.on('-A key', '--access-key key', \"Ec2 access key (ENV['AWS_ACCESS_KEY'])\") { |key| default_options[:access_key] = key }\n op.on('-S key', '--secret-access-key key', \"Ec2 secret access key (ENV['AWS_SECRET_ACCESS'])\") { |key| default_options[:secret_access_key] = key }\n op.on('-I ami', '--image-id id', \"AMI instance (default: 'ami-40bc5829')\") {|id| default_options[:ami] = id }\n op.on('-k keypair', '--keypair name', \"Keypair name (ENV['KEYPAIR_NAME'])\") { |key| default_options[:keypair] = key }\n op.on('-b bucket', '--bucket bucket', \"Application bucket\") { |bucket| default_options[:shared_bucket] = bucket }\n # //THIS IS WHERE YOU LEFT OFF\n op.on('-D working directory', '--dir dir', \"Working directory\") { |d| default_options[:working_directory] = d }\n \n op.on('--ec2-dir dir', \"Directory with ec2 data (default: '~/.ec2')\") {|id| default_options[:ec2_dir] = id }\n op.on('-r names', '--services names', \"Monitored services (default: '')\") {|id| default_options[:services] = id }\n op.on('-c file', '--config-file file', \"Config file (default: '')\") {|file| default_options[:config_file] = file }\n op.on('-l plugin_dir', '--plugin-dir dir', \"Plugin directory (default: '')\") {|file| default_options[:plugin_dir] = file }\n op.on('-p port', '--host_port port', \"Run on specific host_port (default: 7788)\") { |host_port| default_options[:host_port] = host_port }\n op.on('-m monitors', '--monitors names', \"Monitor instances using (default: 'web,memory,cpu')\") {|s| default_options[:monitor_load_on] = s } \n op.on('-o port', '--client_port port', \"Run on specific client_port (default: 7788)\") { |client_port| default_options[:client_port] = client_port }\n op.on('-O os', '--os os', \"Configure for os (default: ubuntu)\") { |os| default_options[:os] = os } \n op.on('-e env', '--environment env', \"Run on the specific environment (default: development)\") { |env| default_options[:environment] = env }\n op.on('-a address', '--public-ip address', \"Associate this public address with the master node\") {|s| default_options[:public_ip] = s}\n op.on('-s size', '--size size', \"Run specific sized instance\") {|s| default_options[:size] = s}\n op.on('-a name', '--name name', \"Application name\") {|n| default_options[:app_name] = n}\n op.on('-u username', '--username name', \"Login with the user (default: root)\") {|s| default_options[:user] = s}\n op.on('-d user-data','--user-data data', \"Extra data to send each of the instances (default: \"\")\") { |data| default_options[:user_data] = data.to_str }\n op.on('-i', '--install-on-boot', 'Install the PoolParty and custom software on boot (default: false)') {|b| default_options[:install_on_load] = true}\n op.on('-t seconds', '--polling-time', \"Time between polling in seconds (default 50)\") {|t| default_options[:polling_time] = t }\n op.on('-v', '--[no-]verbose', 'Run verbosely (default: false)') {|v| default_options[:verbose] = true}\n op.on('-n number', '--minimum-instances', \"The minimum number of instances to run at all times (default 1)\") {|i| default_options[:minimum_instances] = i.to_i}\n op.on('-x number', '--maximum-instances', \"The maximum number of instances to run (default 3)\") {|x| default_options[:maximum_instances] = x.to_i}\n \n op.on_tail(\"-V\", \"Show version\") do\n puts Application.version\n exit\n end\n op.on_tail(\"-h\", \"-?\", \"Show this message\") do\n puts op\n exit\n end\n end.parse!(opts[:argv] ? opts.delete(:argv) : ARGV.dup)\n end",
"title": ""
},
{
"docid": "54e57643971d174f5b69017cc4078843",
"score": "0.6479269",
"text": "def program_defaults\n {\n help_formatter: HelpFormatter::Terminal,\n name: File.basename($PROGRAM_NAME),\n help_paging: true,\n }\n end",
"title": ""
},
{
"docid": "5b63596de9718ef0fe4203328c08ec23",
"score": "0.647568",
"text": "def defaults(options = nil)\n @defaults ||= default_options\n if options\n @defaults = default_options.merge!(options)\n else\n @defaults\n end\n end",
"title": ""
},
{
"docid": "f987eac8bd27b65dcf1d3756a0a8f7e4",
"score": "0.647542",
"text": "def get_default_options\n self.class.optionable_specified_options.merge(instance_specified_options || {})\n end",
"title": ""
},
{
"docid": "c12d92a9d886c9bd522736da6094cbc0",
"score": "0.6470062",
"text": "def parse_global_options\n opts = OptionParser.new\n opts.on(\"--help\") { @options[:help] = true }\n opts.on(\"--version\") { @options[:version] = true }\n opts.parse! @args.dup\n rescue OptionParser::InvalidOption\n # Ignore invalid options since options will be further \n # parsed by our sub commands.\n end",
"title": ""
},
{
"docid": "fb2f85d05820e25dc90f7f1f1cdd97f1",
"score": "0.6460586",
"text": "def initialize(defaults = nil)\n unless defaults.nil? || defaults.instance_of?(Hash)\n raise ArgumentError, \"Options have to be a Hash.\"\n end\n @default_options = normalize_option_names(defaults, KNOWN_OPTIONS['in'] & KNOWN_OPTIONS['out'])\n @options = Hash.new\n @_var_values = nil\n end",
"title": ""
},
{
"docid": "e4680f6ffa0ee856315cf8890b385538",
"score": "0.6458672",
"text": "def options\n @__options__ ||= begin\n options = { }\n\n # define our options parser and flags we are explicitly\n # looking for\n parser = OptionParser.new do |opts|\n opts.on(\"--logs\") do |v|\n options[:logs] = true\n end\n end.parse!\n\n # finally return options to caller\n options\n end\nend",
"title": ""
},
{
"docid": "fd8cc758f2c4401c5675581dfaaae88e",
"score": "0.6457777",
"text": "def get_cli_options\n ARGV << \"--help\" if ARGV.size == 0\n begin\n self.parse_options\n rescue OptionParser::InvalidOption => e\n puts \"#{e}\\n\"\n end\n end",
"title": ""
},
{
"docid": "1ad7fad403446be0546b3c4c2abb4ab7",
"score": "0.64515686",
"text": "def get_options(*args)\r\n # Set version and help to false,\r\n # as they would be after command line parsing.\r\n options = { :version => false, :help => false }\r\n\r\n flag = ''\r\n argv = []\r\n\r\n # Loop through the command line arguments.\r\n args.each do |arg|\r\n if arg =~ /^--?/\r\n flag = arg.gsub(/^--?/, '').gsub(/-/, '_').to_sym\r\n options[\"#{flag}_given\".to_sym] = true\r\n elsif options[\"#{flag}_given\".to_sym] and options[flag].nil?\r\n options[flag] = arg\r\n elsif options[\"#{flag}_given\".to_sym] and options[flag]\r\n if options[flag].is_a?(Array)\r\n options[flag] << arg\r\n else\r\n options[flag] = [options[flag], arg]\r\n end\r\n else\r\n argv << arg\r\n end\r\n end\r\n\r\n return options, argv\r\n end",
"title": ""
},
{
"docid": "a0d7dc850a78312f27c9f3d82e94172d",
"score": "0.6433613",
"text": "def default_options\n # {}\n end",
"title": ""
},
{
"docid": "aa93465348d504779958aa126a49689e",
"score": "0.64333636",
"text": "def command_line_options\n @command_line_options || []\n end",
"title": ""
},
{
"docid": "4ada4eeeb2b89ab02093e89efec1e7e2",
"score": "0.642356",
"text": "def get_options\n myopts = {}\n ARGV.each_with_index do |arg,i|\n if (arg == '-c' || arg == '--config') && ARGV[i+1]\n myopts['configfile'] = ARGV[i+1]\n ARGV.delete_at(i+1)\n ARGV.delete_at(i)\n end\n end\n myopts\n end",
"title": ""
},
{
"docid": "337b41d57f2a4b99fa4c22bdafee493d",
"score": "0.6403343",
"text": "def options\n config_file = File.join(Dir.home, \".sumo\")\n original_options = super\n return original_options unless File.exists?(config_file)\n defaults = ::YAML::load_file(config_file) || {}\n Thor::CoreExt::HashWithIndifferentAccess.new(defaults.merge(original_options))\n end",
"title": ""
},
{
"docid": "680c9c88f0c7e1d4d41a36edb248194c",
"score": "0.6402444",
"text": "def default_options\n @default_options ||= {\n :app_name => \"application_name\",\n :host_port => 80,\n :client_port => 8001,\n :environment => 'development',\n :verbose => false,\n :logging => true,\n :size => \"m1.small\",\n :polling_time => \"30.seconds\",\n :user_data => \"\",\n :heavy_load => 0.80,\n :light_load => 0.15,\n :minimum_instances => 2,\n :maximum_instances => 4,\n :public_ip => \"\",\n :access_key => ENV[\"AWS_ACCESS_KEY\"],\n :secret_access_key => ENV[\"AWS_SECRET_ACCESS\"],\n :config_file => if ENV[\"CONFIG_FILE\"] && !ENV[\"CONFIG_FILE\"].empty?\n ENV[\"CONFIG_FILE\"]\n elsif File.file?(\"config/config.yml\")\n \"config/config.yml\"\n else\n nil\n end,\n :username => \"root\",\n :ec2_dir => ENV[\"EC2_HOME\"],\n :keypair => (ENV[\"KEYPAIR_NAME\"].nil? || ENV[\"KEYPAIR_NAME\"].empty?) ? File.basename(`pwd`).strip : ENV[\"KEYPAIR_NAME\"].empty?,\n :ami => 'ami-44bd592d',\n :shared_bucket => \"\",\n :expand_when => \"web < 1.5\\n memory > 0.85\",\n :contract_when => \"cpu < 0.20\\n memory < 0.10\",\n :os => \"ubuntu\",\n :plugin_dir => \"plugins\",\n :install_on_load => false,\n :working_directory => Dir.pwd\n }\n end",
"title": ""
},
{
"docid": "7236d547f3c702c181562217bf94d9aa",
"score": "0.6399555",
"text": "def default_options h = nil\n @default_options ||= superclass.default_options.dup\n if h\n @default_options.merge! h\n end\n @default_options\n end",
"title": ""
},
{
"docid": "7236d547f3c702c181562217bf94d9aa",
"score": "0.6399555",
"text": "def default_options h = nil\n @default_options ||= superclass.default_options.dup\n if h\n @default_options.merge! h\n end\n @default_options\n end",
"title": ""
},
{
"docid": "3b42afbf0d7108c1b51dc93dbe50d445",
"score": "0.63987136",
"text": "def parse_options\n#--{{{\n @op = OptionParser.new\n @options = {}\n OPTSPEC.each do |spec|\n k = spec.first.gsub(%r/(?:--)|(?:=.*$)|(?:\\s+)/o,'')\n @op.def_option(*spec){|v| v = v.to_s; @options[k] = v.empty? ? nil : v}\n #@op.def_option(*spec){|v| @options[k] = v}\n end\n\n if((env_opts = (ENV['RQ_OPTS'] || ENV['RQ_OPTIONS'])))\n require 'shellwords'\n @op.parse! Shellwords.shellwords(env_opts)\n end\n\n @op.parse! @argv \n\n @options\n#--}}}\n end",
"title": ""
},
{
"docid": "d3e54c76b4994a32658c9045c3634150",
"score": "0.63802004",
"text": "def cli_options(parser); end",
"title": ""
},
{
"docid": "0e56cd4b87d2a4de0fa24407ae8e2810",
"score": "0.637347",
"text": "def defaults\n config.defaults\n end",
"title": ""
},
{
"docid": "ac467b49d81afa9a5f9146c1a99d7f54",
"score": "0.6356961",
"text": "def get_defaults\n\t\thash = {}\n\n\t\thash['device'] = self.device\n\t\thash['env'] = self.env\n\n\t\treturn hash\n\n\n\tend",
"title": ""
},
{
"docid": "59c6b432f16a69d935f8df8fa14d7221",
"score": "0.6356416",
"text": "def defaults\n {\n colour_mode: detect_colour_mode,\n debug: false,\n interactive: true,\n log: '/tmp/vedeu.log',\n once: false,\n system_keys: Configuration.default_system_keys,\n terminal_mode: :raw,\n trace: false,\n }\n end",
"title": ""
},
{
"docid": "9be6c1bea0422332bef8316e02cf2b4f",
"score": "0.63560647",
"text": "def default_options\n {\n :hostid => nil,\n :name => nil,\n :steps => [],\n }\n end",
"title": ""
},
{
"docid": "7cb655a864781eafd7cb6dd234e0e824",
"score": "0.63506675",
"text": "def default_options\n {\n :host => nil,\n :interfaces => [],\n :status => 0,\n :available => 1,\n :groups => [],\n :proxy_hostid => nil,\n }\n end",
"title": ""
},
{
"docid": "8a5d4d5bd60eea33c79e595d0f52a3ee",
"score": "0.634717",
"text": "def get_options\r\n\t\toptions = OpenStruct.new\r\n\t\toptions.help = false\r\n\t\toptions.wowpath = nil\r\n\r\n\t\tparser = OptionParser.new do |parser|\r\n\t\t\tparser.on(\"-p\", \"--wowpath PATH\", \"Provide an alternate path for WOW.\") do |path|\r\n\t\t\t\toptions.wowpath = path \r\n\t\t\tend\r\n\r\n\t\t\tparser.on_tail(\"-h\", \"Show this usage statement.\") do |h|\r\n\t\t\t\tputs parser\r\n\t\t\t\toptions.help = true\r\n\t\t\tend\r\n\t\tend.parse!\r\n\t\t\r\n\t\tif (options.wowpath == nil) then options.wowpath = get_default_wowpath end\r\n\r\n\t\treturn options\r\n\tend",
"title": ""
},
{
"docid": "b88e8c684ea8be6fb4de34805d701977",
"score": "0.6342499",
"text": "def parse_options(argv_switches, defaults_hash)\n options_parser = Topt::Options.new(@options, defaults_hash)\n [options_parser.parse(argv_switches), options_parser.remaining]\n end",
"title": ""
},
{
"docid": "6c98877be57b3bc3b18332d2a19838cd",
"score": "0.6340913",
"text": "def default_dump_opts\n default_options = []\n default_options.push '-Xdump:none'\n default_options.push \"-Xdump:heap:defaults:file=#{@common_paths.dump_directory}/heapdump.%Y%m%d.%H%M%S.%pid.%seq.phd\"\n default_options.push \"-Xdump:java:defaults:file=#{@common_paths.dump_directory}/javacore.%Y%m%d.%H%M%S.%pid.%seq.txt\"\n default_options.push \"-Xdump:snap:defaults:file=#{@common_paths.dump_directory}/Snap.%Y%m%d.%H%M%S.%pid.%seq.trc\"\n default_options.push '-Xdump:heap+java+snap:events=user'\n default_options\n end",
"title": ""
},
{
"docid": "6c98877be57b3bc3b18332d2a19838cd",
"score": "0.6340913",
"text": "def default_dump_opts\n default_options = []\n default_options.push '-Xdump:none'\n default_options.push \"-Xdump:heap:defaults:file=#{@common_paths.dump_directory}/heapdump.%Y%m%d.%H%M%S.%pid.%seq.phd\"\n default_options.push \"-Xdump:java:defaults:file=#{@common_paths.dump_directory}/javacore.%Y%m%d.%H%M%S.%pid.%seq.txt\"\n default_options.push \"-Xdump:snap:defaults:file=#{@common_paths.dump_directory}/Snap.%Y%m%d.%H%M%S.%pid.%seq.trc\"\n default_options.push '-Xdump:heap+java+snap:events=user'\n default_options\n end",
"title": ""
},
{
"docid": "178aefea2b46f851c1d16dbb47026955",
"score": "0.63331205",
"text": "def parse_options( args )\n\t\targs = \"{ #{args} }\" unless args.strip[0] == ?{\n\t\targs = YAML.load( args )\n\n\t\t# Convert to Symbol keys and value\n\t\targs.keys.each do |k|\n\t\t\tnewval = args.delete( k )\n\t\t\tnext if newval.nil? || (newval.respond_to?(:size) && newval.size == 0)\n\t\t\targs[ k.to_sym ] = newval.respond_to?( :to_sym ) ? newval.to_sym : newval\n\t\tend\n\t\treturn DEFAULTS.merge( args )\n\tend",
"title": ""
},
{
"docid": "178aefea2b46f851c1d16dbb47026955",
"score": "0.63331205",
"text": "def parse_options( args )\n\t\targs = \"{ #{args} }\" unless args.strip[0] == ?{\n\t\targs = YAML.load( args )\n\n\t\t# Convert to Symbol keys and value\n\t\targs.keys.each do |k|\n\t\t\tnewval = args.delete( k )\n\t\t\tnext if newval.nil? || (newval.respond_to?(:size) && newval.size == 0)\n\t\t\targs[ k.to_sym ] = newval.respond_to?( :to_sym ) ? newval.to_sym : newval\n\t\tend\n\t\treturn DEFAULTS.merge( args )\n\tend",
"title": ""
},
{
"docid": "31c6a1493496c4e13d93ec694e86fe05",
"score": "0.63284165",
"text": "def default_config\n DefaultConfig.options\n end",
"title": ""
},
{
"docid": "8b5a5c84dcd8a375801589908633b5a3",
"score": "0.631842",
"text": "def standard_options\n [\n ['--db-read-only', '-n', \"Do not really execute mysql commands.\",\n lambda { |value| options.db_readonly = true }\n ],\n ['--storedir', '-d', \"Specify mangkeeper internal storage directory\",\n lambda { |value| options.storagedir = value }\n ],\n ['--version', '-v', \"Display the program version.\",\n lambda { |value|\n puts \"mangkeeper, version #{VERSION}\"\n exit\n }\n ],\n ]\n end",
"title": ""
},
{
"docid": "0b3d893d606ed5e4b4f55cfc7bc4eef5",
"score": "0.6315403",
"text": "def default_options\n {\n :convert_to_symbols => true,\n :deep_copy => true,\n :results => [],\n :result_meta_info_ext => {order: [], data: {}}\n }\n end",
"title": ""
},
{
"docid": "b2aae93953b77eba6e17b3dba3e4c4ce",
"score": "0.6315399",
"text": "def default_options\r\n ## note:\r\n ## do NOT include sep character and\r\n ## do NOT include headers true/false here\r\n ##\r\n ## make default sep its own \"global\" default config\r\n ## e.g. Csv.config.sep =\r\n\r\n ## common options\r\n ## skip comments starting with #\r\n ## skip blank lines\r\n ## strip leading and trailing spaces\r\n ## NOTE/WARN: leading and trailing spaces NOT allowed/working with double quoted values!!!!\r\n defaults = {\r\n blanks: @blanks, ## note: skips lines with no whitespaces only!! (e.g. line with space is NOT blank!!)\r\n comments: @comments,\r\n trim: @trim\r\n ## :converters => :strip\r\n }\r\n defaults\r\n end",
"title": ""
},
{
"docid": "1ddc0e294bbd2e26f427082c3d43a63e",
"score": "0.63089114",
"text": "def parse_options(options)\n {} \n end",
"title": ""
},
{
"docid": "86470aeef85a9ed888ed1ef76465af7c",
"score": "0.6306665",
"text": "def default_options\n env.empty? ? { env_dir: ::File.join(sv_dir, service_name, 'env') } : {}\n end",
"title": ""
},
{
"docid": "21c289b4bc99fda671565a347ba7bd5e",
"score": "0.63033444",
"text": "def defaults_and_options options\n options\n end",
"title": ""
},
{
"docid": "663f46f365e90aa0df1c34f959450b7c",
"score": "0.63007003",
"text": "def default_options\n options = {\n :endpoint => nil,\n :certificates => [],\n :servers => [],\n :log_level => Logger::INFO,\n :renew_days => nil,\n :dry_run => false,\n :check_config => false,\n :generate_certificate_keys => false,\n :generate_account_keys => false,\n :create_account => false,\n :deactivate_account => false,\n :change_account => false\n }\n options\n end",
"title": ""
},
{
"docid": "6d91143c698ad2f7f3b5e6d1fabdd2d8",
"score": "0.6294401",
"text": "def make_options(opts={})\n loading_options = opts.delete(:optsparse) || {}\n loading_options.merge!( opts || {})\n \n load_options!(loading_options) # Load command-line options\n config_file_location = (default_options[:config_file] || opts[:config_file])\n \n # If the config_file options are specified and not empty\n unless config_file_location.nil? || config_file_location.empty?\n require \"yaml\"\n # Try loading the file if it exists\n filedata = File.open(\"#{config_file_location}\").read if File.file?(\"#{config_file_location}\")\n default_options.merge!( YAML.load(filedata) ) if filedata rescue \"\"\n end\n # We want the command-line to overwrite the config file\n default_options.merge!(local_user_data) unless local_user_data.nil? \n OpenStruct.new(default_options)\n end",
"title": ""
},
{
"docid": "2d5adc34532f3106e612fec1520af9d6",
"score": "0.62866616",
"text": "def get_commandline_options()\r\n\r\n cmdoptions = OpenStruct.new\r\n \r\n opts = OptionParser.new do |opts|\r\n opts.on(\"--target MANDATORY\", \"Directory containing images\") do |target_directory|\r\n # TODO chk if it's a valid date before assigning\r\n cmdoptions.directory = target_directory\r\n end\r\n\r\n opts.on_tail(\"-h\", \"--help\", \"Show this usage statement\") do |h|\r\n puts opts\r\n end\r\n\t\t\r\n\t\t\r\n end\r\n\t\r\n\tbegin\r\n\t\topts.parse!(ARGV)\r\n\r\n\t #DEBUGGING ONLY\r\n\t# if cmdoptions.directory.nil? \r\n\t# cmdoptions.directory = Dir.pwd\r\n\t# end\r\n\t \r\n\t raise ArgumentError, \"--target directory must be specified\" if cmdoptions.directory.nil? \r\n\t \r\n\t return cmdoptions\r\n \r\n rescue ArgumentError => e\r\n # this syntax lets us print 3 separate lines in one statement\r\n puts e, \"\", opts\r\n raise \"Invalid command-line arguments: \" + e.to_s\r\n end\t\r\n\t\r\nend",
"title": ""
},
{
"docid": "a8168d6123d40965e685bc45c68056d5",
"score": "0.6271002",
"text": "def defaults\n @defaults ||= YAML.load_file(default_file)\n end",
"title": ""
},
{
"docid": "8bfefa849848d44cb08fa55f3e4ff379",
"score": "0.626416",
"text": "def parse\n options = {}\n\n option_parser = OptionParser.new do |opts|\n executable_name = File.basename($PROGRAM_NAME)\n opts.banner = \"Usage: #{executable_name} [options]\"\n\n opts.on('-j', '--json-attributes JSON_ATTRIBUTES', 'Enter your URL/path to the JSON file containing your JSON attributes.') do |v|\n options[:json_attributes] = v\n end\n\n opts.on('-v', '--version VERSION', 'Enter the version of Chef Workstation to install.') do |v|\n options[:version] = v\n end\n\n opts.on('-c', '--cookbook Cookbook', 'Enter the name of a wrapper cookbook for chefdk_bootstrap.') do |_v|\n options[:cookbook] = c\n end\n end\n\n option_parser.parse!(@argv)\n options\n end",
"title": ""
},
{
"docid": "693157c77e482052597e6efe6c813997",
"score": "0.6261249",
"text": "def options\n unless defined? @command_line_options\n @command_line_options = OpenStruct.new\n #@command_line_options.ebay_site_id = DEFAULT_EBAY_SITE_ID\n end\n @command_line_options\n end",
"title": ""
},
{
"docid": "693157c77e482052597e6efe6c813997",
"score": "0.6261249",
"text": "def options\n unless defined? @command_line_options\n @command_line_options = OpenStruct.new\n #@command_line_options.ebay_site_id = DEFAULT_EBAY_SITE_ID\n end\n @command_line_options\n end",
"title": ""
},
{
"docid": "7c59c404311348791bfbc4560d3d0c59",
"score": "0.62606543",
"text": "def default_options; end",
"title": ""
}
] |
5bdae8164ca020f8dcb8dcd757d013e0
|
GET /insertion_orders GET /insertion_orders.json
|
[
{
"docid": "b1e7c3929e9b7aecf88faefef2748b14",
"score": "0.72218746",
"text": "def index\n @insertion_orders = InsertionOrder.all\n end",
"title": ""
}
] |
[
{
"docid": "4519c4984f3d701c2f52f2db172695b3",
"score": "0.690942",
"text": "def orders\n get_request 'orders'\n end",
"title": ""
},
{
"docid": "ecb872e9703937b98762917512895cd5",
"score": "0.66372174",
"text": "def create\n @insertion_order = InsertionOrder.new(insertion_order_params)\n\n respond_to do |format|\n if @insertion_order.save\n format.html { redirect_to @insertion_order, notice: 'Insertion order was successfully created.' }\n format.json { render :show, status: :created, location: @insertion_order }\n else\n format.html { render :new }\n format.json { render json: @insertion_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e07ad934c2de7094e1c508d747cff064",
"score": "0.65286577",
"text": "def orders_list\n response = request_get(\"/api/v1/orders\")\n raise StandardError.new(response[\"errors\"].to_json) unless response[\"success\"]\n response[\"orders\"]\n end",
"title": ""
},
{
"docid": "5186789965fa814853c550bb1c3ac0e8",
"score": "0.64916843",
"text": "def get_order\n ActiveRecord::Base.connection.begin_db_transaction\n order = ActiveRecord::Base.connection.exec_query(\n \"SELECT oid, date_time, payment_method, delivery_fee, (total_price - delivery_fee) AS total_cost,\n (SELECT username FROM Users WHERE id = Orders.customer_id) AS customer_name\n FROM Orders\n WHERE oid = #{params[\"id\"]};\"\n ).to_a[0]\n\n foods = ActiveRecord::Base.connection.exec_query(\n \"SELECT *\n FROM (SELECT * FROM Comprises WHERE oid=#{params[\"id\"]}) AS T\n JOIN Foods F ON (T.food_id = F.id)\n ORDER BY F.id;\"\n ).to_a\n ActiveRecord::Base.connection.commit_db_transaction\n\n order[\"foods\"] = foods\n render json: order\n end",
"title": ""
},
{
"docid": "0018a9a547b20cd7a770a6e2cd109f33",
"score": "0.6431021",
"text": "def orders\n get(\"orders\")\n end",
"title": ""
},
{
"docid": "a60faa385b3fed20f6aa699cab462280",
"score": "0.6402098",
"text": "def orders\n url = \"#{base_path}/ordenesdecompra.json\"\n self.class.get(url, @options)\n end",
"title": ""
},
{
"docid": "8fe2d6ec8a1d47ca8c318cf923eb35b7",
"score": "0.63638276",
"text": "def orders\n client.get \"orders\"\n end",
"title": ""
},
{
"docid": "fed32a5cc3ae2d6c4b148933b9a92f71",
"score": "0.6286353",
"text": "def api_work_orders\n @work_orders = WorkOrder.order(:order_no)\n render json: @work_orders\n end",
"title": ""
},
{
"docid": "a047be95b02ef7f42120c754057fc92e",
"score": "0.6268841",
"text": "def my_orders\n response = request_get(\"/api/v1/orders/my\")\n raise StandardError.new(response[\"errors\"].to_json) unless response[\"success\"]\n response[\"orders\"]\n end",
"title": ""
},
{
"docid": "e6c641469a388b0bb36186f915e5979d",
"score": "0.6260186",
"text": "def order(id)\n get(\"#{ROBINHOOD_ORDERS_ROUTE}#{id}/\", return_as_json: true)\n end",
"title": ""
},
{
"docid": "ee8d8e8e024d35ee13910acc551b370b",
"score": "0.62421244",
"text": "def create_order\n post_request \"orders\"\n end",
"title": ""
},
{
"docid": "b2064fc7598185661fd07141717c05d1",
"score": "0.6176146",
"text": "def list_orders()\n get_request('listOrders?'+get_url_parameters({})).body\n end",
"title": ""
},
{
"docid": "3ce046f3512168333d306874238af09a",
"score": "0.61756676",
"text": "def getorders(args = {})\n {\n :method => \"GetOrders\",\n }.to_json\n end",
"title": ""
},
{
"docid": "e460705133e551008c6876a1297e16e9",
"score": "0.6092249",
"text": "def update_insertion_order(insertion_order, changes)\n insertion_order.pending_changes = changes\n response = call(:update_insertion_order, { insertion_order: insertion_order.to_hash(:camelcase) } )\n response_hash = get_response_hash(response, __method__)\n return response_hash\n end",
"title": ""
},
{
"docid": "845035633d004ad773ad8d0df67d69fd",
"score": "0.6062758",
"text": "def create\n response = Unirest.post(\"http://localhost:3000/api/orders\")\n order = response.body\n redirect_to \"/client/orders/#{order['order_id']}\"\n end",
"title": ""
},
{
"docid": "e5bc3f1079e04db5f514ed935947641d",
"score": "0.60535145",
"text": "def index\n @orders = Order.all_include.order_by_create.page(params[:page]).per(10)\n end",
"title": ""
},
{
"docid": "0d19b18280deebfe17e53338da60f0ef",
"score": "0.60430586",
"text": "def orders\n if request.get?\n @page_title = \"Order Manager\"\n @orders = Order.find(:all, :order=>'id DESC')\n end \n end",
"title": ""
},
{
"docid": "df51e61b2a0d3729231476c904b7a558",
"score": "0.6020437",
"text": "def index\n @orders = Order.all\n render json: @order\n\n end",
"title": ""
},
{
"docid": "958a4ecc81ab0196eba571f8e3a72d8e",
"score": "0.6018401",
"text": "def add_orders(orders = [])\n @@webservice = \"AbacosWSPedidos\"\n\n response = client.call(\n :inserir_pedido,\n message: {\n \"ChaveIdentificacao\" => @@key,\n \"ListaDePedidos\" => orders\n }\n )\n\n result = response.body[:inserir_pedido_response][:inserir_pedido_result]\n\n # NOTE think we will get a collection of :resultado_operacao when sending\n # more than one order. TEST IT and update the code to handle it as well\n if result[:resultado_operacao][:tipo] != \"tdreSucesso\"\n error = result[:rows][:dados_pedidos_resultado][:resultado]\n message = \"#{error[:codigo]}. #{error[:exception_message]}. \\n#{error[:descricao]}\"\n raise ResponseError, message\n end\n\n response\n end",
"title": ""
},
{
"docid": "958a4ecc81ab0196eba571f8e3a72d8e",
"score": "0.6018401",
"text": "def add_orders(orders = [])\n @@webservice = \"AbacosWSPedidos\"\n\n response = client.call(\n :inserir_pedido,\n message: {\n \"ChaveIdentificacao\" => @@key,\n \"ListaDePedidos\" => orders\n }\n )\n\n result = response.body[:inserir_pedido_response][:inserir_pedido_result]\n\n # NOTE think we will get a collection of :resultado_operacao when sending\n # more than one order. TEST IT and update the code to handle it as well\n if result[:resultado_operacao][:tipo] != \"tdreSucesso\"\n error = result[:rows][:dados_pedidos_resultado][:resultado]\n message = \"#{error[:codigo]}. #{error[:exception_message]}. \\n#{error[:descricao]}\"\n raise ResponseError, message\n end\n\n response\n end",
"title": ""
},
{
"docid": "0e2f6218bb3b630d366baa6dc5eb784c",
"score": "0.60056704",
"text": "def my_orders\n response = request_get('/api/v1/orders/my')\n raise ApiError.new(response['errors'].to_json) unless response['success']\n response['orders']\n end",
"title": ""
},
{
"docid": "e089b2a47c9eb2307e46a4ecee16b61a",
"score": "0.60048115",
"text": "def index\n @orders = Order.all\n render json: @order\n \n end",
"title": ""
},
{
"docid": "098752a5590eb8f398382e9798b84b91",
"score": "0.59863544",
"text": "def set_insertion_order\n @insertion_order = InsertionOrder.find(params[:id])\n end",
"title": ""
},
{
"docid": "03b3b58a085c5ca6747eac877b18f172",
"score": "0.5984754",
"text": "def search_insertion_orders(account_id, predicates)\n #predicate = BingAdsApi::Predicate.new(field: 'AccountId', operator: 'Equals', value: account_id)\n if predicates.is_a? Array\n predicates_for_soap = predicates.map{ |p| p.to_hash(:camelcase) }\n elsif predicates.is_a? BingAdsApi::Predicate\n predicates_for_soap = predicates.to_hash(:camelcase)\n else\n raise \"predicates must be an array or instance of BingAdsApi::Predicate\"\n end\n response = call(:search_insertion_orders,\n { predicates: { \"ins1:Predicate\" => predicates_for_soap },\n page_info: {\n \"ins1:Index\" => 0,\n \"ins1:Size\" => 10\n }\n }\n )\n response_hash = get_response_hash(response, __method__)\n response_orders = [response_hash[:insertion_orders][:insertion_order]].flatten.compact\n insertion_orders = response_orders.map{ |insertion_order_hash| BingAdsApi::InsertionOrder.new(insertion_order_hash) }\n return insertion_orders\n end",
"title": ""
},
{
"docid": "45d40d4eb7c605b195ee60f1fcb2b6ab",
"score": "0.59720176",
"text": "def index\n @orders = Order.all\n render json: @orders\n end",
"title": ""
},
{
"docid": "2d0a25bc1d2e2e9a4a09fd559c0797f2",
"score": "0.59693307",
"text": "def index\n @orders = Order.order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"title": ""
},
{
"docid": "0f62106875f14f6a9bbd6eccf3b11405",
"score": "0.59467524",
"text": "def index\n @orders = Order.all\n\n render json: @orders\n end",
"title": ""
},
{
"docid": "ba44de5a704652c22d8b0151263e3e35",
"score": "0.59325415",
"text": "def order(id)\n client.get \"orders/#{id}\"\n end",
"title": ""
},
{
"docid": "3758f6207907aa1aec2df539ab3cea90",
"score": "0.5930689",
"text": "def create\n @order = Order.new(order_params)\n @orders = Order.all\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to edit_order_path(@order), notice: 'Order was successfully created.' }\n format.json { render action: 'edit', status: :created, location: @order }\n else\n format.html { render action: 'index' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "2c08cf808fb59173c441afd2003fa697",
"score": "0.5926662",
"text": "def orders(options = {})\n perform_get_with_object('/orders', options, Epages::OrdersResponse)\n end",
"title": ""
},
{
"docid": "acc05112208f7d4b46ab7e54c8167cc5",
"score": "0.5921691",
"text": "def index\n @orders = Order.order(\"id DESC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders} \n end\n end",
"title": ""
},
{
"docid": "3a919ac68982cbb829a72d1f3cb31453",
"score": "0.5888973",
"text": "def index\n @orders = Order.all\n render json: @orders, status: :ok\n end",
"title": ""
},
{
"docid": "3766e68025f6884856eeea254710287f",
"score": "0.58851534",
"text": "def order_create(order)\n execute 'api/create',\n build_json({\n order: order\n })\n end",
"title": ""
},
{
"docid": "9bc52a3a424467ea7412a9bce8930390",
"score": "0.58706695",
"text": "def list_orders(json_payload={})\n conn = @client.get do |req|\n req.url '/api/v2/order/list?'\n req.headers[\"Authorization\"] = @token\n req.params = json_payload\n end\n conn.body\n end",
"title": ""
},
{
"docid": "b3c1025e3bb247ae8b67496a775634e5",
"score": "0.5863867",
"text": "def get_active_orders\n requestURL = '/v1/orders'\n\n data = {'request' => requestURL, 'nonce' => DateTime.now.strftime('%Q')}\n\n payload = Base64.strict_encode64(JSON.generate(data))\n signature = OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha384'), @@apiSecret, payload)\n\n headers = {'Content-Length' => '0', 'Content-Type' => 'text/plain', 'X-GEMINI-APIKEY' => @@apiKey,\n 'X-GEMINI-PAYLOAD' => payload, 'X-GEMINI-SIGNATURE' => signature}\n\n return http_post(@@apiBaseURL + requestURL, headers)\n end",
"title": ""
},
{
"docid": "a5541172327852577601012599bde34b",
"score": "0.58533114",
"text": "def index\n @orders = Order.all\n json_response(@orders)\n end",
"title": ""
},
{
"docid": "e7efa7c8bf733d189369ae4c589495ee",
"score": "0.58358574",
"text": "def index\n @orders = Order.all(:order => \"created_at desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"title": ""
},
{
"docid": "86c6f97d1e1f60f816c897eb98f29e27",
"score": "0.582818",
"text": "def index\n @orders = Order.all\n render json: OrderSerializer.new(@orders)\n end",
"title": ""
},
{
"docid": "3cec2d8389bc65f84cad2ff84c2ba6b4",
"score": "0.58252954",
"text": "def destroy\n @insertion_order.destroy\n respond_to do |format|\n format.html { redirect_to insertion_orders_url, notice: 'Insertion order was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d42924f82ec5a53b71b171787d7a8f89",
"score": "0.58141255",
"text": "def add_order(order)\n p 'test'\n customer = Customer.find_by(id: order[:customer])\n restaurant = Restaurant.find_by(id: order[:restaurant])\n Order.create(customer: customer, restaurant: restaurant, status: 'in_progress')\n end",
"title": ""
},
{
"docid": "e940098cc5c23e865d85fc7f49081446",
"score": "0.58113253",
"text": "def index\n orders = OrdersCollection\n .build(user: current_user, params: orders_params)\n .relation\n\n render json: OrdersSerializer.new(orders)\n end",
"title": ""
},
{
"docid": "74a190cc9bbd7896a6c1a46fc5b252cd",
"score": "0.58054405",
"text": "def index\n @orders = Order.all.page(params[:page]).per_page(3)\n respond_to do |format|\n format.html\n format.json\n end\n end",
"title": ""
},
{
"docid": "e3a60351ac3ba2e0606baf7c1be80d1a",
"score": "0.58047074",
"text": "def index\n # @orders = Order.all\n #@orders = Order.paginate(:page=>params[:page], :order=>'created_at desc', :per_page => 10)\n @orders = Order.paginate(:page=>params[:page], :per_page => 10).order('created_at desc')\n respond_to do |format|\n format.html\n format.json {render json: @orders}\n end\n end",
"title": ""
},
{
"docid": "c61645b7919f2962133c3cea19073e6a",
"score": "0.5796995",
"text": "def create_or_update_orders(orders)\n make_json_api_request :post, \"v2/#{account_id}/orders/batches\", private_generate_resource(\"batches\", { \"orders\" => orders })\n end",
"title": ""
},
{
"docid": "22c1a7b074522e9e84d1d87cd85c8e8b",
"score": "0.5792888",
"text": "def orders_list(pair)\n response = request_get(\"/api/v1/orders?pair=#{pair}\")\n raise ApiError.new(response['errors'].to_json) unless response['success']\n response['orders']\n end",
"title": ""
},
{
"docid": "63af05d3f741f7e68a3cfbb4be18fbab",
"score": "0.5792694",
"text": "def retrieve_orders\n veeqo_orders = call_orders_api\n\n veeqo_orders.each do |order|\n\n v_id = order[\"id\"]\n order_hash = []\n customer_name = order[\"customer\"][\"full_name\"]\n items = order[\"line_items\"]\n\n current_order = Order.create!(v_id: v_id, customer_name: customer_name)\n\n items.each do |item|\n title = item[\"sellable\"][\"product_title\"]\n image_url = item[\"sellable\"][\"product\"][\"main_image_src\"]\n sku = item[\"sellable\"][\"sku_code\"]\n weight = item[\"sellable\"][\"weight_grams\"]\n width = item[\"sellable\"][\"measurement_attributes\"][\"width\"]\n height = item[\"sellable\"][\"measurement_attributes\"][\"height\"]\n depth = item[\"sellable\"][\"measurement_attributes\"][\"depth\"]\n order_item = OrderItem.create!(title: title, image_url: image_url, order_id: current_order.id, sku: sku, weight: weight, width: width , height: height , depth: depth)\n end\n end\n end",
"title": ""
},
{
"docid": "1c9cea8042bd94bccb2f05fef52a9225",
"score": "0.5789118",
"text": "def list_orders\n account.get('/trade_orders')\n end",
"title": ""
},
{
"docid": "21c03e499e3bf7cf5544c11323514411",
"score": "0.57861394",
"text": "def my_orders\n @orders = current_user.orders.order(\"id DESC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"title": ""
},
{
"docid": "19a69e464f0458007a68c5da949b2eb0",
"score": "0.57860535",
"text": "def index\n @orderItem = Order.all\n render json: @order\n \n end",
"title": ""
},
{
"docid": "9f960779d3fda865f7df4e1007528472",
"score": "0.57772976",
"text": "def index\n orders = current_user.orders.page(params[:page]).per(params[:per_page])\n render json: orders, meta: pagination(orders, params[:per_page])\n end",
"title": ""
},
{
"docid": "671a4f57c127a9bb9ffe6d190da0c938",
"score": "0.57630056",
"text": "def index\n \torders = Order.all\n \trender json: orders\n \tend",
"title": ""
},
{
"docid": "4b499d3c86960b60f9c5ca7e4f6abfda",
"score": "0.57561815",
"text": "def index\n @orders = Order.all\n\n # Search\n @orders = @orders.search(params[:q]) if params[:q]\n\n # Order by\n @orders = @orders.order(params[:order].gsub(':', ' ')) if params[:order]\n\n # Pagination\n if (params[:offset] && params[:limit])\n @orders = @orders.page(1).per(params[:limit]).padding(params[:offset])\n else\n @orders = @orders.page(1).per(25)\n end\n\n render json: @orders if stale?(etag: @orders.all, last_modified: @orders.maximum(:updated_at))\n end",
"title": ""
},
{
"docid": "59362e2267d6ca7105abe4d1c3064232",
"score": "0.57499516",
"text": "def index\n @orders = Order.ordering.page(params[:page])\n end",
"title": ""
},
{
"docid": "b37f434316b3d50ec59e8608e428c9ad",
"score": "0.57496715",
"text": "def create\n json_response(current_user.orders.create!(order_params), :created)\n end",
"title": ""
},
{
"docid": "36668b2348edb81e632b704abeabe8ea",
"score": "0.5741478",
"text": "def place_order\n\n args = params[:args]\n\n @response = @api.order_guest(args)\n render json: @response\n end",
"title": ""
},
{
"docid": "93debe31a5dc591aac5382469f6efa28",
"score": "0.57414246",
"text": "def getProductOrderList\n product = ProductOrder.all.order(\"created_at asc\")\n render json: purchases, status: :ok\n end",
"title": ""
},
{
"docid": "0de610ebf454fd1bbfdd6b017c475358",
"score": "0.5737684",
"text": "def update\n respond_to do |format|\n if @insertion_order.update(insertion_order_params)\n format.html { redirect_to @insertion_order, notice: 'Insertion order was successfully updated.' }\n format.json { render :show, status: :ok, location: @insertion_order }\n else\n format.html { render :edit }\n format.json { render json: @insertion_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "766910ccb5030141d5133c5393663a42",
"score": "0.5735852",
"text": "def orders\n @orders ||= OrdersService.new(@http_client)\n end",
"title": ""
},
{
"docid": "b03f519bed950aef139d196f12f72321",
"score": "0.5735702",
"text": "def create\n @order = Order.new(params[:order])\n @ols = []\n @order.shop_id = sid\n respond_to do |format|\n if @order.save\n OrderLine.save_order_lines(params[:ols], @order)\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render json: @order, status: :created, location: @order }\n \n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "9bb06f7586794cb16da64d396cd3e67d",
"score": "0.5729026",
"text": "def order_new_bulk_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OrderApi.order_new_bulk ...\"\n end\n # resource path\n local_var_path = \"/order/bulk\".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']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n form_params[\"orders\"] = opts[:'orders'] if !opts[:'orders'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Order>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OrderApi#order_new_bulk\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "954a0af5d634812c08d3f8920f67a35f",
"score": "0.5725113",
"text": "def get_orders(options={}, timestamp=nil)\n mash = get '/orders', timestamp, options\n mash.results\n end",
"title": ""
},
{
"docid": "3ac7744156e2e2a3a3039e3afd7f411c",
"score": "0.57236713",
"text": "def orders\n @title = \"Your Orders\"\n @orders = @customer.orders.paginate(\n :page => params[:page],\n :per_page => 10\n )\n end",
"title": ""
},
{
"docid": "96b8e0069a8556ae1ded39ed15118d1e",
"score": "0.572098",
"text": "def past_orders\n\t\t@persona = Persona.where( :screen_name => params[:persona_id]).first\n\t\t@orders = @persona.orders\n\n respond_to do |format|\n format.html \n format.json { render json: @orders }\n format.xml { render xml: @orders }\n end\n\tend",
"title": ""
},
{
"docid": "54ae5c2ba430a4b665603dda2b5c2943",
"score": "0.5717577",
"text": "def index\n @orders = @client.orders.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"title": ""
},
{
"docid": "f3a8f932c62f3c14c77c66c1e0d064c6",
"score": "0.5705182",
"text": "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html\n format.json\n end\n end",
"title": ""
},
{
"docid": "3222ece6d00ae80f4e17ecf1523d58cf",
"score": "0.569141",
"text": "def index\n @orders = Order.all\n\n render json: @orders, status: :found\n end",
"title": ""
},
{
"docid": "f4a5bcaede00577f30b5e9c87a752431",
"score": "0.5691348",
"text": "def index\n @orders = Order.paginate :page=>params[:page], :order=>'created_at desc',\n :per_page => 10\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"title": ""
},
{
"docid": "24a86a2415365cd3660e43dcb64cfa9a",
"score": "0.5689578",
"text": "def order id\n get_request \"orders/#{id}\"\n end",
"title": ""
},
{
"docid": "3dd4c74b5a9f44b165d3cc378a5fa54e",
"score": "0.56804144",
"text": "def create_order\n json_response({ message: 'NOT IMPLEMENTED' })\n end",
"title": ""
},
{
"docid": "9f670fd81e946dca6f8901d3e7e50252",
"score": "0.5677628",
"text": "def index\n @orders = valid_order.order(id: :desc).page(params[:page])\n end",
"title": ""
},
{
"docid": "ab8f15b88d7faf52920092e4aa17cfc2",
"score": "0.56714267",
"text": "def orders\n @orders ||= Sappiamo::API::Orders.new(credentials)\n end",
"title": ""
},
{
"docid": "33ac9149e9654f6102ffeb100a5a3a28",
"score": "0.566985",
"text": "def index\n json_response(current_user.orders)\n end",
"title": ""
},
{
"docid": "6963e1ac2a2be735e515d836b251a714",
"score": "0.5666536",
"text": "def order_list(options = {\n :from => 0,\n :count => 1000,\n :from_id => 0,\n :end_id => nil,\n :order => :DESC, # ASC\n :since => 0,\n :end => nil,\n :pair => nil,\n :active => 1 # 0\n })\n\n options[:method] = 'OrderList'\n response = Types::Response.new(JSON.parse(@bus.request(options)))\n return [] if response.success.zero? && response.error==\"no orders\"\n raise \"server responded: #{response.error}\" if response.success.zero?\n response.return.map do |id, data|\n Types::Order.new(id, data)\n end\n end",
"title": ""
},
{
"docid": "52ba2c41b26a47f8dbdf4f42b909d922",
"score": "0.56606746",
"text": "def create\n product_ids_list = order_params.delete(:product_id)\n @order = Order.create(order_params.except(:product_id))\n product_ids_list.each do |product_id|\n @order.products << Product.find(product_id.to_i)\n end\n if @order.save\n render json: @order.to_json(:include => :products), status: :created\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "2ac98097f3ff864222e29080efa0d2ab",
"score": "0.56583726",
"text": "def list_orders(params = nil, headers = nil)\n get(\"/api/v1/orders\", params, headers)\n end",
"title": ""
},
{
"docid": "c1ac067389f94ee15ea72b330f7f2396",
"score": "0.56583285",
"text": "def create_order\n json_response({ message: \"NOT IMPLEMENTED\" })\n end",
"title": ""
},
{
"docid": "b740f4d1a14d67048a22c4b1354b6fa3",
"score": "0.56563836",
"text": "def orders\n\t\t@persona = Persona.where( :screen_name => params[:persona_id]).first\n #only show incomplete orders\n\t\t@orders = @persona.orders.where{ (status != 3) }\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\tend\n end",
"title": ""
},
{
"docid": "ebfd9430f8e373356488e137558b0aed",
"score": "0.5655858",
"text": "def fetch_customer_orders options={}\n url_options = \"/api/customer/#{system_id}/\"\n url_options += @customer_id.to_s\n url_options += \"/orders\"\n url_options += (\"/?\" + options.map{|k,v| \"#{k}=#{v}\"}.join(\"&\"))\n resp = send_request(@url + url_options)\n begin\n Hash.from_xml(resp.body)\n rescue REXML::ParseException => e\n pp e\n {}\n end\n end",
"title": ""
},
{
"docid": "b5d7ef15f29f31bdb62ffc17933b71da",
"score": "0.5652989",
"text": "def all_orders(options)\n request :signed, :get, :allOrders, options\n end",
"title": ""
},
{
"docid": "b6ffcd998acd7b0eae43a51602481c10",
"score": "0.56513643",
"text": "def index\n \n @orders = Order.paginate(:page => params[:page], :per_page => 2)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"title": ""
},
{
"docid": "5078f47ccf5b955476413f5abe925d7f",
"score": "0.5649568",
"text": "def index\n @orders = Order.all\n @orders = Order.order('order_date DESC')\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"title": ""
},
{
"docid": "0458abb2d9ce646bb2d4b0e196d78f1d",
"score": "0.5647957",
"text": "def index\n @orders = {:open => Order.open + Order.ordered, :closed => Order.closed}\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"title": ""
},
{
"docid": "c454187a9320499683677c03eaad96a8",
"score": "0.5642182",
"text": "def index \n orders = current_user.orders \n render json: orders.as_json \n end",
"title": ""
},
{
"docid": "e0ff6c21e29f3f305208ebb791d726d8",
"score": "0.5639206",
"text": "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"title": ""
},
{
"docid": "e0ff6c21e29f3f305208ebb791d726d8",
"score": "0.5639206",
"text": "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"title": ""
},
{
"docid": "e0ff6c21e29f3f305208ebb791d726d8",
"score": "0.5639206",
"text": "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"title": ""
},
{
"docid": "e0ff6c21e29f3f305208ebb791d726d8",
"score": "0.5639206",
"text": "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"title": ""
},
{
"docid": "e0ff6c21e29f3f305208ebb791d726d8",
"score": "0.5639206",
"text": "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"title": ""
},
{
"docid": "e0ff6c21e29f3f305208ebb791d726d8",
"score": "0.5639206",
"text": "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"title": ""
},
{
"docid": "e0ff6c21e29f3f305208ebb791d726d8",
"score": "0.5639206",
"text": "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"title": ""
},
{
"docid": "e0ff6c21e29f3f305208ebb791d726d8",
"score": "0.5639206",
"text": "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"title": ""
},
{
"docid": "e0ff6c21e29f3f305208ebb791d726d8",
"score": "0.5639206",
"text": "def index\n @orders = Order.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"title": ""
},
{
"docid": "899e016c61e764cb326326c94d8de7f2",
"score": "0.5634172",
"text": "def index\n order_lines = OrderLine.where(order: @order)\n\n render json: OrderLinesSerializer.new(order_lines)\n end",
"title": ""
},
{
"docid": "7fe6e8b72da90feb1a116cd9daaaebef",
"score": "0.5624295",
"text": "def index\n @place_orders = PlaceOrder.all\n render json: @place_orders\n end",
"title": ""
},
{
"docid": "8e052c90706e811866b4fa41cb5e5ead",
"score": "0.5603299",
"text": "def add orderEntity:\n\n end",
"title": ""
},
{
"docid": "7ba46585e316a81bdbf6e03c703f2bab",
"score": "0.56031084",
"text": "def index\n @orders = Order.find_all_by_user_id(current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end",
"title": ""
},
{
"docid": "fb9f9da16f6744c3fa9c66b0642ee63e",
"score": "0.56014675",
"text": "def index\n @user = User.find(params[:user_id])\n @orders = @user.orders.order(:created_at)\n end",
"title": ""
},
{
"docid": "406e67ffbd58b84b39c7e917de82004f",
"score": "0.5590777",
"text": "def query_order(options)\n request :signed, :get, :order, options\n end",
"title": ""
},
{
"docid": "825f349450af8e53d4a93a82064eacb8",
"score": "0.5578466",
"text": "def get_customer_orders\n json_response({ message: 'NOT IMPLEMENTED' })\n end",
"title": ""
},
{
"docid": "a3947a6ecde241dad81bdeaa0c5eaec0",
"score": "0.5573565",
"text": "def create\n ActiveRecord::Base.transaction do\n begin\n @api_v1_order = Order.create!(api_v1_order_params)\n\n params[:products_id].each do |product_id|\n @api_v1_order.products << Product.find(product_id)\n end\n\n Api::V1::OrderMailer.new_order(@api_v1_order).deliver_now\n\n json_response @api_v1_order.as_json(methods: [:total, :products]), :created\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n raise ActiveRecord::Rollback\n end\n end\n end",
"title": ""
}
] |
2b41e90c3c63d710f36be1409832b0c8
|
DELETE /course_applications/1 DELETE /course_applications/1.json
|
[
{
"docid": "c66600c83a7345e6d10875f49eb5ec8f",
"score": "0.78258574",
"text": "def destroy\n @course_application.destroy\n respond_to do |format|\n format.html { redirect_to course_applications_url }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
[
{
"docid": "35db10a2bb6e1ee9f8b5399eb9103109",
"score": "0.7526927",
"text": "def destroy\n @course_application.destroy\n respond_to do |format|\n format.html { redirect_to course_applications_url, notice: 'Course application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "10154da90b783be0d47c884987e275d6",
"score": "0.72370875",
"text": "def delete_application(application_id)\n start.uri('/api/application')\n .url_segment(application_id)\n .url_parameter('hardDelete', true)\n .delete()\n .go()\n end",
"title": ""
},
{
"docid": "2d4aaad352059af5a178a774495e5a5e",
"score": "0.7211735",
"text": "def destroy\n @clients_application = ClientsApplication.find(params[:id])\n @clients_application.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_applications_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "c3a54b6be75273242883d0f889e9a731",
"score": "0.72083706",
"text": "def delete_ta\n @course = Course.find params[:id]\n @matching = AppCourseMatching.where(\"student_application_id = ? and course_id = ?\", params[:ta_id], params[:id]).first\n @matching.destroy\n\n @studentapplication = StudentApplication.find(params[:ta_id])\n # @studentapplication.status = StudentApplication::UNDER_REVIEW\n # @studentapplication.course_assigned = 0\n # @studentapplication.save!\n render json:{\"ta_id\"=>params[:ta_id], \"course_id\"=>params[:id], \"status\"=>\"success\", \"operation\"=>\"delete\"}\n end",
"title": ""
},
{
"docid": "d115689195204e31d7e22a99ff4412e7",
"score": "0.7170162",
"text": "def delete_application(application_id)\n start.uri('/api/application')\n .url_segment(application_id)\n .url_parameter('hardDelete', true)\n .delete()\n .go()\n end",
"title": ""
},
{
"docid": "a5a7e41ed63774ef0305c2c4a87d634e",
"score": "0.71525955",
"text": "def destroy\n @acc_application.destroy\n respond_to do |format|\n format.html { redirect_to acc_applications_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9d3132fa4d9f52107547a6a1974a50ab",
"score": "0.7103466",
"text": "def delete_app name\n try_json delete(\"/app/#{name}\")\n end",
"title": ""
},
{
"docid": "aead6d8aae804daa738f64b720e95b6b",
"score": "0.7080997",
"text": "def destroy\n @app = ClientApp.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to(apps_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "7795262acc610960b0c1aaab0d0d7c98",
"score": "0.7075666",
"text": "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to job_apps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e478a951415dd2c56cbeca82872d6bd5",
"score": "0.7073668",
"text": "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e478a951415dd2c56cbeca82872d6bd5",
"score": "0.7073668",
"text": "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e478a951415dd2c56cbeca82872d6bd5",
"score": "0.7073668",
"text": "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "90f5ac3ba1f4a5b6ade0639be8b34f99",
"score": "0.70547664",
"text": "def destroy\n @program_enrollment.destroy\n respond_to do |format|\n format.html { redirect_to programs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e096a4d903a7b86504fc1b14319bb64f",
"score": "0.7041387",
"text": "def destroy\n @core_application = Core::Application.find(params[:id])\n @core_application.destroy\n\n respond_to do |format|\n format.html { redirect_to core_applications_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "9192b837c2c2368b95e79c6ff3e1d87e",
"score": "0.70399404",
"text": "def destroy\n @concourse = Concourse.find(params[:id])\n @concourse.destroy\n\n respond_to do |format|\n format.html { redirect_to concourses_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "489932d9e29d5889be3c7465a2e57518",
"score": "0.7028143",
"text": "def destroy\n @phasetwo_application.destroy\n respond_to do |format|\n format.html { redirect_to acc_applications_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3edc08d83d9b6531371b903dbdd3a7e9",
"score": "0.69930875",
"text": "def destroy\n @application_detail.destroy\n respond_to do |format|\n format.html { redirect_to application_details_url, notice: 'Rest URI was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cb7c636f641a2b1bb5432da1cb4f5ae7",
"score": "0.6987903",
"text": "def destroy\n @exam_application.destroy\n respond_to do |format|\n format.html { redirect_to exam_applications_url, notice: 'Exam application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "128adfc7af8c789c00e8dc798f017c28",
"score": "0.6968505",
"text": "def destroy\n @course = Course.find(params[:id])\n @course.destroy\n render json: {success: \"ok\"}\n\n end",
"title": ""
},
{
"docid": "2ef14f6f0a2c66da6a3fb2a91af29773",
"score": "0.6961679",
"text": "def destroy\n @app_detail.destroy\n respond_to do |format|\n format.html { redirect_to app_details_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0914b357805cefc2624b7bbfcf94972a",
"score": "0.6960615",
"text": "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0914b357805cefc2624b7bbfcf94972a",
"score": "0.6960615",
"text": "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "df0c4f433b8a5c85faf0417a17407a24",
"score": "0.6934176",
"text": "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "0b36234b2cd230079a3f193b246ed128",
"score": "0.6932525",
"text": "def destroy\n @college_application = @participant.college_applications.find(params[:id])\n @college_application.destroy\n\n respond_to do |format|\n format.html { redirect_to(participant_path(@participant, :anchor => \"!/section/college_applications\")) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "6bac329c89711953ca6bc8811a7cd45a",
"score": "0.6919009",
"text": "def delete_app name\n\t\t\tdelete(\"/apps/#{name}.json?token=#{auth_token}\")\n\t\tend",
"title": ""
},
{
"docid": "e4f03cb760fb5fe80c7301944f2eb39b",
"score": "0.69159734",
"text": "def destroy\n @api_v1_course.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_courses_url, notice: 'Course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e2338760ba11e338cfa749197cb9ac1f",
"score": "0.6907661",
"text": "def destroy\n @action_program = ActionProgram.find(params[:id])\n @action_program.destroy\n\n respond_to do |format|\n format.html { redirect_to action_programs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5bbe33d009b93440cff4098d88b97f6c",
"score": "0.69023186",
"text": "def delete\n\n render json: { message: \"this is not needed right now\" }\n\n # @applications = Application.destroy_all\n # if @applications.present?\n # puts \"deleting...\"\n # render json: { message: \"ok\" }\n # else\n # render json: { message: \"nothing to delete\" }\n # end\n \n end",
"title": ""
},
{
"docid": "daeb2ba674793ea8c1f0b4685a40ef18",
"score": "0.68874073",
"text": "def destroy\n @single_app.destroy\n respond_to do |format|\n format.html { redirect_to single_apps_url, notice: 'Single app was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "fbb5a8b2e476b35e2ee04cd6a3d50879",
"score": "0.68856925",
"text": "def delete(id)\n json = @connection.delete(\"/v_beta/apps/#{id}\")\n end",
"title": ""
},
{
"docid": "e55a9cfe990b0eea61fda804ba93270e",
"score": "0.688312",
"text": "def destroy\n if @course.destroy\n render json: nil, status: :ok\n else\n render json: nil, status: :internal_server_error\n end\n end",
"title": ""
},
{
"docid": "3010e862689522115698da578e8fe202",
"score": "0.687487",
"text": "def destroy\n @request_application.destroy\n respond_to do |format|\n format.html { redirect_to request_applications_url, notice: t('message.template.scaffold.destroy', model: t('activerecord.models.request_application')) }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ae63bd8bfb9120134a0d2f27b06a7b86",
"score": "0.68719786",
"text": "def destroy\n @exam_course = ExamCourse.find(params[:id])\n @exam_course.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_courses_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8e8a1f9835766fe499d589dd46d3a158",
"score": "0.68700504",
"text": "def destroy\n @aq_program = AqProgram.find(params[:id])\n @aq_program.destroy\n\n respond_to do |format|\n format.html { redirect_to aq_programs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e5d10b78a473d7f31197fe2118cb7a8f",
"score": "0.68690485",
"text": "def destroy\n @experiment_system_app = ExperimentSystemApp.find(params[:id])\n @experiment_system_app.destroy\n\n respond_to do |format|\n format.html { redirect_to experiment_system_apps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3edf0bb7bb1ee6d2a22c5a095890cbd1",
"score": "0.68653613",
"text": "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to edit_app_url(@app), notice: 'App was succussfully removed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8b34eba501fe79793a5edff2602a7596",
"score": "0.6848824",
"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": "509d71fbf221a6e1da4ff412c35f2372",
"score": "0.68461573",
"text": "def destroy\n @program_university_course.destroy\n respond_to do |format|\n format.html { redirect_to program_university_courses_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "20029e25813e1677c987963c4bdc45d5",
"score": "0.68404114",
"text": "def destroy\n @admin_applct.destroy\n respond_to do |format|\n format.html { redirect_to admin_applcts_url, notice: 'Applct was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8ea98161309f6e1eb2b173c8f0ea983a",
"score": "0.68199706",
"text": "def destroy\n @collection_program.destroy\n respond_to do |format|\n format.html { redirect_to collection_programs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "229b8dff34c8e22103e0acb9e98e194a",
"score": "0.68159616",
"text": "def destroy\n @program.destroy\n respond_to do |format|\n format.html { redirect_to '/admin' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cc1ceee6c032b199ed302927767331a4",
"score": "0.6813345",
"text": "def destroy\n @application = Application.find(params[:id])\n \n @assignments = Assignment.where(:application_id => params[:id])\n\n @assignments.each do |a|\n a.destroy\n end\n\n @application.destroy\n \n respond_to do |format|\n format.html { redirect_to applications_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "783254991046929dc1c3b2f56bc09359",
"score": "0.68039715",
"text": "def destroy\n @app_key = AppKey.find(params[:id])\n @app_key.destroy\n\n respond_to do |format|\n format.html { redirect_to app_keys_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "414c978e313c77c08b71d852e110b557",
"score": "0.67918557",
"text": "def destroy\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cee4c738dd5d8af86d77a732152e5093",
"score": "0.6789701",
"text": "def destroy\n @primary_course.destroy\n respond_to do |format|\n format.html { redirect_to primary_courses_url, notice: 'Primary course was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5ca7466098c281df227de24ececf7ac3",
"score": "0.67747736",
"text": "def destroy\n @programme_course.destroy\n respond_to do |format|\n format.html { redirect_to programmes_url, notice: \"Programme course was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a8c76748538f9ca7754cfbfaeffed618",
"score": "0.6770582",
"text": "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to admin_apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "72bd1ddae22db1a71438802d98e4e46d",
"score": "0.67635494",
"text": "def destroy\n @certificate_application.destroy\n respond_to do |format|\n format.html { redirect_to certificate_applications_url, notice: 'Certificate application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b0c7e5904e92d69745e09dc4e5c0b288",
"score": "0.6761875",
"text": "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b0c7e5904e92d69745e09dc4e5c0b288",
"score": "0.6761875",
"text": "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "b0c7e5904e92d69745e09dc4e5c0b288",
"score": "0.6761875",
"text": "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to apps_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4ada3fbeb91a7a7929b4697049043bd0",
"score": "0.6758892",
"text": "def destroy\n @student_app_cat_217127274.destroy\n respond_to do |format|\n format.html { redirect_to student_app_cat_217127274s_url, notice: 'Student app cat 217127274 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "560e897eb22f65b19b753d728181f3a9",
"score": "0.6755038",
"text": "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to startups_url, notice: 'App was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "cd566af80cf8003860232705c7caeab6",
"score": "0.6753977",
"text": "def destroy\n @client_program = ClientProgram.find(params[:id])\n @client_program.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_programs_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "13ce9f9001c06d4ae7454d19a703bd1d",
"score": "0.67522967",
"text": "def destroy\n @app.destroy\n respond_to do |format|\n format.html { redirect_to apps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2c2dc1c8d135ce303fdbeadb9fe4eadc",
"score": "0.6749258",
"text": "def destroy\n @ios_application = IosApplication.find(params[:id])\n @ios_application.destroy\n\n respond_to do |format|\n format.html { redirect_to ios_applications_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "04e0f77307f816162c2dd62c5a1c6492",
"score": "0.6744393",
"text": "def destroy\n \t@studentcourse = Studentcourse.find(params[:id])\n @studentcourse.destroy\n render json: {success: \"ok\"}\n end",
"title": ""
},
{
"docid": "dc615e69f3adf55d5adc49d790bb3d2e",
"score": "0.67427486",
"text": "def destroy\n @applist.destroy\n respond_to do |format|\n format.html { redirect_to applists_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3999aa12378683cfad98840a115d1720",
"score": "0.67425305",
"text": "def destroy\n @program.destroy\n respond_to do |format|\n format.html { redirect_to programs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3999aa12378683cfad98840a115d1720",
"score": "0.67425305",
"text": "def destroy\n @program.destroy\n respond_to do |format|\n format.html { redirect_to programs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3999aa12378683cfad98840a115d1720",
"score": "0.67425305",
"text": "def destroy\n @program.destroy\n respond_to do |format|\n format.html { redirect_to programs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3999aa12378683cfad98840a115d1720",
"score": "0.67425305",
"text": "def destroy\n @program.destroy\n respond_to do |format|\n format.html { redirect_to programs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3999aa12378683cfad98840a115d1720",
"score": "0.67425305",
"text": "def destroy\n @program.destroy\n respond_to do |format|\n format.html { redirect_to programs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "690b9f95dde83c2c6a4c3d4a91ede9a9",
"score": "0.6739925",
"text": "def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to course_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "dd0085421e0360b0edda0b2ada2ee6cd",
"score": "0.673059",
"text": "def destroy\n @climb_app.destroy\n respond_to do |format|\n format.html { redirect_to climb_apps_url, notice: 'ClimbApp was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7876a599623b3a620565729520a09095",
"score": "0.6729551",
"text": "def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to explore_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "37550b8e9c6fbfbc68510e78ae2baba5",
"score": "0.67239964",
"text": "def destroy\n @app_batch = AppBatch.find(params[:id])\n @app_batch.destroy\n\n respond_to do |format|\n format.html { redirect_to app_batches_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7db57bdbfd08c0bac5169e26c780473c",
"score": "0.6723523",
"text": "def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7db57bdbfd08c0bac5169e26c780473c",
"score": "0.6723523",
"text": "def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7db57bdbfd08c0bac5169e26c780473c",
"score": "0.6723523",
"text": "def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7db57bdbfd08c0bac5169e26c780473c",
"score": "0.6723523",
"text": "def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7db57bdbfd08c0bac5169e26c780473c",
"score": "0.6723523",
"text": "def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7db57bdbfd08c0bac5169e26c780473c",
"score": "0.6723523",
"text": "def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7db57bdbfd08c0bac5169e26c780473c",
"score": "0.6723523",
"text": "def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7db57bdbfd08c0bac5169e26c780473c",
"score": "0.6723523",
"text": "def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7db57bdbfd08c0bac5169e26c780473c",
"score": "0.6723523",
"text": "def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7db57bdbfd08c0bac5169e26c780473c",
"score": "0.6723523",
"text": "def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7db57bdbfd08c0bac5169e26c780473c",
"score": "0.6723523",
"text": "def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6d12c4451d200e505e8c4e1dfc40c185",
"score": "0.672323",
"text": "def destroy\n @application = Application.find(params[:id])\n @application.destroy\n\n respond_to do |format|\n format.html { redirect_to applications_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6d12c4451d200e505e8c4e1dfc40c185",
"score": "0.672323",
"text": "def destroy\n @application = Application.find(params[:id])\n @application.destroy\n\n respond_to do |format|\n format.html { redirect_to applications_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6d12c4451d200e505e8c4e1dfc40c185",
"score": "0.672323",
"text": "def destroy\n @application = Application.find(params[:id])\n @application.destroy\n\n respond_to do |format|\n format.html { redirect_to applications_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6d12c4451d200e505e8c4e1dfc40c185",
"score": "0.672323",
"text": "def destroy\n @application = Application.find(params[:id])\n @application.destroy\n\n respond_to do |format|\n format.html { redirect_to applications_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6d12c4451d200e505e8c4e1dfc40c185",
"score": "0.672323",
"text": "def destroy\n @application = Application.find(params[:id])\n @application.destroy\n\n respond_to do |format|\n format.html { redirect_to applications_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6d12c4451d200e505e8c4e1dfc40c185",
"score": "0.672323",
"text": "def destroy\n @application = Application.find(params[:id])\n @application.destroy\n\n respond_to do |format|\n format.html { redirect_to applications_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7db57bdbfd08c0bac5169e26c780473c",
"score": "0.67226726",
"text": "def destroy\n @course.destroy\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6f71364ea82b8990f4f52b7349f0873e",
"score": "0.6718369",
"text": "def destroy\n @apparel = Apparel.find(params[:id])\n @apparel.destroy\n\n respond_to do |format|\n format.html { redirect_to apparels_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2c9e2eda44fd729e054304f94f402939",
"score": "0.6717944",
"text": "def destroy\n @commission_program.destroy\n respond_to do |format|\n format.html { redirect_to commission_programs_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "049765e92794781e154c430362286626",
"score": "0.6717044",
"text": "def destroy\n @app_add.destroy\n respond_to do |format|\n format.html { redirect_to app_adds_url, notice: 'App add was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "481ef74c1ae2a16a5aff67641475e872",
"score": "0.6713656",
"text": "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to(cms_apps_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "1155d61839056b78cdcd3f80a24b2499",
"score": "0.6713163",
"text": "def destroy\n @application.destroy\n respond_to do |format|\n format.html { redirect_to manage_applications_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "91d45c8c513248903af948fc1da259c9",
"score": "0.6712801",
"text": "def destroy\n @check_app.destroy\n respond_to do |format|\n format.html { redirect_to check_apps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "8098aba1df5476685b1ba11b47131285",
"score": "0.6711264",
"text": "def destroy\n @course = Course.find(params[:id])\n #authorize! :destroy, @course\n @course.snapshot = nil\n @course.save\n @course.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": "cbd6685a1a54e9ae70a3fc3d8bd142e7",
"score": "0.6709861",
"text": "def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "cbd6685a1a54e9ae70a3fc3d8bd142e7",
"score": "0.6709861",
"text": "def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "cbd6685a1a54e9ae70a3fc3d8bd142e7",
"score": "0.6709861",
"text": "def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "cbd6685a1a54e9ae70a3fc3d8bd142e7",
"score": "0.6709861",
"text": "def destroy\n @course = Course.find(params[:id])\n @course.destroy\n\n respond_to do |format|\n format.html { redirect_to courses_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "675e9eeba3fd8d466a679ff93b8cdfe5",
"score": "0.6704846",
"text": "def destroy\n @app_link.destroy\n respond_to do |format|\n format.html { redirect_to app_links_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0c6d4d986d59373926377d1d5090cd8d",
"score": "0.67045075",
"text": "def destroy\n @status_course = StatusCourse.find(params[:id])\n @status_course.destroy\n\n respond_to do |format|\n format.html { redirect_to status_courses_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e7ceaf6190425c069f9780767634a08e",
"score": "0.670058",
"text": "def destroy\n @app = App.find(params[:id])\n @app.destroy\n\n respond_to do |format|\n format.html { redirect_to user_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ae71fac6db9d19632895a3dfa87358e8",
"score": "0.66902655",
"text": "def destroy\n @customer_app.destroy\n respond_to do |format|\n format.html { redirect_to customer_apps_url }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
b6ad3d00ab18a50cf64bf3c44d78bd27
|
POST /users POST /users.json
|
[
{
"docid": "94af237fe61d9ea5f5c358200b9b80d3",
"score": "0.0",
"text": "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'Пользователь успешно создан.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "24c5e44d772da89269600975eeebdfda",
"score": "0.71918935",
"text": "def create\n @user = User.new(user_params)\n @user.save\n json_response(@user, :created)\n end",
"title": ""
},
{
"docid": "6e1490da4a56756e02c8de2a503a156e",
"score": "0.7185745",
"text": "def create\n user = User.create(user_params)\n render json: user \n end",
"title": ""
},
{
"docid": "abbd4ae1bf5b73d33895ce37a232ee4e",
"score": "0.71666557",
"text": "def create\n uri = \"http://localhost:3000/api/v1/users\"\n payload = params.to_json # converting the params to json\n rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n begin\n rest_resource.post payload , :content_type => \"application/json\"\n flash[:notice] = \"User Saved successfully\"\n redirect_to users_path # take back to index page, which now list the newly created user also\n # rescue RestClient::ExceptionWithResponse => e\n # e.response\n rescue Exception => e\n flash[:error] = \"User Failed to save\"\n render :new\n end\n end",
"title": ""
},
{
"docid": "37985c48d5b61c8f5cf1435be046c885",
"score": "0.71521175",
"text": "def create\n # Cria um novo usuário\n \tuser = User.new(users_params)\n \tif user.save\n \t\trender json: :success, status: 201\n \telse\n \t\trender json: user.errors, status: :unprocessable_entity\n \tend\n end",
"title": ""
},
{
"docid": "6daf8ec468346206f77462c0cc6e3f8f",
"score": "0.71345496",
"text": "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: 201\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "22201f22e629399ac67e583badeab894",
"score": "0.71198785",
"text": "def post_users_json payload\n\tJSON.parse ( rest_client_request :post, HF_URL, payload ).body\nend",
"title": ""
},
{
"docid": "43ac909a0952d35ac026c86ef452bec1",
"score": "0.7099925",
"text": "def create\n @user = User.create!(user_params)\n json_response(@user, :created)\n end",
"title": ""
},
{
"docid": "43ac909a0952d35ac026c86ef452bec1",
"score": "0.7099925",
"text": "def create\n @user = User.create!(user_params)\n json_response(@user, :created)\n end",
"title": ""
},
{
"docid": "0d97a0230ec27d27301f84e74feba42a",
"score": "0.70846635",
"text": "def create\n user = User.new(user_params)\n if user.save\n render json: { status: :success, data: user.to_json }\n else\n render json: { status: :error, data: user.errors }\n end\n end",
"title": ""
},
{
"docid": "07dda66443bfdb3ed32429d4dc792c3e",
"score": "0.70836794",
"text": "def create\n @user = User.new(user_params)\n if @user.save\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "6f147d0743269674e02acd0b2139f2a5",
"score": "0.70759267",
"text": "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "7dce7921df400608e751f4f96f67f54b",
"score": "0.7072552",
"text": "def create\n @user = User.new(user_params)\n if @user.save\n render json: @user, status: 200\n else\n render error: {error: 'Unble to create user'}, status: 400\n end\n end",
"title": ""
},
{
"docid": "59a72dc48a5d3d6fbd6229f5b7c7687a",
"score": "0.7064762",
"text": "def create\n user = User.new(user_params)\n if user.save\n render json: user, status: 201, location: [:api, user]\n else\n failed_to_create(user, \"user\")\n end\n end",
"title": ""
},
{
"docid": "1d4ed059e259909d177e4a88f47f05bc",
"score": "0.7058827",
"text": "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "d8ffcf4fd633958a8947bac4db9cb5dc",
"score": "0.70581484",
"text": "def create \n @user = User.create(user_params)\n json_response(@user) # return created user, to signify that the user was created\n end",
"title": ""
},
{
"docid": "ebd87ad8d229bd8cd7de2ac155d7b227",
"score": "0.7037434",
"text": "def create\n @user = User.create(user_params)\n if @user.save\n render json: @user, status: :created\n end\n end",
"title": ""
},
{
"docid": "e9fbfa1bc53a2ac4bd58c00bd1d5638f",
"score": "0.70279425",
"text": "def create\n @user = User.new(user_params(params[:user]))\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "e9fbfa1bc53a2ac4bd58c00bd1d5638f",
"score": "0.70279425",
"text": "def create\n @user = User.new(user_params(params[:user]))\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "e9fbfa1bc53a2ac4bd58c00bd1d5638f",
"score": "0.70279425",
"text": "def create\n @user = User.new(user_params(params[:user]))\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "e9fbfa1bc53a2ac4bd58c00bd1d5638f",
"score": "0.70279425",
"text": "def create\n @user = User.new(user_params(params[:user]))\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "f47048db1e9115b5c630f9714cc0f75d",
"score": "0.7023704",
"text": "def create\n @user = User.new(params[:user])\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "a2d70996dc3fb75fa1611a5ac10678ec",
"score": "0.7009444",
"text": "def create\n @user = User.new(user_params)\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "3cdb8f63f18ee02e93e12fe2be0dfdd1",
"score": "0.70021695",
"text": "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "3cdb8f63f18ee02e93e12fe2be0dfdd1",
"score": "0.70021695",
"text": "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "3cdb8f63f18ee02e93e12fe2be0dfdd1",
"score": "0.70021695",
"text": "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "3cdb8f63f18ee02e93e12fe2be0dfdd1",
"score": "0.70021695",
"text": "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "3cdb8f63f18ee02e93e12fe2be0dfdd1",
"score": "0.70021695",
"text": "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "027dceb0e06879f9dd82e3267096fab6",
"score": "0.6988802",
"text": "def create\n user = User.new(user_params)\n if user.save\n render(json: user.as_json, status: :ok)\n else\n render(json: {error: \"Erro ao criar usuário\"}, status: :ok) \n end\n end",
"title": ""
},
{
"docid": "e1e13eee09f048e261c1adc854f89ba8",
"score": "0.6984628",
"text": "def create_user(user_id, request)\n start.uri('/api/user')\n .url_segment(user_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .post()\n .go()\n end",
"title": ""
},
{
"docid": "60008e55efe5e005c89473989a349a73",
"score": "0.6979338",
"text": "def create\n @newUser = User.new user_params\n @newUser.save\n respond_to do |format|\n format.json { render :json =>{ :user => @newUser } }\n end\n end",
"title": ""
},
{
"docid": "8ec352eb64ac87719368e0a6384df870",
"score": "0.6977727",
"text": "def create\n @user = User.new(user_params)\n \n if @user.save\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "f0e15f4bfe9ccb2e01928c79b410056f",
"score": "0.6974681",
"text": "def create\n @user = User.new(user_params)\n if @user.save\n render json: @user\n else\n render json: { error: @user.errors }, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "2354332fa19a242825b6ebad7478bd81",
"score": "0.6971428",
"text": "def create\n user = User.new(user_params)\n\n if user.save\n render json: user, status: 201\n else\n render json: { errors: user.errors }, status: 422\n end\n end",
"title": ""
},
{
"docid": "38c2fae14c3a3237a50d99d7804078da",
"score": "0.6971035",
"text": "def create\n user = User.new(user_params)\n\n if user.save\n render json: user, status: 201\n\n else\n render json: { errors: user.errors}, status: 422\n end\n end",
"title": ""
},
{
"docid": "d892405a3f0fdac5f0e4edb1975899f2",
"score": "0.6967278",
"text": "def create_user(user_id, request)\n start.uri('/api/user')\n .url_segment(user_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .post()\n .go()\n end",
"title": ""
},
{
"docid": "81d92dd09d4653c74e47d465e6ea0518",
"score": "0.6967081",
"text": "def create\n @user = User.new(user_params)\n if @user.valid?\n @user.save\n render json: @user\n else\n render json: { error: 'failed to create user' }, status: :not_acceptable\n end\n end",
"title": ""
},
{
"docid": "4dae5bffafa98da4d6846fa897e239db",
"score": "0.6941792",
"text": "def create_user\n url = Addressable::URI.new(\n scheme: 'http',\n host: 'localhost',\n port: 3000,\n path: '/users.json'\n ).to_s\n\n puts RestClient.post(\n url,\n { user: { username: \"Gizmo\"} }\n )\nend",
"title": ""
},
{
"docid": "e52b492f541859fc0188a4774fd33dae",
"score": "0.69242287",
"text": "def create\n new_user = User.create!(user_params)\n json_response(new_user, :created)\n end",
"title": ""
},
{
"docid": "84f6f74cea05ed6a92c458db2e2a5f02",
"score": "0.69229186",
"text": "def create\n @user = User.new(JSON.parse(params[:user]))\n\n respond_to do |format|\n if @user.save\n #format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: Api::V3::UsersPresenter.new().as_json(@user), status: :created, location: @user }\n else\n #format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "5a2bb25163b85a2e77c21abf3f5b2992",
"score": "0.69217014",
"text": "def create\n user = User.new(user_params)\n if user.save\n render json: user, status: 201, location: [:api_v1, user]\n else\n render json: { errors: user.errors }, status: 422\n end\n end",
"title": ""
},
{
"docid": "df5af3912b67fcf0cc3a1b8ec7605de0",
"score": "0.68983114",
"text": "def create\n @user = User.new(user_params(params))\n\t\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "f401cd8bd43122e22ab229e70587952c",
"score": "0.68926907",
"text": "def create\n @user = User.new(user_params)\n\n if @user.save\n return render json: { user: @user }, status: :created\n else\n return render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "5865556aa0e62f502691438f93a69ffa",
"score": "0.68924433",
"text": "def create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\trender json: @user, status: :created\n\t\telse\n\t\t\t render json: @user.errors, status: :unprocessable_entity\n\t\tend \n\tend",
"title": ""
},
{
"docid": "658a9fd767ace4792e059906c9b9d519",
"score": "0.68890357",
"text": "def create\n @user = User.new(user_params)\n if @user.save\n render json: @user\n else\n render json: { errors: @user.errors, status: 400, msg: 'Something went wrong' }\n end\n end",
"title": ""
},
{
"docid": "fa4ad44b4853a5ab1e6aa3313c6d42cf",
"score": "0.6888416",
"text": "def create\n @user = User.new(@json[\"user\"])\n\n if @user.save\n render json: @user\n else\n #internal error, 500\n render nothing: true, status: :internal_server_error\n end\n end",
"title": ""
},
{
"docid": "1cb8d802bb52471afd5d60bf094f9bdb",
"score": "0.6877769",
"text": "def create\n user = User.new(user_params)\n if user.save\n \n render :json => user.to_json, :status => 201\n else\n render json: \"errors\", :status => 422\n end \n end",
"title": ""
},
{
"docid": "94bc59d0b76fc5afd1ed26efc1f78b1f",
"score": "0.68772763",
"text": "def create\n @user = User.new(user_params)\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render_error @user, :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "054d637717a29e21996b88454862fde4",
"score": "0.6873584",
"text": "def create\n @user = User.new(params[:user])\n # p params\n if @user.save\n render json: @user\n else\n render json: { errors: @user.errors.full_messages },\n status: :bad_request\n end\n end",
"title": ""
},
{
"docid": "54eed36c9616b41c583bc458060664be",
"score": "0.6867748",
"text": "def create\n\t\t@user = User.new(user_params)\n\n\t\tif @user.save\n\t\t\trender 'create.json.jbuilder', :status => 201\n\t\telse\n\t\t\trender :json => { :message => @user.errors.full_messages.to_sentence }, :status => 409\n\t\tend\n\tend",
"title": ""
},
{
"docid": "b7779a1b718ac0b72f36ca7b338f68b4",
"score": "0.6859317",
"text": "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: 201\n else\n render json: @user.errors, status: 401\n end\n end",
"title": ""
},
{
"docid": "1096306d19684a613358267ee6cec6ae",
"score": "0.68469584",
"text": "def create\n @user = User.post(params[:user])\n respond_with(@user)\n end",
"title": ""
},
{
"docid": "454a28611de6d6e2ad4c6b59feffe333",
"score": "0.6846166",
"text": "def create\n user = User.new(user_params)\n if user.save\n render json: {\n id: user.id,\n username: user.username,\n jwt: JWT.encode({user_id: user.id}, ENV['JWT_SECRET'], ENV['JWT_ALGORITHM'])\n }\n else\n render json: [{}], status: 404\n end\n end",
"title": ""
},
{
"docid": "948fe14de3a0e77f164961937bb2377b",
"score": "0.6843779",
"text": "def create\n @user = User.create(user_params)\n # /users --> post\n end",
"title": ""
},
{
"docid": "6519b2125a72c68e1248974001dd9d7d",
"score": "0.6840118",
"text": "def create\n \tuser = User.new(user_params)\n \tif user.save\n \t render json: user\n \telse\n \t render error: {error: \"User is not created\", status: 422}\n \tend\n end",
"title": ""
},
{
"docid": "8df22f393bc8ad52aa1665fe604885ca",
"score": "0.6838773",
"text": "def create\n @user = User.new(params[:user])\n \n if @user.save\n respond_to do |format|\n format.json { render :json => @user.to_json, :status => 200 }\n format.html { redirect_to :action => :index }\n end\n else\n respond_to do |format|\n format.json { render :text => \"Could not create user\", :status => :unprocessable_entity } # placeholder\n format.html { render :action => :new, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "617c21c8c23b38ec49f68ddf76b3e7a1",
"score": "0.68316483",
"text": "def create\n user = User.create(user_params)\n if user.save\n render json: { user: user.id }, status: 200\n else\n render json: { user: nil }, status: 404\n end\n end",
"title": ""
},
{
"docid": "cbd2ad899e0e5718a9f666760c98e4c6",
"score": "0.6824439",
"text": "def create\n @user = User.new(user_params)\n if @user.save\n \trender :json => @user, status: :created\n else\n \trender :json => @user.errors.as_json(full_messages: true), status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "34edf9cb44d488f9c2ffe84c2aced578",
"score": "0.6819148",
"text": "def create\n \n username = params[:user][:username]\n email = params[:user][:email]\n\n @user = User.new({:username => username, :email => email })\n\n if @user.save\n render json: {\"status\": 200, \"message\": \"New User Created\"}\n else\n render json: {\"status\": 400, \"message\": \"Error!!\"}\n end\n\n end",
"title": ""
},
{
"docid": "076894e18d6f0bc4f1d3f94666a7cbdd",
"score": "0.681626",
"text": "def create_user(options)\n post('/users', options)\n end",
"title": ""
},
{
"docid": "1ff8d97032e5ef3f2cfa03459366afee",
"score": "0.6812708",
"text": "def create_user(params = {})\n post('users', params)\n end",
"title": ""
},
{
"docid": "ba7c76e12af1b2be7494055bb568e90a",
"score": "0.6802028",
"text": "def create\n params.permit!\n @user = User.new params[:user]\n if @user.save\n render :json => @user, :status => :ok\n else\n render :json => { \"errors\" => @user.errors.full_messages} , :status => :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "748fd1ac2b72a250f33f1d2283f580b1",
"score": "0.6780194",
"text": "def create\n @user = User.new(user_params)\n if @user.save \n render json: { status: :created }\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "b445a8e22ab09449c9d77d1fc73f7865",
"score": "0.6778201",
"text": "def create\n @user = User.new(resource_params)\n\n if @user.save\n render json: @user, status: :created, location: user_url(@user)\n else\n render json: {\n errors: @user.errors\n }, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "dcf86ae36f0a3794e96c047d7e977a82",
"score": "0.677685",
"text": "def create\n @user = User.new(:last_name=>params[:last_name], \n \t:first_name=>params[:first_name],\n \t:email=>params[:email]\n )\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to(@user, :notice => 'User was successfully created.') }\n format.json { render :json => { :success => true, :users => [@user], :id=>@user.id } }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => { :success => false} }\n end\n end\n end",
"title": ""
},
{
"docid": "c16615599afe27e1660e93f6fe4a1be8",
"score": "0.67672867",
"text": "def create\n @user = User.new(user_params)\n if @user.save\n render json: { status: \"success\", message: \"User created successfully!\", data:@user}, status: :ok\n else\n render json: { status: \"error\",message:\"Sad error. Couldn't create user\"}\n end\n end",
"title": ""
},
{
"docid": "d71bc2fc05bad5a6762618f29ce01c52",
"score": "0.6766177",
"text": "def create\n @user = User.build(user_create_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: @user, status: :created }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "34c18e632a95ef9dbcd0fdb5b8a187bd",
"score": "0.67636865",
"text": "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: { message: 'OK' }, status: :ok }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "769ea412b2916fe4c3ab1c258172a945",
"score": "0.67565805",
"text": "def create_user payload\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.post USERS, payload )\n\t\t\t\tend",
"title": ""
},
{
"docid": "f0b9ad9d7740865f9cb3c64752694c1b",
"score": "0.6746631",
"text": "def create\n user = User.new(user_params)\n if user.save\n render json: { id: user.id, email: user.email }, status: :ok\n else\n render json: { message: user.errors.full_messages }, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "f55ace17cf27d9513f62193f9d5c4e7a",
"score": "0.67391396",
"text": "def create_user\n validate_params :user\n @user = User.new(params[:user])\n if @user.save\n render :text => {:status => 'ok', :id => @user.id}.to_json\n else\n render :text => {:status => 'fail', :errors => @user.errors}.to_json, :status => :bad_request\n end\n end",
"title": ""
},
{
"docid": "b0b29ebdc89e5e27c5eaee218e155472",
"score": "0.6732917",
"text": "def create\n user = params.clone\n name = user[:user_id]\n user.delete :user_id\n user.delete :action\n user.delete :controller\n user[:name] = name\n @user = User.new(user)\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "3ed48f500418d53e87c9e54731489c3d",
"score": "0.6731942",
"text": "def create\n @user = User.new(params[:user])\n \n respond_to do |format|\n if @user.save\n format.json { render :json => @user.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { redirect_to users_path, :notice => 'User was successfully created.' }\n else\n format.json { render :text => \"Could not create user\", :status => :unprocessable_entity } \n format.xml { head :ok }\n format.html { render :action => :new, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "15d5461026391c66ddc9d929fa043422",
"score": "0.6728676",
"text": "def create\n #raise params.to_yaml\n @user = User.new(params[:user])\n\n if @user.save\n render :json => @user, :status => :created\n else\n render :json => {:errors => @user.errors, :status =>:unprocessable_entity}\n end\n end",
"title": ""
},
{
"docid": "02abca95cc48e5aebfd552203edd91f6",
"score": "0.672862",
"text": "def create_user\n url = Addressable::URI.new(\n scheme: 'http',\n host: 'localhost',\n port: 3000,\n path: '/users.json'\n ).to_s\n\n begin\n puts RestClient.post(\n url,\n { user: { name: \"Gizmo\", email: '[email protected]' } }\n )\n rescue RestClient::Exception => e\n puts e.message\n end\n\nend",
"title": ""
},
{
"docid": "462fb35deed9c4ab3076a2ca6535edf3",
"score": "0.67267644",
"text": "def create\n user = User.create(user_params)\n if user.valid?\n render json: {user: user}\n else\n errors = user.errors.full_messages\n render json: {errors: errors}\n end\n end",
"title": ""
},
{
"docid": "55cdcaf0a578cf4fcf78c2f31502449c",
"score": "0.6709904",
"text": "def create\n user = User.new(user_params)\n \n if user.save\n render json: {status: 'User created successfully', user_id: user.id, user: user}, status: :created\n else\n render json: { errors: user.errors.full_messages }, status: :bad_request\n end\n end",
"title": ""
},
{
"docid": "24dcdd3c192a18a6349a0be80a7375e1",
"score": "0.6707881",
"text": "def create \n user = User.new(user_params)\n # Return the user details if successful and the error messages if unsuccessful\n if user.save\n render :json => {:authentication_token => user.authentication_token, user: user.as_json(except: [:created_at, :update_at])}, :status => 201\n else\n render json: {:errors => user.errors.messages}, :status => 422\n end\n end",
"title": ""
},
{
"docid": "c745891e90b0caa1ffe023be568372ef",
"score": "0.66996235",
"text": "def create\n @user = User.new(user_credentials)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "5fb6e6662ec44b2da9c4596dd0d068f6",
"score": "0.66963094",
"text": "def register\n post(\"/api/v1/registrations\", params: { \n user: {\n email: \"[email protected]\",\n password: \"a\",\n password_confirmation: \"a\" \n }\n })\n end",
"title": ""
},
{
"docid": "73a0d52bbf83d451021c6961c8af3c6a",
"score": "0.6689118",
"text": "def post(user_form)\n HttpClient::Preconditions.assert_class('user_form', user_form, ::Io::Flow::V0::Models::UserForm)\n r = @client.request(\"/users\").with_json(user_form.to_json).post\n ::Io::Flow::V0::Models::User.new(r)\n end",
"title": ""
},
{
"docid": "4b0b0278b48d74f5d53d6f3ae132cc2f",
"score": "0.66869813",
"text": "def create\n @user = User.new(email: params[:email], username: params[:username].downcase, password: params[:password])\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "8305f67720579dc3912a3125e25c0305",
"score": "0.66852885",
"text": "def create\n @user = User.new(user_params)\n ## @user.save\n if @user.save\n render json: @user, status: :created\n else\n raise(ExceptionHandler::InvalidParameters, 'Invalid User Parameters')\n end\n end",
"title": ""
},
{
"docid": "055009f95035794de8e677216f680bd4",
"score": "0.6683987",
"text": "def create\n user = User.create(user_params)\n puts user.user_name\n render json: user, include: [:user_name]\n end",
"title": ""
},
{
"docid": "3bdc35ee53f1027b20eafdb2ad5a1565",
"score": "0.66725504",
"text": "def create\n\n @user = User.new\n\n #Need the [:teams] because its a hash based on the post, and then\n #within that hash, we access the [:name]\n @user.name = params[:user][:name]\n @user.email = params[:user][:email]\n\n @user.save!\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { render :json => @user }\n end\n\n end",
"title": ""
},
{
"docid": "d0d5c89f778a392bb5d4ccebdf37b43e",
"score": "0.6670256",
"text": "def create\n @user = User.new(params[:user])\n\n if @user.save\n respond_to do |format|\n format.json { render :json => @user.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { redirect_to :action => :index }\n end\n else\n respond_to do |format|\n format.json { render :text => \"Could not create user\", :status => :unprocessable_entity } # placeholder\n format.xml { head :ok }\n format.html { render :action => :new, :status => :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "4772d872ff5305d61ab582d0aa9b605f",
"score": "0.6645682",
"text": "def create\n @user = User.new(user_params)\n if @user.save\n render json: { user: @user, message: \"User created successfully.\"}, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "3b711243d66b8c504d72f2f8229cc9d6",
"score": "0.66424805",
"text": "def create_user\n value = user_params\n create_user = HTTParty.post(ms_ip(\"rg\")+\"/users\", body: value.to_json, :headers => { 'Content-Type' => 'application/json' })\n if create_user.code == 201\n create_ldap = HTTParty.post(ms_ip(\"ldap\")+\"/user/resources/ldapcruds\", body: {\n email: value[:username],\n password: value[:password],\n name: value[:username]\n }.to_json, :headers => { 'Content-Type' => 'application/json' })\n render status: 201, json: create_user.body\n else\n render status: create_user.code, json: create_user.body\n end\n end",
"title": ""
},
{
"docid": "72b38d42f8caef32a447acd08d7237bd",
"score": "0.6642052",
"text": "def post(user_form)\n (x = user_form; x.is_a?(::Io::Flow::V0::Models::UserForm) ? x : ::Io::Flow::V0::Models::UserForm.new(x))\n r = @client.request(\"/users\").with_json(user_form.to_json).post\n ::Io::Flow::V0::Models::User.new(r)\n end",
"title": ""
},
{
"docid": "0aa40ed5dae3cf776f9c6425af089437",
"score": "0.66408306",
"text": "def create\n user_parameters[:name] = user_parameters[:email].split('@').first.split('.').join(' ') if user_parameters[:name].blank?\n render json: User.create!(user_parameters)\n rescue\n render_errors(user.errors.full_messages, :unprocessable_entity)\n end",
"title": ""
},
{
"docid": "c552c6fe60fefc6ca7f75ad540b1c2b9",
"score": "0.66398376",
"text": "def test_should_create_user_via_API_JSON\r\n get \"/logout\"\r\n post \"/users.json\", :api_key=>'testapikey',\r\n :user => {:first_name => 'unit',\r\n :last_name => 'test',\r\n :twitter_id=>'uttwit',\r\n :login => 'ut1',\r\n :password => '12345',\r\n :password_confirmation => '12345',\r\n :email => '[email protected]'}\r\n assert_response :created, \"Incorrect response type\"\r\n user = JSON.parse(response.body)\r\n check_new_user(user) \r\n user = User.find_by_login('ut1')\r\n assert user.active? == true, 'user should be active'\r\n end",
"title": ""
},
{
"docid": "27b9fb671ac6e1db608c681f389082fc",
"score": "0.663958",
"text": "def create\n @user = User.new(user_params)\n\n if [email protected]?\n render json: @user.errors, status: :bad_request\n elsif @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "a33c0e168125252fa684dd279c22aa97",
"score": "0.6639562",
"text": "def create_user(**args)\n request_post('/user', **args)\n end",
"title": ""
},
{
"docid": "267dd56cd70f12e43c6f851f038534a0",
"score": "0.66367537",
"text": "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.json { render :show, status: :created }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e7dc17ce1a24316ba7f5c1b08bee37b5",
"score": "0.66264004",
"text": "def create\n @user = User.new(user_params)\n\n if @user.save\n render :show, status: :created, location: [:api, @user]\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "5a982cfcf17816ee795fd32e51019b20",
"score": "0.66247374",
"text": "def create\n @user = User.new\n @user.name = params[:name]\n @user.dni = params[:dni]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.password_confirmation = params[:password_confirmation]\n @user.save!\n\n render json: { params: params, notice: 'Usuario registrado exitosamente' }\n end",
"title": ""
},
{
"docid": "3093e0fa3aa62524582212431d41e5b1",
"score": "0.6608719",
"text": "def create\n user = User.new(user_params)\n if user.save\n render json:{status: \"Se creó el usuario.\"}, status: :ok\n else\n render json: {status: \"Error al guardar.\", errors: user.errors}, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"docid": "676c94198dbd98516bbb33097aea747e",
"score": "0.6605626",
"text": "def create\n @user = @target.users.new(user_params)\n @user.save\n respond_with(@user)\n end",
"title": ""
},
{
"docid": "29deb566c9a982b6f5e0ce491c0db1fc",
"score": "0.66023237",
"text": "def create\n new_user(user_params)\n\n respond_to do |format|\n if @user.save\n # Send event to Datadog (DEPRECATED) and Segment\n # TODO: Remove Datadog once Segment pipeline is set up\n MetricUtil.put_metric_now(\"users.created\", 1, [\"user_id:#{@user.id}\"])\n\n format.html { redirect_to edit_user_path(@user), notice: \"User was successfully created\" }\n format.json { render :show, status: :created, location: root_path }\n else\n format.html { render :new }\n format.json { render json: @user.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "e11a1e7e0e3edbab77b7385ba9569923",
"score": "0.6599103",
"text": "def users_post(user, opts = {})\n users_post_with_http_info(user, opts)\n nil\n end",
"title": ""
},
{
"docid": "f3b91bf8b3b4807aab0fe737715cb501",
"score": "0.65987664",
"text": "def user_create\n\t\trespond_to do |format|\n\t\t\tnew_user = User.new params.require(:user).permit(:username, :email, :password, :password_confirmation)\n\t\t\tif User.where(:email => new_user.email).count > 0\n\t\t\t\tformat.json { render json: { \"error\" => \"Email ID already taken!\" }, status: 400 }\n\t\t\telsif User.where(:username => new_user.username).count > 0\n\t\t\t\tformat.json { render json: { \"error\" => \"Username already taken!\" }, status: 400 }\n\t\t\telsif new_user.password != new_user.password_confirmation\n\t\t\t\tformat.json { render json: { \"error\" => \"Passwords don't match! Check, and try again.\" }, status: 400 }\n\t\t\telsif new_user.save\n\t\t\t\tformat.json { render json: { \"res\" => new_user }, status: :created }\n\t\t\telse\n\t\t\t\tformat.json { render json: { \"error\" => \"Error while creation!\"}, status: 500 }\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "eed7639218e14c6fe6793d30d6392ba5",
"score": "0.6594311",
"text": "def create\n puts \"created new user\"\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
}
] |
c657de4b70d266e9a3a784b999ea9e60
|
Never trust parameters from the scary internet, only allow the white list through.
|
[
{
"docid": "e89d69926be40576e8ae7e9812b02fd0",
"score": "0.0",
"text": "def user_answer_params\n params.required(:user_answer).permit(:user_id, :question_id, :potential_answer_id)\n end",
"title": ""
}
] |
[
{
"docid": "3663f9efd3f3bbf73f4830949ab0522b",
"score": "0.7495027",
"text": "def whitelisted_params\n super\n end",
"title": ""
},
{
"docid": "13a61145b00345517e33319a34f7d385",
"score": "0.69566035",
"text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "c72da3a0192ce226285be9c2a583d24a",
"score": "0.69225836",
"text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "3d346c1d1b79565bee6df41a22a6f28d",
"score": "0.68929327",
"text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "aa06a193f057b6be7c0713a5bd30d5fb",
"score": "0.67848456",
"text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "f6060519cb0c56a439976f0c978690db",
"score": "0.674347",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "fad8fcf4e70bf3589fbcbd40db4df5e2",
"score": "0.6682223",
"text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end",
"title": ""
},
{
"docid": "b453d9a67af21a3c28a62e1848094a41",
"score": "0.6636527",
"text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "2c8e2be272a55477bfc4c0dfc6baa7a7",
"score": "0.66291976",
"text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "1685d76d665d2c26af736aa987ac8b51",
"score": "0.66258276",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f",
"score": "0.65625846",
"text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"title": ""
},
{
"docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18",
"score": "0.6491194",
"text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e291b3969196368dd4f7080a354ebb08",
"score": "0.6477825",
"text": "def permitir_parametros\n \t\tparams.permit!\n \tend",
"title": ""
},
{
"docid": "2d2af8e22689ac0c0408bf4cb340d8c8",
"score": "0.64526874",
"text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end",
"title": ""
},
{
"docid": "236e1766ee20eef4883ed724b83e4176",
"score": "0.64001405",
"text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"title": ""
},
{
"docid": "b29cf4bc4a27d4b199de5b6034f9f8a0",
"score": "0.63810205",
"text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end",
"title": ""
},
{
"docid": "bfb292096090145a067e31d8fef10853",
"score": "0.63634825",
"text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "6bf3ed161b62498559a064aea569250a",
"score": "0.633783",
"text": "def require_params\n return nil\n end",
"title": ""
},
{
"docid": "b4c9587164188c64f14b71403f80ca7c",
"score": "0.6336759",
"text": "def sanitize_params!\n request.sanitize_params!\n end",
"title": ""
},
{
"docid": "b63e6e97815a8745ab85cd8f7dd5b4fb",
"score": "0.6325718",
"text": "def excluded_from_filter_parameters; end",
"title": ""
},
{
"docid": "38bec0546a7e4cbf4c337edbee67d769",
"score": "0.631947",
"text": "def user_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password)\n end",
"title": ""
},
{
"docid": "37d1c971f6495de3cdd63a3ef049674e",
"score": "0.63146484",
"text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "5ec018b4a193bf3bf8902c9419279607",
"score": "0.63137317",
"text": "def user_params # contains strong parameters\n params.require(:user).permit(:name, :email, :password,\n :password_confirmation)\n # strong parameters disallows any post information that is not permitted (admin security) when signing_up\n # so not all users will get admin access by hacking params using curl\n end",
"title": ""
},
{
"docid": "91bfe6d464d263aa01e776f24583d1d9",
"score": "0.6306224",
"text": "def permitir_parametros\n params.permit!\n end",
"title": ""
},
{
"docid": "e012d7306b402a37012f98bfd4ffdb10",
"score": "0.6301168",
"text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "157e773497f78353899720ad034a906a",
"score": "0.63000035",
"text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end",
"title": ""
},
{
"docid": "8c384af787342792f0efc7911c3b2469",
"score": "0.629581",
"text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end",
"title": ""
},
{
"docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c",
"score": "0.62926817",
"text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end",
"title": ""
},
{
"docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c",
"score": "0.62926817",
"text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end",
"title": ""
},
{
"docid": "9b76b3149ac8b2743f041d1af6b768b5",
"score": "0.6280713",
"text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end",
"title": ""
},
{
"docid": "603f4a45e5efa778afca5372ae8a96dc",
"score": "0.6271388",
"text": "def param_whitelist\n [:role]\n end",
"title": ""
},
{
"docid": "f6399952b4623e5a23ce75ef1bf2af5a",
"score": "0.6266194",
"text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend",
"title": ""
},
{
"docid": "37c5d0a9ebc5049d7333af81696608a0",
"score": "0.6256044",
"text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend",
"title": ""
},
{
"docid": "505e334c1850c398069b6fb3948ce481",
"score": "0.62550515",
"text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end",
"title": ""
},
{
"docid": "6c4620f5d8fd3fe3641e0474aa7014b2",
"score": "0.62525266",
"text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end",
"title": ""
},
{
"docid": "d14bb69d2a7d0f302032a22bb9373a16",
"score": "0.6234781",
"text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend",
"title": ""
},
{
"docid": "5629f00db37bf403d0c58b524d4c3c37",
"score": "0.62278074",
"text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "d370098b1b3289dbd04bf1c073f2645b",
"score": "0.6226693",
"text": "def allow_params\n params.permit(:id, :email, :password)\n end",
"title": ""
},
{
"docid": "fde8b208c08c509fe9f617229dfa1a68",
"score": "0.6226605",
"text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "78cbf68c3936c666f1edf5f65e422b6f",
"score": "0.6226114",
"text": "def whitelisted_user_params\n if params[:user]\n params.require(:user).permit(:email, :username, :password)\n else\n { :email => params[:email],\n :username => params[:username],\n :password => params[:password] }\n end\nend",
"title": ""
},
{
"docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5",
"score": "0.6200643",
"text": "def roaster_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password_digest, :address, :website, :phone, :latitude, :longitutde, :description)\n end",
"title": ""
},
{
"docid": "d724124948bde3f2512c5542b9cdea74",
"score": "0.61913997",
"text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end",
"title": ""
},
{
"docid": "d18a36785daed9387fd6d0042fafcd03",
"score": "0.61835426",
"text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end",
"title": ""
},
{
"docid": "36956168ba2889cff7bf17d9f1db41b8",
"score": "0.6179986",
"text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end",
"title": ""
},
{
"docid": "07bc0e43e1cec1a821fb2598d6489bde",
"score": "0.61630195",
"text": "def accept_no_params\n accept_params {}\n end",
"title": ""
},
{
"docid": "fc4b1364974ea591f32a99898cb0078d",
"score": "0.6160931",
"text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end",
"title": ""
},
{
"docid": "13e3cfbfe510f765b5944667d772f453",
"score": "0.6155551",
"text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end",
"title": ""
},
{
"docid": "84bd386d5b2a0d586dca327046a81a63",
"score": "0.61542404",
"text": "def good_params\n permit_params\n end",
"title": ""
},
{
"docid": "b9432eac2fc04860bb585f9af0d932bc",
"score": "0.61356604",
"text": "def wall_params\n params.permit(:public_view, :guest)\n end",
"title": ""
},
{
"docid": "f2342adbf71ecbb79f87f58ff29c51ba",
"score": "0.61342114",
"text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end",
"title": ""
},
{
"docid": "8fa507ebc4288c14857ace21acf54c26",
"score": "0.61188847",
"text": "def strong_params\n # to dooo\n end",
"title": ""
},
{
"docid": "9292c51af27231dfd9f6478a027d419e",
"score": "0.61140966",
"text": "def domain_params\n params[:domain].permit!\n end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.611406",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.611406",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "a3aee889e493e2b235619affa62f39c3",
"score": "0.61107725",
"text": "def user_params\n params.permit(:full_name, :email, :job, :about, :max_search_distance,\n :website_url, :linkedin_url,\n :behance_url, :github_url, :stackoverflow_url)\n end",
"title": ""
},
{
"docid": "585f461bf01ed1ef8d34fd5295a96dca",
"score": "0.61038506",
"text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "585f461bf01ed1ef8d34fd5295a96dca",
"score": "0.61038506",
"text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.6097247",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.6097247",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "677293afd31e8916c0aee52a787b75d8",
"score": "0.60860336",
"text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end",
"title": ""
},
{
"docid": "e50ea3adc222a8db489f0ed3d1dce35b",
"score": "0.60855556",
"text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end",
"title": ""
},
{
"docid": "b7ab5b72771a4a2eaa77904bb0356a48",
"score": "0.608446",
"text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end",
"title": ""
},
{
"docid": "b2841e384487f587427c4b35498c133f",
"score": "0.6076753",
"text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end",
"title": ""
},
{
"docid": "3f5347ed890eed5ea86b70281803d375",
"score": "0.60742563",
"text": "def user_params\n params.permit!\n end",
"title": ""
},
{
"docid": "0c8779b5d7fc10083824e36bfab170de",
"score": "0.60677326",
"text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end",
"title": ""
},
{
"docid": "7646659415933bf751273d76b1d11b40",
"score": "0.60666215",
"text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end",
"title": ""
},
{
"docid": "fa0608a79e8d27c2a070862e616c8c58",
"score": "0.6065763",
"text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end",
"title": ""
},
{
"docid": "a3dc8b6db1e6584a8305a96ebb06ad21",
"score": "0.60655254",
"text": "def need_params\n end",
"title": ""
},
{
"docid": "4f8205e45790aaf4521cdc5f872c2752",
"score": "0.6064794",
"text": "def search_params\n params.permit(:looking_for, :utf8, :authenticity_token, :min_age,\n :max_age, :sort_by, likes:[])\n end",
"title": ""
},
{
"docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06",
"score": "0.6062697",
"text": "def permitted_params\n params.permit :utf8, :_method, :authenticity_token, :commit, :id,\n :encrypted_text, :key_size\n end",
"title": ""
},
{
"docid": "c436017f4e8bd819f3d933587dfa070a",
"score": "0.60620916",
"text": "def filtered_parameters; end",
"title": ""
},
{
"docid": "d6886c65f0ba5ebad9a2fe5976b70049",
"score": "0.60562736",
"text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end",
"title": ""
},
{
"docid": "96ddf2d48ead6ef7a904c961c284d036",
"score": "0.60491294",
"text": "def user_params\n permit = [\n :email, :password, :password_confirmation,\n :image, :name, :nickname, :oauth_token,\n :oauth_expires_at, :provider, :birthday\n ]\n params.permit(permit)\n end",
"title": ""
},
{
"docid": "f78d6fd9154d00691c34980d7656b3fa",
"score": "0.60490465",
"text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "f78d6fd9154d00691c34980d7656b3fa",
"score": "0.60490465",
"text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "75b7084f97e908d1548a1d23c68a6c4c",
"score": "0.6046521",
"text": "def allowed_params\n params.require(:sea).permit(:name, :temperature, :bio, :mood, :image_url, :favorite_color, :scariest_creature, :has_mermaids)\n end",
"title": ""
},
{
"docid": "080d2fb67f69228501429ad29d14eb29",
"score": "0.6041768",
"text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff",
"score": "0.60346854",
"text": "def parameters\n params.permit(permitted_params)\n end",
"title": ""
},
{
"docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8",
"score": "0.6030552",
"text": "def filter_params\n end",
"title": ""
},
{
"docid": "cf73c42e01765dd1c09630007357379c",
"score": "0.6024842",
"text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end",
"title": ""
},
{
"docid": "793abf19d555fb6aa75265abdbac23a3",
"score": "0.6021606",
"text": "def user_params\n if admin_user?\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter, :active, :admin, :receive_customer_inquiry)\n else\n # Don't allow non-admin users to hack the parameters and give themselves admin security; self created records automatically set to active\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter)\n end\n end",
"title": ""
},
{
"docid": "2e70947f467cb6b1fda5cddcd6dc6304",
"score": "0.6019679",
"text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend",
"title": ""
},
{
"docid": "2a11104d8397f6fb79f9a57f6d6151c7",
"score": "0.6017253",
"text": "def user_params\n sanitize params.require(:user).permit(:username, :password, :password_confirmation, :display_name, :about_me, :avatar, :current_password, :banned, :ban_message)\n end",
"title": ""
},
{
"docid": "a83bc4d11697ba3c866a5eaae3be7e05",
"score": "0.60145336",
"text": "def user_params\n\t params.permit(\n\t :name,\n\t :email,\n\t :password\n\t \t )\n\t end",
"title": ""
},
{
"docid": "2aa7b93e192af3519f13e9c65843a6ed",
"score": "0.60074294",
"text": "def user_params\n params[:user].permit!\n end",
"title": ""
},
{
"docid": "9c8cd7c9e353c522f2b88f2cf815ef4e",
"score": "0.6006753",
"text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6005122",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6005122",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "9736586d5c470252911ec58107dff461",
"score": "0.60048765",
"text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end",
"title": ""
},
{
"docid": "e7cad604922ed7fad31f22b52ecdbd13",
"score": "0.60009843",
"text": "def member_params\n # byebug\n params.require(:member).permit(\n :first_name, \n :last_name, \n :username, \n :email, \n :password, \n :image, \n :family_size, \n :address)\n\n end",
"title": ""
},
{
"docid": "58ad32a310bf4e3c64929a860569b3db",
"score": "0.6000742",
"text": "def user_params\n\t\tparams.require(:user).permit!\n\tend",
"title": ""
},
{
"docid": "58ad32a310bf4e3c64929a860569b3db",
"score": "0.6000742",
"text": "def user_params\n\t\tparams.require(:user).permit!\n\tend",
"title": ""
},
{
"docid": "f70301232281d001a4e52bd9ba4d20f5",
"score": "0.6000161",
"text": "def room_allowed_params\n end",
"title": ""
},
{
"docid": "2e6de53893e405d0fe83b9d18b696bd5",
"score": "0.599852",
"text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.59984183",
"text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.59984183",
"text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end",
"title": ""
},
{
"docid": "a50ca4c82eaf086dcbcc9b485ebd4261",
"score": "0.59947807",
"text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end",
"title": ""
},
{
"docid": "0f53610616212c35950b45fbcf9f5ad4",
"score": "0.5993962",
"text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end",
"title": ""
},
{
"docid": "b545ec7bfd51dc43b982b451a715a538",
"score": "0.5992739",
"text": "def user_params\n params_allowed = %i[email password password_confirmation is_admin]\n params.require(:user).permit(params_allowed)\n end",
"title": ""
},
{
"docid": "0b704016f3538045eb52c45442e7f704",
"score": "0.59911275",
"text": "def admin_params\n filtered_params = params.require(:admin).permit(:display_name, :email, :password, :password_confirmation)\n if filtered_params[:password] == \"\"\n filtered_params.delete(:password)\n filtered_params.delete(:password_confirmation)\n end\n filtered_params\n end",
"title": ""
},
{
"docid": "6af3741c8644ee63d155db59be10a774",
"score": "0.59906775",
"text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end",
"title": ""
}
] |
6741d73188643cca4a62a34532fb5af2
|
Create a replication agent instance.
|
[
{
"docid": "c5e094c376fa7938a365141f141d8514",
"score": "0.7118133",
"text": "def replication_agent(run_mode, name)\n RubyAem::Resources::ReplicationAgent.new(@client, run_mode, name)\n end",
"title": ""
}
] |
[
{
"docid": "c888d37645280f10d8e3e3d67d711980",
"score": "0.6292559",
"text": "def create_replication(request, &block)\n post \"/replicate/\", request, &block\n end",
"title": ""
},
{
"docid": "209027f78f4d350bef7c87a72919db59",
"score": "0.6010549",
"text": "def outbox_replication_agent(run_mode, name)\n RubyAem::Resources::OutboxReplicationAgent.new(@client, run_mode, name)\n end",
"title": ""
},
{
"docid": "642d3435ac27ec749ba26385db436b72",
"score": "0.5784076",
"text": "def createAgent _args\n \"createAgent _args;\" \n end",
"title": ""
},
{
"docid": "1db238c5c56f1cfec878854fe2601ad5",
"score": "0.5651279",
"text": "def create\n\n info(\"Initializing %s MongoDB replica set\" % resource[:host])\n\n command = \"echo 'rs.initiate()' | mongo #{resource[:host]} --quiet\"\n result = `#{command}`\n\n info(\"Sleeping 90 seconds for the replica set to become active\")\n sleep(90)\n\n end",
"title": ""
},
{
"docid": "1a323553737c494e0d68db57203080a9",
"score": "0.5580401",
"text": "def agent_instance\n NewRelic::Agent.instance\n end",
"title": ""
},
{
"docid": "5ac87e4f280d6d7363dc70feb5cb2369",
"score": "0.5555116",
"text": "def reverse_replication_agent(run_mode, name)\n RubyAem::Resources::ReverseReplicationAgent.new(@client, run_mode, name)\n end",
"title": ""
},
{
"docid": "ce36e0fe2ad792b79e0d804fbe09003e",
"score": "0.5526924",
"text": "def initialize(agent)\n @agent = agent\n @agent_identity = agent.identity\n @got_boot_bundle = false\n EM.threadpool_size = 1\n\n # Get notified whenever there is a client status change\n @agent.status { |type, state| update_status(type, state) }\n\n # Initialize state\n RightScale::InstanceState.init(@agent_identity)\n\n # Reset log level here even though already initialized in the agent\n # so that InstanceState gets notified of the level in use\n RightScale::Log.level = agent.options[:log_level] if agent.options[:log_level]\n\n # Schedule boot sequence, don't run it now so agent is registered first\n if RightScale::InstanceState.value == 'booting'\n EM.next_tick { init_boot }\n else\n RightScale::Sender.instance.initialize_offline_queue\n RightScale::Sender.instance.start_offline_queue\n\n # handle case of a decommission which was abruptly interrupted and never\n # shutdown the instance (likely due to a decommission script which induced\n # an unexpected fault in the agent).\n #\n # note that upon successfully reboot (or start of a stopped instance) the\n # instance state file is externally reset to a rebooting state (thus\n # avoiding the dreaded infinite reboot/stop scenario).\n if RightScale::InstanceState.value == 'decommissioning' && (kind = RightScale::InstanceState.decommission_type)\n EM.next_tick { recover_decommission(user_id = nil, skip_db_update = false, kind) }\n end\n end\n end",
"title": ""
},
{
"docid": "1c3f8d07e5c66731b0307463cdf66ee4",
"score": "0.55010146",
"text": "def new\n\n @agent = Agent.new\n end",
"title": ""
},
{
"docid": "a32f12354988c06936549575eb9e81d8",
"score": "0.54965234",
"text": "def create_instance(supervisor)\n Instance.new(supervisor, self, get_instance_id)\n end",
"title": ""
},
{
"docid": "4dc57c7456882465d7cc0e561b689e92",
"score": "0.54626614",
"text": "def create_client\n @client = if @opts[:servers]\n Monga::Clients::ReplicaSetClient.new(@opts)\n else\n Monga::Clients::SingleInstanceClient.new(@opts)\n end\n end",
"title": ""
},
{
"docid": "79bf42388d1834e779b479850d766057",
"score": "0.54371375",
"text": "def start_agent(*args)\n raise 'Agent has already started.' unless @agent.nil?\n\n @agent = @agent_class.new(self)\n\n @agent.start(*args)\n end",
"title": ""
},
{
"docid": "951223ed63f658a7967bbe03a43f7333",
"score": "0.54162425",
"text": "def create(name)\n agent = Client.post(path, { agent: { name: name }}).with_indifferent_access\n new(\n agent[:id],\n agent[:name]\n )\n end",
"title": ""
},
{
"docid": "ae08b11612c94db5cb083dfd63991008",
"score": "0.53567505",
"text": "def create_vm(agent_id, stemcell_id, resource_pool,\n network_spec = nil, disk_locality = nil, environment = nil)\n with_thread_name(\"create_vm(#{agent_id}, ...)\") do\n @logger.info('Creating new server...')\n registry_key = \"vm-#{generate_unique_name}\"\n server_params = {\n name: registry_key,\n os_scheduler_hints: resource_pool['scheduler_hints'],\n config_drive: @use_config_drive,\n }\n\n network_configurator = NetworkConfigurator.new(network_spec, resource_pool['allowed_address_pairs'])\n picked_security_groups = pick_security_groups(server_params, network_configurator, ResourcePool.security_groups(resource_pool))\n pick_stemcell(server_params, stemcell_id)\n flavor = pick_flavor(server_params, resource_pool)\n pick_key_name(server_params, resource_pool)\n\n @logger.debug(\"Using scheduler hints: `#{resource_pool['scheduler_hints']}'\") if resource_pool['scheduler_hints']\n\n pick_availability_zone(server_params, disk_locality, resource_pool['availability_zone'])\n configure_volumes(server_params, flavor, resource_pool)\n\n pick_server_groups(server_params, environment)\n\n availability_zone = @az_provider.select(disk_locality, resource_pool['availability_zone'])\n server_params[:availability_zone] = availability_zone if availability_zone\n\n begin\n @openstack.with_openstack { network_configurator.prepare(@openstack, picked_security_groups.map(&:id)) }\n nics = pick_nics(server_params, network_configurator)\n server = create_server(server_params, nics)\n configure_server(network_configurator, server)\n\n server_tags = {}\n tag_server(server_tags, server, registry_key, network_spec, resource_pool.fetch('loadbalancer_pools', []))\n\n update_server_settings(server, registry_key, agent_id, network_configurator.network_spec, environment,\n flavor_has_ephemeral_disk?(flavor))\n\n server.id.to_s\n rescue StandardError => e\n begin\n destroy_server(server, server_tags) if server\n rescue StandardError => destroy_err\n @logger.warn(\"Failed to destroy server: #{destroy_err.message}\")\n end\n\n begin\n @openstack.with_openstack {\n network_configurator.cleanup(@openstack)\n }\n rescue StandardError => cleanup_error\n @logger.warn(\"Failed to cleanup network resources: #{cleanup_error.message}\")\n end\n raise e\n end\n end\n end",
"title": ""
},
{
"docid": "12599ad2b73d2258178308d97a14a7d6",
"score": "0.5356398",
"text": "def create(args = nil)\n # Connects to the xmpp-client that is used for sending xmpp-messages\n @send_client = connect(@@send_client_info)\n \n # Connect to xmpp-client that is used for receiving messages that are then turn into http-requests\n @receive_client = connect(@@receive_client_info)\n runMessageReceiver\n \n # Ensures that xmpp-server has node: home/host/<host>/<node_account>/contexts\n XmppHelper::createContextGeneralNode\n\n end",
"title": ""
},
{
"docid": "d2005e9a2ebeea8a580c1c7e83e0f432",
"score": "0.5290505",
"text": "def create_vm(agent_id, stemcell_id, vm_type, network_spec, disk_locality = nil, environment = nil)\n with_thread_name(\"create_vm(#{agent_id}, ...)\") do\n # do this early to fail fast\n stemcell = StemcellFinder.find_by_id(@ec2_client, stemcell_id)\n\n begin\n instance, block_device_agent_info = @instance_manager.create(\n agent_id,\n stemcell.image_id,\n vm_type,\n network_spec,\n (disk_locality || []),\n environment,\n options,\n )\n\n logger.info(\"Creating new instance '#{instance.id}'\")\n\n NetworkConfigurator.new(network_spec).configure(@ec2_client, instance)\n\n registry_settings = initial_agent_settings(\n agent_id,\n network_spec,\n environment,\n stemcell.root_device_name,\n block_device_agent_info\n )\n registry.update_settings(instance.id, registry_settings)\n\n instance.id\n rescue => e # is this rescuing too much?\n logger.error(%Q[Failed to create instance: #{e.message}\\n#{e.backtrace.join(\"\\n\")}])\n instance.terminate(fast_path_delete?) if instance\n raise e\n end\n end\n end",
"title": ""
},
{
"docid": "f3d5ed026f8234483a75b6743b59433d",
"score": "0.52735174",
"text": "def create_vm(agent_id, stemcell_id, vm_type, network_spec, disk_locality = nil, environment = nil)\n with_thread_name(\"create_vm(#{agent_id}, ...)\") do\n # do this early to fail fast\n\n target_groups = vm_type.fetch('lb_target_groups', [])\n if target_groups.length > 0\n alb_accessible?\n end\n\n requested_elbs = vm_type.fetch('elbs', [])\n if requested_elbs.length > 0\n elb_accessible?\n end\n\n stemcell = StemcellFinder.find_by_id(@ec2_resource, stemcell_id)\n\n begin\n instance, block_device_agent_info = @instance_manager.create(\n agent_id,\n stemcell.image_id,\n vm_type,\n network_spec,\n (disk_locality || []),\n environment,\n options,\n )\n\n target_groups.each do |target_group_name|\n target_group = LBTargetGroup.new(client: @alb_client, group_name: target_group_name)\n target_group.register(instance.id)\n end\n\n requested_elbs.each do |requested_elb_name|\n requested_elb = ClassicLB.new(client: @elb_client, elb_name: requested_elb_name)\n requested_elb.register(instance.id)\n end\n\n logger.info(\"Creating new instance '#{instance.id}'\")\n\n NetworkConfigurator.new(network_spec).configure(@ec2_resource, instance)\n\n registry_settings = initial_agent_settings(\n agent_id,\n network_spec,\n environment,\n stemcell.root_device_name,\n block_device_agent_info\n )\n registry.update_settings(instance.id, registry_settings)\n\n instance.id\n rescue => e # is this rescuing too much?\n logger.error(%Q[Failed to create instance: #{e.message}\\n#{e.backtrace.join(\"\\n\")}])\n instance.terminate(fast_path_delete?) if instance\n raise e\n end\n end\n end",
"title": ""
},
{
"docid": "0433aad24137321b8a261b2d710695cc",
"score": "0.5255946",
"text": "def create params\n raise_start_server unless Server::node\n new params\n end",
"title": ""
},
{
"docid": "25935c7182edce902265f714133c70d4",
"score": "0.52475274",
"text": "def create\n Feature.bgp_enable if platform == :nexus\n router_bgp\n wait_for_process_initialized\n end",
"title": ""
},
{
"docid": "156137c8c4ab5aafccd06e535cc591b5",
"score": "0.523746",
"text": "def create_agent_ami\n return unless ami_creation_needed?\n # AMI does not exist\n logger.info(\"Creating agent AMI for #{self.region}...\")\n clean_instance = ec2.instances.create(new_ec2_instance_attrs(base_ami, [find_security_group.id]))\n begin\n perform_instance_checks(clean_instance)\n build_ami(clean_instance)\n rescue Exception => ex\n logger.error(\"Failed to create instance on #{self.region}: #{ex.message}, terminating temporary instance...\")\n raise(ex)\n ensure\n terminate_instance(clean_instance) if clean_instance\n end\n end",
"title": ""
},
{
"docid": "c1d1b4d20b29d4e7dc38f1dfcea0229e",
"score": "0.5230926",
"text": "def start_replication(execution, opts = {})\n start_replication_with_http_info(execution, opts)\n nil\n end",
"title": ""
},
{
"docid": "5fe6a16420767be6e734a9dbd085a16b",
"score": "0.5221501",
"text": "def create!(*args, &block)\n instance = new(*args, &block)\n instance.create!\n instance\n end",
"title": ""
},
{
"docid": "ef6678c73b9196e36f36271909da8f1c",
"score": "0.5220916",
"text": "def initialize(agent)\n @agent = agent\n @identity = @agent.identity\n @options = @agent.options || {}\n @broker = @agent.broker\n @secure = @options[:secure]\n @retry_timeout = RightSupport::Stats.nil_if_zero(@options[:retry_timeout])\n @retry_interval = RightSupport::Stats.nil_if_zero(@options[:retry_interval])\n @pending_requests = PendingRequests.new\n\n reset_stats\n @offline_handler = OfflineHandler.new(@options[:restart_callback], @offline_stats)\n @connectivity_checker = ConnectivityChecker.new(self, @options[:ping_interval] || 0, @ping_stats, @exception_stats)\n @@instance = self\n end",
"title": ""
},
{
"docid": "868a975b787272c0ca1e1540b5999fa1",
"score": "0.5170333",
"text": "def create(state)\n info(\"Creating instance #{instance.name}\")\n return if state[:server_id]\n\n domain = create_domain\n state[:server_id] = domain.id\n state[:hostname] = domain.public_ip_address\n\n instance.transport.connection(state).wait_until_ready\n\n info(\"Libvirt instance #{domain.name} created.\")\n end",
"title": ""
},
{
"docid": "55f52a6c8015154ad1341e7abe3dceb1",
"score": "0.5157681",
"text": "def create_slave_object\n raise Exception.new(\"Cannot create slave object unless current object is Master\") unless master?\n raise Exception.new(\"Slave object already exists\") if other_object\n raise Exception.new(\"Cannot create slave object until current object is valid\") unless valid? && persisted?\n\n Rollbar.warning \"Sidekiq not ready\" unless Report.sidekiq_ready?\n MultitenantProxyWorker.perform_async(Customer.tenant_name, self.id)\n end",
"title": ""
},
{
"docid": "8624888f03639d26e0a637d28e06cdfa",
"score": "0.5153665",
"text": "def create_df_agent\n DFAgent.new(\n :ams => ams,\n :df => df,\n :acc => acc,\n :logger => logger,\n :name => fully_qualified_agent_name(\"df\"),\n :addresses => agent_transport_addresses\n )\n end",
"title": ""
},
{
"docid": "2ee5e43fee7ff08c90501ba71e5e061d",
"score": "0.5145518",
"text": "def create_vm(agent_id, stemcell_id, vm_type, network_spec, disk_locality = [], environment = nil)\n raise Bosh::Clouds::CloudError, 'Cannot create VM without registry with CPI v1. Registry not configured.' unless @config.registry_configured?\n\n with_thread_name(\"create_vm(#{agent_id}, ...)\") do\n network_props = @props_factory.network_props(network_spec)\n\n registry = { endpoint: @config.registry.endpoint }\n network_with_dns = network_props.dns_networks.first\n dns = { nameserver: network_with_dns.dns } unless network_with_dns.nil?\n registry_settings = AgentSettings.new(registry, network_props, dns)\n registry_settings.environment = environment\n registry_settings.agent_id = agent_id\n\n instance_id, = @cloud_core.create_vm(agent_id, stemcell_id, vm_type, network_props, registry_settings, disk_locality, environment) do |instance_id, settings|\n @registry.update_settings(instance_id, settings.agent_settings)\n end\n instance_id\n end\n end",
"title": ""
},
{
"docid": "c0ca79d87714faa39857ed3f6da40932",
"score": "0.5121644",
"text": "def create_replication request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_replication_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"title": ""
},
{
"docid": "7ba1860b3680f1aa64648fe9c8719b28",
"score": "0.51113915",
"text": "def new_instance\n if Agent.config[:framework] == :test\n load_test_framework\n else\n load_framework_class(Agent.config[:framework]).new(local_env)\n end\n end",
"title": ""
},
{
"docid": "d3b2ee86ff5283a62310fb219f0cdeb2",
"score": "0.51091915",
"text": "def create_slave_launch_script(master_host, master_port, slave_port, date, options = {})\n options = extract_slave_instance_options(options)\n arguments = default_slave_server_arguments(master_host, master_port, slave_port, date).merge(options)\n create_upstart_script(:slave, date, arguments)\n end",
"title": ""
},
{
"docid": "32e0cc086dd29017423899992bc44307",
"score": "0.50989705",
"text": "def create # rubocop:disable Metrics/AbcSize\n inst_details = AttrFinder.new(@instanceparameters)\n inst_details.options = @options\n inst_details.validate = @validate\n inst_details.function = 'server'\n BmcAuthenticate.new(@options)\n request = OracleBMC::Core::Models::LaunchInstanceDetails.new\n ssh_public_key = @instanceparameters['server']['ssh-key']\n request.availability_domain = inst_details.ad\n request.compartment_id = inst_details.compartment\n request.display_name = @instanceparameters['server']['display_name']\n request.image_id = inst_details.image\n request.shape = @instanceparameters['server']['shape']\n request.subnet_id = inst_details.subnet\n request.metadata = { 'ssh_authorized_keys' => ssh_public_key }\n api = OracleBMC::Core::ComputeClient.new\n response = api.launch_instance(request)\n @instance_id = response.data.id\n compartment(inst_details.compartment)\n running_instance = api.get_instance(@instance_id).wait_until(:lifecycle_state,\n OracleBMC::Core::Models::Instance::LIFECYCLE_STATE_RUNNING,\n max_interval_seconds: 5, max_wait_seconds: 300)\n if @instanceparameters['server']['attachments']\n @instanceparameters['server']['attachments'].each do |vol|\n attach(@instance_id, vol['volume'])\n end\n end\n running_instance\n end",
"title": ""
},
{
"docid": "6fdfe85e966a0ce7f3049885785dfcd3",
"score": "0.5044576",
"text": "def start(*args, &b)\n agent = new(*args, &b)\n return agent.start\n end",
"title": ""
},
{
"docid": "f56d5b9869f8f582f3630a4b666e6b06",
"score": "0.50396556",
"text": "def start_slave(options)\n date = instance_date(options)\n puts \"Starting slave instance of TokyoTyrant for #{date.strftime('%m/%Y')}\"\n\n begin\n TokyoManager.start_slave_for_date(date, options[:'master-host'] || TokyoManager.configuration.host, options)\n rescue => e\n puts e.message\n end\n end",
"title": ""
},
{
"docid": "7fc5b7b98187264bb74b5e5434aeff2a",
"score": "0.5000049",
"text": "def start_agent(load_agent)\n return if load_agent.running?\n agent_ec2_instance = ec2.instances[load_agent.identifier] unless load_agent.identifier.nil?\n if agent_ec2_instance\n restart_agent(agent_ec2_instance)\n else\n agent_ec2_instance = create_agent\n agent_ec2_instance.tag('Name',\n value: \"#{self.project.project_code}-#{load_agent.class.name.underscore}-#{load_agent.id}\")\n end\n # update attributes\n load_agent.identifier = agent_ec2_instance.instance_id\n load_agent.public_ip_address = agent_ec2_instance.public_ip_address\n load_agent.private_ip_address = agent_ec2_instance.private_ip_address\n end",
"title": ""
},
{
"docid": "64117ae6c3c3c7adee649263060780f8",
"score": "0.49767685",
"text": "def new()\n trace(\"Instance #{index} created\")\n index += 1\n end",
"title": ""
},
{
"docid": "96a3cb3983e54ceeb489c028d1f64931",
"score": "0.49716455",
"text": "def create(state)\n save_and_validate_parameters\n connect\n\n # Using the clone class, create a machine for TK\n # Find the identifier for the targethost to pass to rbvmomi\n config[:targethost] = get_host(config[:targethost])\n\n # Use the root resource pool of a specified cluster, if any\n # @todo This does not allow to specify cluster AND pool yet\n unless config[:cluster].nil?\n cluster = get_cluster(config[:cluster])\n # @todo Check for active hosts, to avoid \"A specified parameter was not correct: spec.pool\"\n config[:resource_pool] = cluster.resource_pool\n else\n # Find the first resource pool on any cluster\n config[:resource_pool] = get_resource_pool(config[:resource_pool])\n end\n\n # Check that the datacenter exists\n datacenter_exists?(config[:datacenter])\n\n # Check if network exists, if to be changed\n network_exists?(config[:network_name]) unless config[:network_name].nil?\n\n # Same thing needs to happen with the folder name if it has been set\n unless config[:folder].nil?\n config[:folder] = {\n name: config[:folder],\n id: get_folder(config[:folder]),\n }\n end\n\n # Allow different clone types\n config[:clone_type] = :linked if config[:clone_type] == \"linked\"\n config[:clone_type] = :instant if config[:clone_type] == \"instant\"\n\n # Create a hash of options that the clone requires\n options = {\n name: config[:vm_name],\n targethost: config[:targethost],\n poweron: config[:poweron],\n template: config[:template],\n datacenter: config[:datacenter],\n folder: config[:folder],\n resource_pool: config[:resource_pool],\n clone_type: config[:clone_type],\n network_name: config[:network_name],\n }\n\n # Create an object from which the clone operation can be called\n clone_obj = Support::CloneVm.new(connection_options, options)\n state[:hostname] = clone_obj.clone\n state[:vm_name] = config[:vm_name]\n end",
"title": ""
},
{
"docid": "7217a76f5cd8dc281bbdb2732e4bb2bd",
"score": "0.4961424",
"text": "def initialize(args={})\n @source = args[:source] || nil\n @replica = args[:replica] || nil\n @sbm_limit = args[:sbm_limit] || 600\n @repl_status = {}\n end",
"title": ""
},
{
"docid": "4993a15b9773dba1c2bbf6684161d869",
"score": "0.4950731",
"text": "def addIntegratedAgent(agentType, number)\n sparkGetOrCreate(agentType, \"/usr/agent/behavior#{number}\")\nend",
"title": ""
},
{
"docid": "514d88fe212e7ed010ed6c711451205f",
"score": "0.49498627",
"text": "def agent\n @agent ||= initialize_agent\n end",
"title": ""
},
{
"docid": "23d3fb9d505b8b25be77325a96bd3e8a",
"score": "0.49344262",
"text": "def new(*constructor_args)\n @proxy.new do |*call_args|\n @worker.new(constructor_args, @job, &@block).call(call_args, @context)\n end\n end",
"title": ""
},
{
"docid": "a1fbf61c1c1b6baf9f2c59beb5c16ac8",
"score": "0.49221882",
"text": "def create\n Souffle::Log.info \"#{@node.log_prefix} Creating a new node...\"\n provider.create_node(@node)\n end",
"title": ""
},
{
"docid": "25374b57c50527a02168d78069f6cf7a",
"score": "0.49091431",
"text": "def create_server\n raise NotImplementedError, \"Implement #{__callee__} in #{self.class.to_s}\"\n end",
"title": ""
},
{
"docid": "41f103070f8114461f0779cb83867972",
"score": "0.49078608",
"text": "def create(state)\n self.class.lock!\n state[:hostname] = Socket.gethostname\n logger.info(\"[Localhost] Instance #{instance} ready.\")\n end",
"title": ""
},
{
"docid": "38c95900cf1917a855b2fb5dc9884ec3",
"score": "0.4904426",
"text": "def create_server opts\n Server.create opts.merge :account => self\n end",
"title": ""
},
{
"docid": "9b9e1d83ca5ce47fbf64a89388e8a8ca",
"score": "0.48801658",
"text": "def create!(*args)\n instance = self.new(*args)\n instance.save!\n return instance\n end",
"title": ""
},
{
"docid": "d89b20c3c379deb5ac9bd5cc353d69d0",
"score": "0.48800865",
"text": "def create_ams_agent\n AMSAgent.new(\n :ams => ams,\n :df => df,\n :acc => acc,\n :logger => logger,\n :name => fully_qualified_agent_name(\"ams\"),\n :addresses => agent_transport_addresses\n )\n end",
"title": ""
},
{
"docid": "b947b772743b1c982649806182eb2d3d",
"score": "0.4869539",
"text": "def new(*args)\n self.class.new(*args)\n end",
"title": ""
},
{
"docid": "b00713f3165663af824ceb23b5da8977",
"score": "0.48517418",
"text": "def create(attrs)\n self << broker = Broker.new(attrs)\n broker\n end",
"title": ""
},
{
"docid": "dfdc36839a6eab268e7cdd1e3dff09fe",
"score": "0.48347738",
"text": "def initialize\n create_new_rep\n end",
"title": ""
},
{
"docid": "cc64a130cbe80939e65bc30c50089956",
"score": "0.48343536",
"text": "def create_instance\n create_instances(1).first\n end",
"title": ""
},
{
"docid": "8adda1b144e03f06faf1aa28abfdf9b0",
"score": "0.48321706",
"text": "def new(*args)\n self.class.new(*args)\n end",
"title": ""
},
{
"docid": "c2555d5d833ff53a81d3e79bfd0dfe99",
"score": "0.48311692",
"text": "def create_vm(agent_id, stemcell_id, vm_type, network_spec, disk_locality = [], environment = nil)\n raise Bosh::Clouds::CloudError, \"Cannot create VM without registry with CPI v2 and stemcell api version #{@stemcell_api_version}. Registry not configured.\" if [email protected]_configured? && @stemcell_api_version < 2\n\n with_thread_name(\"create_vm(#{agent_id}, ...):v2\") do\n network_props = @props_factory.network_props(network_spec)\n\n registry, dns = nil\n registry = {endpoint: @config.registry.endpoint} if @config.registry_configured?\n\n network_with_dns = network_props.dns_networks.first\n dns = {nameserver: network_with_dns.dns} unless network_with_dns.nil?\n agent_settings = AgentSettings.new(registry, network_props, dns)\n agent_settings.environment = environment\n agent_settings.agent_id = agent_id\n\n #TODO : should use networks from core create_vm in future\n instance_id, networks = @cloud_core.create_vm(agent_id, stemcell_id, vm_type, network_props, agent_settings, disk_locality, environment) do\n |instance_id, settings|\n @registry.update_settings(instance_id, settings.agent_settings) if @stemcell_api_version < 2\n end\n\n [instance_id, network_spec]\n end\n end",
"title": ""
},
{
"docid": "148760105b026f312f75cf21653ce85d",
"score": "0.4819502",
"text": "def spawn(options)\n nick = options[\"nickname\"] || ENV['HOSTNAME']\n ENV['OATS_AGENT_NICKNAME'] = nick # Not sure if this is used at all\n port = options[\"port\"] || 3010\n port = port.to_s\n user = options[\"user\"]\n repo_version = options[\"repository_version\"]\n dir_tests = options[\"test_directory\"] || ENV['OATS_TESTS']\n ENV['OATS_USER_HOME'] ||= ENV['HOME']\n archive_dir = File.expand_path \"results_archive\", ENV['OATS_USER_HOME']\n log_dir = \"#{archive_dir}/#{nick}/agent_logs\"\n log_file = \"#{log_dir}/agent_#{Time.new.to_i}.log\"\n config_file = \"#{log_dir}/config-agent.txt\"\n agent_log_file = \"#{log_dir}/agent.log\"\n params = \"-n #{nick} -p #{port}\"\n \n agent_params = params.dup\n agent_params += \" -r #{repo_version}\" if repo_version\n agent_params += \" -u #{user}\" if user\n if options[\"agent_host\"] and options[\"agent_host\"] != ENV['OATS_OCC_HOST'].downcase and options[\"agent_host\"] != ENV['HOSTNAME']\n if RUBY_PLATFORM =~ /(mswin|mingw)/\n cmd = \"psexec.exe -d -i -n 10 -w \" + archive_dir +\n ' -u qa -p ' + 'passwd' + ' \\\\\\\\' + options[\"agent_host\"] +\n ' ruby oats_agent ' + agent_params.join(' ')\n else\n # options['agent_host'] = ENV['HOSTNAME']\n cmd = \"ssh \" + options[\"agent_host\"] + ' oats_agent ' + agent_params\n end\n $log.info \"Issuing remote host request: #{cmd}\"\n out = `#{cmd}`\n $log.info out unless out == ''\n return\n end\n \n \n FileUtils.mkdir_p(log_dir) unless File.exists?(log_dir)\n ENV['OATS_AGENT_LOGFILE'] = log_file\n\n ruby_cmd = File.expand_path('../oats_agent/start.rb', __FILE__) + ' ' + params\n \n # Need these off when called by OCC, otherwise the OCC values are inherited\n %w(RUBYOPT BUNDLE_BIN_PATH BUNDLE_GEMFILE).each { |e| ENV[e] = nil }\n # kill_matching ruby_cmd\n return if options[\"kill_agent\"]\n if dir_tests\n if File.directory?(dir_tests + '/.svn') and ENV['OATS_TESTS_SVN_REPOSITORY']\n svn_out =nil\n $log.info \"Requested OATS Version: #{repo_version}\" if repo_version\n code_version = nil\n\n 3.times do\n code_version = `svn info #{dir_tests} | sed -n 's/Last Changed Rev: *//p'`\n code_version = nil if code_version == ''\n break if code_version.nil? or (repo_version and code_version >= repo_version)\n cmd = \"svn update #{dir_tests} 2>&1\"\n svn_out = `#{cmd}`\n svn_out.chomp!\n $log.info svn_out\n case svn_out\n when /^At revision/\n code_version = svn_out.sub(/At revision *(\\d+).*/, '\\1')\n when /Cleanup/\n when /Could not resolve hostname/\n break\n end\n if code_version == ''\n code_version = nil\n sleep 3\n else\n break\n end\n end\n if svn_out.nil? and ENV['OATS_TESTS_SVN_REPOSITORY']\n $log.error \"Could not update the code version \" +(code_version || '') + (repo_version ? \"to #{repo_version}\" : '')\n exit 2\n end\n\n elsif ENV[\"$OATS_TESTS_GIT_REPOSITORY\"]\n dir_tests = archive_dir + '/' + nick + '/oats_tests'\n `git clone git_rep dir_tests if File.directory?(dir_tests)`\n Dir.chdir dir_tests\n origin = ENV[\"$OATS_TESTS_GIT_REPOSITORY\"] || 'origin'\n\n if repo_version\n 2.times do\n # may detach HEAD, but it is OK\n out = `git checkout #{repo_version} 2>&1`\n break if status == 0\n if out == \"fatal: reference is not a tree: #{repo_version}\"\n $log.info \"Need to pull requested version: #{repo_version} \"\n else\n $log.info \"$out\"\n end\n $log.info `git pull #{origin} master` # fast-forward master from origin\n end\n else\n $log.info `git pull #{origin} master` # fast-forward master from origin\n end\n code_version = `git rev-list HEAD -1` # last commit in checked out version\n if code_version =~ /#{repo_version}/\n $log.info \"Could not update the code version #{code_version} to #{repo_version}\"\n exit 2\n end\n $log.info \"Using OATS code version: #{code_version}\" unless repo_version\n else\n code_version = repo_version\n $log.info \"Setting OATS code version to the requested version: #{code_version}\" if code_version\n end\n end\n ENV['OATS_TESTS_CODE_VERSION'] = code_version\n\n msg = ''\n msg += \"User: #{user} \" if user\n msg += \"Repo version: #{repo_version} \" if repo_version\n $log.info \"#{msg}Starting: #{ruby_cmd}\"\n if RUBY_PLATFORM =~ /(mswin|mingw)/\n archiv = ENV['OATS_USER_HOME'] + '/results_archive'\n cmd = \"psexec.exe -d -i -n 10 -w #{archiv} ruby #{ruby_cmd} 2>&1\"\n else\n cmd = \"#{ruby_cmd} >/dev/null 2>&1 &\" \n end\n out = `#{cmd}`\n $log.info out unless out == ''\n File.open(config_file, 'w') {|f| f.puts(nick +' '+ port) }\n\n 10.times do\n if File.exist? log_file\n FileUtils.rm_f agent_log_file\n FileUtils.ln log_file, agent_log_file\n break\n end\n sleep 1\n end\n\n end",
"title": ""
},
{
"docid": "27e1c37c446578bbbf470e052e671e52",
"score": "0.48025814",
"text": "def setup_replication_destination_obj(replication)\n # if this is a standard object AND we're copying to a mission AND there exists a copy of this obj in the given mission,\n # then we don't need to create a new object, so return the existing copy\n if is_standard? && replication.has_to_mission? && (copy = copy_for_mission(replication.to_mission))\n obj = copy\n else\n # otherwise, we init and return the new object\n obj = self.class.new\n end\n\n # set flag so that standardizable callback doesn't call replicate again unnecessarily\n obj.changing_in_replication = true\n\n obj\n end",
"title": ""
},
{
"docid": "cb7bb1458ec26f81e52e39275f83e730",
"score": "0.47967446",
"text": "def create(*args)\n self.exec(\"lxc-create\", *args)\n self.state\n end",
"title": ""
},
{
"docid": "0e9c8b278e826f6960c9e6f160f7ccfe",
"score": "0.47921193",
"text": "def create()\n instance = create_instance()\n set_instance_properties(instance)\n create_instance_children(instance)\n return instance\n end",
"title": ""
},
{
"docid": "9d83ca6ff7310571eb32f9e266c424e2",
"score": "0.477608",
"text": "def create!\n Recliner.put(uri)\n end",
"title": ""
},
{
"docid": "430a1a0fe3e124d18bd8ff7aa11d2ec6",
"score": "0.47654018",
"text": "def create\n create_hiera_template\n create_manifests_node\n create_node_checkpoint\n end",
"title": ""
},
{
"docid": "31a5c83643162bfe66d60c12bb74003d",
"score": "0.47528052",
"text": "def create_ssh_session\n return Net::SSH.start(JUMPSRV_NMC, JUMPSRV_NMC_USER, password: JUMPSRV_NMC_PW, timeout: 40) # verbose: :info,\n end",
"title": ""
},
{
"docid": "77b6dd0e19b829db5dc78e779499a474",
"score": "0.47410008",
"text": "def create(*args)\n argv = to_pointer([\"create\"] + args)\n rrd_create(args.size+1, argv) == 0\n ensure\n free_pointers\n end",
"title": ""
},
{
"docid": "32f49347c105b1ca2dc752d0d295e858",
"score": "0.4739666",
"text": "def create(args = {})\n end",
"title": ""
},
{
"docid": "07c622b118aea7b24869eb557cc46258",
"score": "0.4732027",
"text": "def create_server\n\t\treturn Hglib::Server.new( self.path.to_s )\n\tend",
"title": ""
},
{
"docid": "a1926a03e50d1e3725963453ccc8c2c9",
"score": "0.47317946",
"text": "def create_instance(credentials, image_id, opts)\n racks = new_client( credentials )\n hwp_id = opts[:hwp_id] || 1\n name = Time.now.to_s\n if (opts[:name]) then name = opts[:name] end\n safely do\n return convert_srv_to_instance(racks.start_server(image_id, hwp_id, name))\n end\n end",
"title": ""
},
{
"docid": "a8d0533e73d343619eedd089694efde7",
"score": "0.47258255",
"text": "def post_init\n # Build a JSON representation\n r = {:source => \"#{@conn_obj.remote_db}\",\n :target => \"#{@conn_obj.our_db}\"}\n #, :continuous => true }\n r_json = r.to_json\n\n # Create the HTTP request\n req = \"POST /_replicate HTTP/1.1\\r\\n\"\n req += \"Content-Length: #{r_json.length}\\r\\n\\r\\n\"\n req += \"#{r_json}\"\n\n # Push it to the network\n send_data req\n end",
"title": ""
},
{
"docid": "90d2e4aabaf79b23b529fcf0bf2485f5",
"score": "0.47218212",
"text": "def create\n @admin_counter_agent = CounterAgent.new(admin_counter_agent_params)\n @admin_counter_agent.user.set_user_password\n @admin_counter_agent.user.set_role(\"counter_agent\")\n\n respond_to do |format|\n if @admin_counter_agent.save\n format.html { redirect_to [:admin, @admin_counter_agent], notice: \"Counter agent was successfully created.\" }\n format.json { render :show, status: :created, location: @admin_counter_agent }\n else\n format.html { render :new }\n format.json { render json: @admin_counter_agent.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "0d1551158d327c696dfbf5b6e1b2db9c",
"score": "0.47209662",
"text": "def create_vm(agent_id, stemcell_id, resource_pool, network_spec = nil,\n existing_disk = nil, environment = nil)\n with_thread_name(\"create_vm(#{agent_id}\") do\n begin\n validate_vm_resource_pool(resource_pool)\n # Check whether ephemeral disk is specified\n ephemeral_disk = (!resource_pool['disk'].nil? &&\n resource_pool['disk'].to_i > 0)\n # Create agent settings for the VM\n agent_env = initial_agent_settings(agent_id, agent_id, network_spec,\n ephemeral_disk, [],\n environment, @options['blobstore'],\n @options['agent']['mbus'])\n iso_uuid = create_and_upload_env_iso(agent_id, agent_env)\n # Get the disk id of the newly created image.\n iso_disk_id = @image_manager.get_image(iso_uuid)['vm_disk_id']\n # Get disk id of the uploaded stemcell image\n stemcell_disk_id = @image_manager\n .get_image(stemcell_id)['vm_disk_id']\n network = create_vm_nic_config(network_spec)\n ephemeral_disk_size = ephemeral_disk ? resource_pool['disk'] : nil\n vm_create_specs = create_vm_specs(agent_id, resource_pool['cpu'],\n resource_pool['ram'], agent_env,\n iso_disk_id, stemcell_disk_id,\n network, ephemeral_disk_size)\n @logger.debug(\"VM Specs: #{vm_create_specs}\")\n @vm_manager.create_virtual_machine(vm_create_specs)\n @logger.info(\"Virtual machine [#{agent_id}] created.\")\n unless existing_disk.nil?\n existing_disk.each do |disk_id|\n attach_disk(agent_id, disk_id)\n end\n end\n @vm_manager.set_power_state(agent_id, 'on')\n @logger.info('Virtual machine powered on.')\n # Delete the uploaded iso as it is not required\n @image_manager.delete_image(iso_uuid)\n @logger.info('Deleted the uploaded ENV ISO.')\n agent_id\n rescue => e\n delete_vm(agent_id) if has_vm?(agent_id)\n cloud_error(e.message)\n end\n end\n end",
"title": ""
},
{
"docid": "6d65f80de7861a3155d2675692e4e39d",
"score": "0.47137773",
"text": "def create\n Tipsy::Runners::Generator.new(args, @site)\n end",
"title": ""
},
{
"docid": "cd47b0203ebee8615854d497a55e5cd6",
"score": "0.4711196",
"text": "def create_server\n\n end",
"title": ""
},
{
"docid": "6d47a3b398d860c6b28a54c63e823b11",
"score": "0.47086707",
"text": "def create(*args, &block)\n complete_args = @partial_args + args\n @klass.new(*complete_args, &block)\n end",
"title": ""
},
{
"docid": "b7a7ac5a3f57d136c900cd7901e66215",
"score": "0.47062054",
"text": "def initialize(*args)\n self.supervisor = Celluloid::SupervisionGroup.run!\n super\n end",
"title": ""
},
{
"docid": "177aa382ae805f16bbf4632a0fa1cacb",
"score": "0.47053272",
"text": "def new args\n\t\t\trequire 'simrb/comd'\n\t\t\tsimrb_app = Simrb::Scommand.new\n\t\t\tsimrb_app.run(args.unshift('new'))\n\t\tend",
"title": ""
},
{
"docid": "177aa382ae805f16bbf4632a0fa1cacb",
"score": "0.47053272",
"text": "def new args\n\t\t\trequire 'simrb/comd'\n\t\t\tsimrb_app = Simrb::Scommand.new\n\t\t\tsimrb_app.run(args.unshift('new'))\n\t\tend",
"title": ""
},
{
"docid": "8fbd9d7d63ea662ecbf38bc1f077ec76",
"score": "0.47004092",
"text": "def create_instance(options = {})\n body = Hash.new\n (body[:flavor_ref] = options[:flavor_ref]) or raise CloudDB::Exception::MissingArgument, \"Must provide a flavor to create an instance\"\n (body[:size] = options[:size]) or raise CloudDB::Exception::MissingArgument, \"Must provide a size to create an instance\"\n body[:name].upcase! if body[:name]\n response = dbreq(\"POST\",lbmgmthost,\"#{lbmgmtpath}/instances\",lbmgmtport,lbmgmtscheme,{},body.to_json)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n body = JSON.parse(response.body)['instance']\n return get_instance(body[\"id\"])\n end",
"title": ""
},
{
"docid": "aa54208ba3df02c046c0e8f634ca9cd8",
"score": "0.4696302",
"text": "def agent(option = nil)\n options = { 'nickname' => nickname, 'port' => port, 'agent_host' => name}\n options['user' ] = user.email if user\n if option\n if option.instance_of? String\n options['repository_version'] = option\n else\n options['kill_agent'] = true\n end\n end\n Rails.logger.info \"Initiate OatsAgent request: #{options.inspect}\"\n OatsAgent.spawn(options)\n end",
"title": ""
},
{
"docid": "696ed899c9ee5018705634c620ae6789",
"score": "0.46953318",
"text": "def action_create\n if current_resource.exists? && correct_config?\n Chef::Log.debug(\"#{new_resource} exists - skipping\")\n else\n converge_by(\"Create #{new_resource}\") do\n executor.groovy! <<-EOH.gsub(/ ^{12}/, '')\n import hudson.model.*\n import hudson.slaves.*\n import jenkins.model.*\n import jenkins.slaves.*\n\n props = []\n availability = #{convert_to_groovy(new_resource.availability)}\n usage_mode = #{convert_to_groovy(new_resource.usage_mode)}\n env_map = #{convert_to_groovy(new_resource.environment)}\n labels = #{convert_to_groovy(new_resource.labels.sort.join(\"\\s\"))}\n\n // Compute the usage mode\n if (usage_mode == 'normal') {\n mode = Node.Mode.NORMAL\n } else {\n mode = Node.Mode.EXCLUSIVE\n }\n\n // Compute the retention strategy\n if (availability == 'demand') {\n retention_strategy =\n new RetentionStrategy.Demand(\n #{new_resource.in_demand_delay},\n #{new_resource.idle_delay}\n )\n } else if (availability == 'always') {\n retention_strategy = new RetentionStrategy.Always()\n } else {\n retention_strategy = RetentionStrategy.NOOP\n }\n\n // Create an entry in the prop list for all env vars\n if (env_map != null) {\n env_vars = new hudson.EnvVars(env_map)\n entries = env_vars.collect {\n k,v -> new EnvironmentVariablesNodeProperty.Entry(k,v)\n }\n props << new EnvironmentVariablesNodeProperty(entries)\n }\n\n // Launcher\n #{launcher_groovy}\n\n // Build the slave object\n slave = new DumbSlave(\n #{convert_to_groovy(new_resource.name)},\n #{convert_to_groovy(new_resource.description)},\n #{convert_to_groovy(new_resource.remote_fs)},\n #{convert_to_groovy(new_resource.executors.to_s)},\n mode,\n labels,\n launcher,\n retention_strategy,\n props\n )\n\n // Create or update the slave in the Jenkins instance\n nodes = new ArrayList(Jenkins.instance.getNodes())\n ix = nodes.indexOf(slave)\n (ix >= 0) ? nodes.set(ix, slave) : nodes.add(slave)\n Jenkins.instance.setNodes(nodes)\n EOH\n end\n end\n end",
"title": ""
},
{
"docid": "34519e3ace2f0c6ef882fa229e53c501",
"score": "0.4692379",
"text": "def create_collector(identifier)\n puts \"trying to create a new collector\"\n create_response = rpc(\"addAgent\", {\"autogen\" => \"true\", \"description\" => identifier})\n if @debug\n puts create_response\n end\nend",
"title": ""
},
{
"docid": "6c16591faaf431194e361dd5ad2e9c72",
"score": "0.46849614",
"text": "def initialize(host, load_balancer, port: nil)\n @host = host\n @port = port\n @load_balancer = load_balancer\n @pool = load_balancer.create_replica_connection_pool(\n load_balancer.configuration.pool_size,\n host,\n port\n )\n @online = true\n @last_checked_at = Time.zone.now\n\n interval = load_balancer.configuration.replica_check_interval\n @intervals = (interval..(interval * 2)).step(0.5).to_a\n end",
"title": ""
},
{
"docid": "cc15d495e466a5debd2c224b16ea099a",
"score": "0.46782106",
"text": "def create!\n Subnet.reserve(@subnet)\n super\n Address.mkdir(@id)\n PoolNode.mkdir(@id)\n create_address(gateway)\n end",
"title": ""
},
{
"docid": "974d211ff13e0c3411b1a1bcf3fb1176",
"score": "0.46690163",
"text": "def perform(args)\n opts = Slop.parse!(args) do\n banner (<<-eos\n Usage:\n smartos new <name>\n\n Description:\n Creates a new SmartOS virtual infrastructure project.\n\n Asks some questions about the topology of your network and then creates configuration\n files to prepare your Global Zone. After this command has run, use 'smartos generate'\n to generate VM definitions. And finally, run 'smartos up' to actaully create your VMs.\n\n eos\n ).strip_indent\n end\n\n if args.size != 1\n say opts\n exit\n end\n\n new_project(args.first)\n end",
"title": ""
},
{
"docid": "6b4a4e5168f6d6c7f44353f1351a0a1c",
"score": "0.46643314",
"text": "def new(env = {})\n self.class.new controller, env, defaults\n end",
"title": ""
},
{
"docid": "903301c7655c7fbba9933e0b67ffca6a",
"score": "0.46583545",
"text": "def create(server)\n run_barman_command(\"backup #{server}\")\n end",
"title": ""
},
{
"docid": "f679d2ccfbb196c25e283df45f86bc47",
"score": "0.46544123",
"text": "def create(options = {})\n raise ArgumentError.new(\"You must provide :cores and :ram\") if options[:ram].nil? or options[:cores].nil?\n raise ArgumentError.new(\":ram has to be at least 256MiB and a multiple of it\") if options[:ram].to_i < 256 or (options[:ram].to_i % 256) > 0\n raise ArgumentError.new(\":availability_zone has to be either 'AUTO', 'ZONE_1', or 'ZONE_2'\") if options[:availability_zone] and !['AUTO', 'ZONE_1', 'ZONE_2'].include? options[:availability_zone]\n raise ArgumentError.new(\":os_type has to be either 'WINDOWS' or 'OTHER'\") if options[:os_type] and !['WINDOWS', 'OTHER'].include? options[:os_type]\n options[:server_name] = options.delete :name if options[:name]\n response = Profitbricks.request :create_server, options\n self.find(:id => response[:server_id])\n end",
"title": ""
},
{
"docid": "97691f2ac635633befeeef89758d5539",
"score": "0.46487877",
"text": "def create!(opts = {})\n instance = new(opts)\n instance.save!\n instance\n end",
"title": ""
},
{
"docid": "6dce986dd390f88e493f6315128dd2ec",
"score": "0.4647981",
"text": "def create(*args)\n instance = self.new(*args)\n instance.save\n return instance\n end",
"title": ""
},
{
"docid": "f452e8ad01ee4dba9e764f33b79e25b7",
"score": "0.46458787",
"text": "def create\n @session_replica = SessionReplica.new(session_replica_params)\n\n respond_to do |format|\n if @session_replica.save\n format.html { redirect_to @session_replica}\n format.json { render :show, status: :created, location: @session_replica }\n else\n format.html { render :new }\n format.json { render json: @session_replica.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "bc86944468c10bae00559e705ef77ed5",
"score": "0.4639053",
"text": "def create_agent_via_api(agent_type, opts = {})\n\tcase agent_type\n\twhen :person\n\t\tagent_json = opts[:create_subrecords] ? \n\t\t\tbuild(:json_agent_person_full_subrec) : \n\t\t\tbuild(:json_agent_person)\n\t\turl = URI(\"#{JSONModel::HTTP.backend_url}/agents/people\")\n\twhen :corporate_entity\n\t agent_json = opts[:create_subrecords] ? \n\t\t\tbuild(:json_agent_corporate_entity_full_subrec) : \n\t\t\tbuild(:json_agent_corporate_entity)\n\t\turl = URI(\"#{JSONModel::HTTP.backend_url}/agents/corporate_entities\")\n\twhen :family\n\t\tagent_json = opts[:create_subrecords] ? \n\t\t\tbuild(:json_agent_family_full_subrec) : \n\t\t\tbuild(:json_agent_familly)\n\t\turl = URI(\"#{JSONModel::HTTP.backend_url}/agents/families\")\n\twhen :software\n agent_json = opts[:create_subrecords] ? \n\t\t\tbuild(:json_agent_software_full_subrec) : \n\t\t\tbuild(:json_agent_software)\n\t\turl = URI(\"#{JSONModel::HTTP.backend_url}/agents/software\")\n\tend\n\n response = JSONModel::HTTP.post_json(url, agent_json.to_json)\n json_response = ASUtils.json_parse(response.body)\n\n if json_response[\"status\"] == \"Created\"\n return json_response[\"id\"]\n else\n return -1\n\tend\nrescue => e\n\treturn -1\nend",
"title": ""
},
{
"docid": "95d63f5675e448301701df38557a0e1f",
"score": "0.46349922",
"text": "def createXRegionReadRep(instId, sourceDbInstId, subnetGrp)\n puts \"Creating cross region replica #{instId} from source DB #{sourceDbInstId} with subnet group #{subnetGrp}\"\n\n begin\n opts = Hash.new\n opts[:db_instance_identifier] = instId\n opts[:source_db_instance_identifier] = sourceDbInstId\n opts[:db_subnet_group_name] = subnetGrp\n @rds.create_db_instance_read_replica(opts)\n rescue Exception => e\n puts \"KSRdsUtil>>createXRegionReadRep: error \" + e.message\n end\n\n end",
"title": ""
},
{
"docid": "f0f8caf9dd7ce713a5e12eee9b791133",
"score": "0.46288845",
"text": "def create(*)\n super.tap do\n submission.set_simulation(__method__) if simulating\n end\n end",
"title": ""
},
{
"docid": "50137c7dd3fb3fe19b80b292e1a03f55",
"score": "0.46287894",
"text": "def create_tenant\n Apartment::Tenant.create(account.tenant) do\n initialize_account_data\n account.switch do\n create_defaults\n fillin_translations\n add_initial_users\n schedule_recurring_jobs\n true\n end\n end\n end",
"title": ""
},
{
"docid": "6606ef3c50c06210bd410001ecc82361",
"score": "0.4628313",
"text": "def initiate(replica_set)\n config = replica_set.config\n\n if replica_set.replica_set?\n if replica_set.key != config.key\n raise FatalError, 'Member already belongs to a different Replica Set?!'\n else\n logger.info 'Mongodb Replica set already inititated...'\n return\n end\n end\n\n begin\n replica_set.initiate(false)\n replica_set.connect\n rescue Mongo::Error::OperationFailure => rinit\n logger.info 'Failed to initiate Replica Set...'\n logger.info rinit.message\n raise\n end\n logger.info 'Mongodb Replica set inititated...'\nend",
"title": ""
},
{
"docid": "654ac0e5cd3b727e7df4c55409c4781f",
"score": "0.46258774",
"text": "def create!(*args)\n session = new(*args)\n session.save!\n end",
"title": ""
},
{
"docid": "654ac0e5cd3b727e7df4c55409c4781f",
"score": "0.46258774",
"text": "def create!(*args)\n session = new(*args)\n session.save!\n end",
"title": ""
},
{
"docid": "e1fc35c88faaf649eb69e84d43dd61fe",
"score": "0.46207705",
"text": "def new(*args)\n type, from_node, to_node = args\n rel = Neo4j::Relationship.create(type, from_node, to_node)\n wrapped_rel = super()\n Neo4j::IdentityMap.add(rel, wrapped_rel)\n wrapped_rel.init_on_load(rel)\n wrapped_rel.init_on_create(*args)\n wrapped_rel\n end",
"title": ""
},
{
"docid": "3677ccef79253960dcc37a46e730ecbd",
"score": "0.46192732",
"text": "def jenkins_node_manage(args)\n args = jenkins_node_defaults(args)\n\n if args[:env]\n map = args[:env].collect { |k,v| %Q(\"#{k}\":\"#{v}\") }.join(\",\")\n env = \"new jenkins.EnvVars([#{map}])\"\n else\n env = \"null\"\n end\n\n case args[:launcher]\n when \"jnlp\"\n launcher = \"new JNLPLauncher()\"\n when \"command\"\n launcher = %Q(new CommandLauncher(\"#{args[:command]}\", env))\n when \"ssh\"\n if args[:password] == nil\n password = \"null\"\n else\n password = %Q(\"#{args[:password]}\")\n end\n\n launcher = %Q(new_ssh_launcher([\"#{args[:host]}\", #{args[:port]}, \"#{args[:username]}\", #{password},\n \"#{args[:private_key]}\", \"#{args[:jvm_options]}\"] as Object[]))\n end\n\n remote_fs = args[:remote_fs].gsub('\\\\', '\\\\\\\\\\\\') # C:\\jenkins -> C:\\\\jenkins\n\n if args[:availability] == \"Demand\"\n rs_args = \"#{args[:in_demand_delay]}, #{args[:idle_delay]}\"\n else\n rs_args = \"\"\n end\n\n return <<EOF\nimport jenkins.model.*\nimport jenkins.slaves.*\n\napp = jenkins.instance\nenv = #{env}\nprops = []\n\ndef new_ssh_launcher(args) {\n jenkins.instance.pluginManager.getPlugin(\"ssh-slaves\").classLoader.\n loadClass(\"jenkins.plugins.sshslaves.SSHLauncher\").\n getConstructor([String, int, String, String, String, String] as Class[]).newInstance(args)\n}\n\nif (env != null) {\n entries = env.collect { k,v -> new EnvironmentVariablesNodeProperty.Entry(k,v) }\n props << new EnvironmentVariablesNodeProperty(entries)\n}\n\nslave = new DumbSlave(\"#{args[:name]}\", \"#{args[:description]}\", \"#{remote_fs}\",\n \"#{args[:executors]}\", Node.Mode.#{args[:mode]}, \"#{args[:labels]}\",\n #{launcher},\n new RetentionStrategy.#{args[:availability]}(#{rs_args}), props)\n\nnodes = new ArrayList(app.getNodes())\nix = nodes.indexOf(slave)\nif (ix >= 0) {\n nodes.set(ix, slave)\n}\nelse {\n nodes.add(slave)\n}\n\napp.setNodes(nodes)\n\nEOF\nend",
"title": ""
},
{
"docid": "15bac8559ff4e8005e79238d45a31b24",
"score": "0.4609701",
"text": "def create_instance project_id:, instance_id:\n # [START spanner_create_instance]\n # project_id = \"Your Google Cloud project ID\"\n # instance_id = \"Your Spanner instance ID\"\n\n require \"google/cloud/spanner\"\n require \"google/cloud/spanner/admin/instance\"\n\n instance_admin_client = Google::Cloud::Spanner::Admin::Instance.instance_admin\n\n project_path = instance_admin_client.project_path project: project_id\n instance_path = instance_admin_client.instance_path project: project_id, instance: instance_id\n instance_config_path = instance_admin_client.instance_config_path project: project_id, instance_config: \"regional-us-central1\"\n\n job = instance_admin_client.create_instance parent: project_path,\n instance_id: instance_id,\n instance: { name: instance_path,\n config: instance_config_path,\n display_name: instance_id,\n node_count: 2,\n labels: { cloud_spanner_samples: \"true\" } }\n\n puts \"Waiting for create instance operation to complete\"\n\n job.wait_until_done!\n\n if job.error?\n puts job.error\n else\n puts \"Created instance #{instance_id}\"\n end\n # [END spanner_create_instance]\nend",
"title": ""
},
{
"docid": "b3ab47c365d2d1f1818c371e35cd189a",
"score": "0.46064073",
"text": "def create(config)\n PlatformOps::Utils.validated_config config, %i(ami_id ssh_user)\n\n @ami_id = config[:ami_id]\n @ssh_user = config[:ssh_user]\n @ingress_cidrs = combine_ingress_addresses(config[:ingress_ip], config[:ingress_cidrs])\n @ssh_public_key_path = config[:ssh_public_key] || '~/.ssh/id_rsa.pub'\n @ssh_private_key_path = config[:ssh_private_key] || '~/.ssh/id_rsa'\n @ssh_poll_private_ip = config[:ssh_poll_private_ip]\n @security_group_connections = config[:security_group_connections] || []\n @eip_allocation_id = config[:eip_allocation_id]\n @instance_type = config[:instance_type] || 't2.medium'\n @cidr = config[:cidr]\n\n begin\n route_table_id = create_route_table\n subnet_id = create_subnet(route_table_id, @cidr)\n security_group_id = create_security_group(security_group_connections)\n instance_id = create_instance(subnet_id, security_group_id)\n instance = wait_for_instance(instance_id)\n associate_eip(instance_id) if @eip_allocation_id\n instance\n rescue Interrupt, StandardError => e\n logger.error e\n\n destroy\n\n raise\n end\n end",
"title": ""
},
{
"docid": "9c74569cf653f3b557beb33574999eea",
"score": "0.45969442",
"text": "def initialize(args = {})\n @host = args[:host] || \"127.0.0.1\"\n @port = args[:port] || 161\n @timeout = args[:timeout] || 1\n @retries = args[:retries] || 3\n @version = args[:version] || :SNMPv2c\n\n self.extend SNMPv2cRequests if @version == :SNMPv2c\n\n @community_ro = args[:community_ro] || args[:community] || \"public\"\n @community_rw = args[:community_rw] || args[:community] || \"public\"\n \n self.class.init_socket\n end",
"title": ""
},
{
"docid": "973ca8c755e17c28802bd6aa887a76e2",
"score": "0.45871907",
"text": "def initiate(nodes, params, _opts = {})\n indexes = nodes.map { |r| r[:id] }\n set_indexes!(indexes)\n ndx_pbuilderid_to_node_info = nodes.inject({}) do |h, n|\n h.merge(n.pbuilderid => { id: n[:id], display_name: n.assembly_node_print_form() })\n end\n callbacks = {\n on_msg_received: proc do |msg|\n\n response = CommandAndControl.parse_response__execute_action(nodes, msg)\n if response && response[:pbuilderid] && response[:status] == :ok\n node_info = ndx_pbuilderid_to_node_info[response[:pbuilderid]]\n\n unless response[:data][:error]\n component_type = :authorized_ssh_public_key\n attr_hash = {\n linux_user: params[:system_user],\n key_name: params[:rsa_pub_name],\n key_content: params[:rsa_pub_key]\n }\n node = nodes.find { |n| n[:id] == node_info[:id] }\n\n if (@agent_action == :grant_access)\n Component::Instance::Interpreted.create_or_update?(node, component_type, attr_hash)\n else\n Component::Instance::Interpreted.delete(node, component_type, attr_hash)\n end\n end\n\n push(node_info[:display_name], response[:data])\n else\n Log.error(\"Agent '#{msg[:senderagent]}' error, Code: #{msg[:body][:statuscode]} - #{msg[:body][:statusmsg]}\")\n end\n\n end\n }\n CommandAndControl.request__execute_action(:ssh_agent, @agent_action, nodes, callbacks, params)\n end",
"title": ""
},
{
"docid": "4d37e8c692cc253dadfb5ce5431e6347",
"score": "0.4583421",
"text": "def register_new_agent_with_instance (agent_instance)\n throw \"not an aws instance!\" if !agent_instance.is_a?AwsInstance\n url_string=\"http://#{@server_address}:#{@server_port}/agents\"\n url=URI(url_string)\n req = Net::HTTP::Post.new(url)\n agent_instance.notify \"registering new agent\"\n res=Net::HTTP.start(url.hostname,url.port) do |http|\n req.basic_auth @username,@password\n req.body=\"name=#{agent_instance.name}&ip=#{agent_instance.aws_instance_data.private_ip_address}\"\n http.request(req)\n end\n if res.code.to_i <=399\n agent_instance.notify \"registered ok! getting key\"\n client_data=JSON.parse(res.body)\n client_id=client_data['data']\n url_string=\"http://#{@server_address}:#{@server_port}/agents/#{client_id}/key\"\n url=URI(url_string)\n req = Net::HTTP::Get.new(url)\n res=Net::HTTP.start(url.hostname,url.port) do |http|\n req.basic_auth @username,@password\n http.request(req)\n end\n if res.code.to_i<=399\n agent_instance.notify \"key for agent obtained! installing on agent...\"\n client_key_data=JSON.parse(res.body)\n ssh_command=\"sudo echo \\\"y\\\" | sudo /var/ossec/bin/manage_agents -i #{client_key_data['data']}\"\n s3_client=Helpers.create_aws_S3_client\n agent_instance.notify \"loading configuration for agent...\"\n resp=s3_client.get_object({\n bucket: \"btrz-aws-automation\",\n key: \"ossec/agent/ossec.conf\"\n })\n xml_content=resp.body.read\n noko_xml=Nokogiri::XML(xml_content)\n noko_xml.css(\"ossec_config client server-ip\").first.content=@private_server_address\n agent_instance.notify \"deploying configuration to agent, server ip=#{@private_server_address}\"\n agent_instance.upload_data_to_file noko_xml.root.to_s,\"/home/ubuntu/ossec.conf\"\n agent_instance.notify \"removing old keys\"\n agent_instance.run_ssh_command \"sudo rm /var/ossec/etc/client.keys\"\n agent_instance.notify \"updating configuration\"\n agent_instance.run_ssh_command \"sudo cp /home/ubuntu/ossec.conf /var/ossec/etc/ossec.conf && sudo chown root:ossec /var/ossec/etc/ossec.conf && sudo chmod 640 /var/ossec/etc/ossec.conf\"\n answer=agent_instance.run_ssh_command ssh_command\n agent_instance.notify \"restarting agent...\"\n agent_status=agent_instance.run_ssh_command \"sudo /var/ossec/bin/ossec-control restart\"\n if (answer.index( \"Added\") !=nil and agent_status.index( \"Completed\")!=nil)\n return true,{\n agent_key: client_key_data['data'],\n answer: answer,\n status: agent_status,\n }\n else\n return false,{\n agent_key: client_key_data['data'],\n answer: answer,\n status: agent_status,\n }\n end\n else\n return false, res.code\n end\n else\n agent_instance.notify \"authentication error connecting to server #{@server_address} in #{@environment}\"\n return false, res.code\n end\n end",
"title": ""
},
{
"docid": "b720e17318b40fffa012ba45d69603cf",
"score": "0.457693",
"text": "def agent; end",
"title": ""
},
{
"docid": "2207369bb3a64634073a0f3369548732",
"score": "0.45670193",
"text": "def new(*args, &block)\n obj = allocate()\n obj.initialize(*args, &block)\n obj\n end",
"title": ""
}
] |
1c5f30dfc8a78d640c0d3bd5ecb7168b
|
Helper for creating / removing bridgedomain configs 1. Remove any existing bridgedomain config unless it contains our test_bd 2. Remove vlan with test_bd id 3. Add bridgedomain configs
|
[
{
"docid": "08823607224eb5e03c7ef724f25377d8",
"score": "0.77183324",
"text": "def config_bridge_domain(agent, test_bd, stepinfo='bridge-domain config:')\n step stepinfo do\n # Find current bridge-domain\n # NOTE: This should convert to using puppet resource, however, the cli\n # does not allow changes to bridge-domain without removing existing BD's,\n # which means we are stuck with vsh for now.\n cmd = 'show run bridge-domain'\n if agent\n out = on(agent, get_vshell_cmd(cmd)).stdout\n else\n out = nxapi_test_get(cmd, false)\n end\n bds = out.scan(/^bridge-domain \\d+/)\n return if bds.include?(\"bridge-domain #{test_bd}\")\n\n bds.uniq.each do |bd|\n command_config(agent, \"no #{bd}\", \"remove #{bd}\", ignore_errors: true)\n end\n if (sys_bd = out[/^system bridge-domain .*/])\n command_config(agent, \"no #{sys_bd}\", \"remove #{sys_bd}\", ignore_errors: false)\n end\n\n # Remove vlan\n cmd = \"no vlan #{test_bd}\"\n command_config(agent, cmd, cmd, ignore_errors: true)\n\n # Configure bridge-domain\n cmd = \"system bridge-domain #{test_bd} ; bridge-domain #{test_bd}\"\n command_config(agent, cmd, cmd, ignore_errors: false)\n end\n end",
"title": ""
}
] |
[
{
"docid": "d7e367a43266f342ca859538c861a1f2",
"score": "0.6236179",
"text": "def create_bridge\n return if @bridges.keys.include? @nic[:bridge]\n\n if @nic[:bridge_type] == 'openvswitch_dpdk'\n @nic[:ovs_bridge_conf] = {} unless @nic[:ovs_bridge_conf]\n @nic[:ovs_bridge_conf]['datapath_type'] = 'netdev'\n end\n\n OpenNebula.exec_and_log(\"#{command(:ovs_vsctl)} --may-exist add-br #{@nic[:bridge]}\")\n\n set_bridge_options\n\n @bridges[@nic[:bridge]] = []\n\n OpenNebula.exec_and_log(\"#{command(:ip)} link set #{@nic[:bridge]} up\")\n end",
"title": ""
},
{
"docid": "2b7241f1252fca74af7992ca7793f7ec",
"score": "0.60596293",
"text": "def remove_all_bridge_domains\n config 'system bridge-domain none' if /N7/ =~ node.product_id\n BridgeDomain.bds.each do |_bd, obj|\n obj.destroy\n end\n end",
"title": ""
},
{
"docid": "e03ae770eb81f988e65d5bb0da01faf1",
"score": "0.58022684",
"text": "def non_bonded_dhcp_nic_config(nic, macs, tagged, dhcp_net_config)\n logger.debug(\"Standard dhcp NIC Partition: #{nic}\")\n if supported_suse?(os)\n if !tagged\n logger.debug(\"Creating resources for untagged NIC (SLES) for #{@server_component[\"puppetCertName\"]}..\")\n dhcp_net_config[\"network::if::suse_dynamic\"] ||= {}\n dhcp_net_config[\"network::if::suse_dynamic\"][macs[0]] = {\n \"ensure\" => \"up\",\n \"macaddress\" => macs[0]\n }\n else\n logger.debug(\"Creating resources for tagged NIC (SLES) for #{@server_component[\"puppetCertName\"]}..\")\n vlan_id = nic[:vlanId]\n logger.debug(\"VLAN tagging is required on the OS level for vlan #{vlan_id} configuring dhcp NIC (no bonding)\")\n dhcp_net_config[\"network::if::suse_dynamic\"] ||= {}\n dhcp_net_config[\"network::if::suse_dynamic\"][macs[0]] = {\n \"ensure\" => \"up\",\n \"macaddress\" => macs[0],\n \"bootproto\" => \"\"\n }\n dhcp_net_config[\"network::if::suse_vlan\"] ||= {}\n dhcp_net_config[\"network::if::suse_vlan\"][macs[0]] = {\n \"ensure\" => \"up\",\n \"bootproto\" => \"dhcp\",\n \"vlanId\" => vlan_id\n }\n end\n else\n if !tagged\n logger.debug(\"Creating resources for untagged NIC (RHEL) for #{@server_component[\"puppetCertName\"]}..\")\n dhcp_net_config[\"network::if::dynamic\"] ||= {}\n dhcp_net_config[\"network::if::dynamic\"][macs[0]] = {\n \"ensure\" => \"up\",\n \"macaddress\" => macs[0]\n }\n else\n logger.debug(\"Creating resources for tagged NIC (RHEL) for #{@server_component[\"puppetCertName\"]}..\")\n vlan_id = nic[:vlanId]\n logger.debug(\"VLAN tagging is required on the OS level for vlan #{vlan_id} configuring dhcp NIC (no bonding)\")\n dhcp_net_config[\"network::if::static\"] ||= {}\n dhcp_net_config[\"network::if::static\"][macs[0]] = {\n \"ensure\" => \"up\",\n \"macaddress\" => macs[0]\n }\n dhcp_net_config[\"network::if::vlan\"] ||= {}\n dhcp_net_config[\"network::if::vlan\"][macs[0]] = {\n \"ensure\" => \"up\",\n \"bootproto\" => \"dhcp\",\n \"vlanId\" => vlan_id\n }\n end\n end\n end",
"title": ""
},
{
"docid": "fc0fa153531130972f0ab13b5d09ad2f",
"score": "0.57996505",
"text": "def configure_ubuntu_lxc_server(server_type)\n config_file = \"/etc/network/interfaces\"\n if server_type.match(/public/)\n message = \"Checking:\\tLXC network configuration\"\n command = \"cat #{config_file} |grep 'bridge_ports eth0'\"\n output = execute_command(options,message,command)\n if not output.match(/bridge_ports/)\n tmp_file = \"/tmp/interfaces\"\n server_ip = options['hostip']\n gateway = options['q_struct']['gateway'].value\n broadcast = options['q_struct']['broadcast'].value\n network = options['q_struct']['network_address'].value\n nameserver = options['q_struct']['nameserver'].value\n file = File.open(tmp_file,\"w\")\n file.write(\"# The loopback network interface\\n\")\n file.write(\"auto lo\\n\")\n file.write(\"iface lo inet loopback\\n\")\n file.write(\"\\n\")\n file.write(\"# The primary network interface\\n\")\n file.write(\"auto eth0\\n\")\n file.write(\"iface eth0 inet manual\\n\")\n file.write(\"\\n\")\n file.write(\"# LXC network\\n\")\n file.write(\"auto lxcbr0\\n\")\n file.write(\"iface lxcbr0 inet static\\n\")\n file.write(\"bridge_ports eth0\\n\")\n file.write(\"bridge_fd 0\\n\")\n file.write(\"bridge_stp off\\n\")\n file.write(\"bridge_waitport 0\\n\")\n file.write(\"bridge_maxwait 0\\n\")\n file.write(\"address #{server_ip}\\n\")\n file.write(\"gateway #{gateway}\\n\")\n file.write(\"netmask #{netmask}\\n\")\n file.write(\"network #{network}\\n\")\n file.write(\"broadcast #{broadcast}\\n\")\n file.write(\"dns-nameservers #{nameserver}\\n\")\n file.write(\"\\n\")\n file.close\n backup_file = config_file+\".nolxc\"\n message = \"Information:\\tArchiving network configuration file \"+config_file+\" to \"+backup_file\n command = \"cp #{config_file} #{backup_file}\"\n execute_command(options,message,command)\n message = \"Information:\\tCreating network configuration file \"+config_file\n command = \"cp #{tmp_file} #{config_file} ; rm #{tmp_file}\"\n execute_command(options,message,command)\n service = \"networking\"\n restart_service(service)\n end\n end\n return\nend",
"title": ""
},
{
"docid": "6f6ec0192e9663ade9f6cbd43fb7d535",
"score": "0.5515875",
"text": "def createSubnetGroup(config)\n\t\t\t# Finding subnets, creating security groups/adding holes, create subnet group \n\t\t\tif @db['vpc'] and !@db['vpc'].empty?\n\t\t\t\texisting_vpc, vpc_name = MU::VPC.find(\n\t\t\t\t\tid: @db[\"vpc\"][\"vpc_id\"],\n\t\t\t\t\tname: @db[\"vpc\"][\"vpc_name\"],\n\t\t\t\t\tregion: @db['region']\n\t\t\t\t)\n\n\t\t\t\tMU.log \"Couldn't find an active VPC from #{@db['vpc']}\", MU::ERR, details: @db['vpc'] if existing_vpc.nil? or existing_vpc.vpc_id.nil?\n\n\t\t\t\tvpc_id = existing_vpc.vpc_id\n\t\t\t\tsubnet_ids = []\n\n\t\t\t\t# Getting subnet IDs\n\t\t\t\tif !@db[\"vpc\"][\"subnets\"].empty?\n\t\t\t\t\t@db[\"vpc\"][\"subnets\"].each { |subnet|\n\t\t\t\t\t\tsubnet_struct = MU::VPC.findSubnet(\n\t\t\t\t\t\t\tid: subnet[\"subnet_id\"],\n\t\t\t\t\t\t\tname: subnet[\"subnet_name\"],\n\t\t\t\t\t\t\tvpc_id: vpc_id,\n\t\t\t\t\t\t\tregion: @db['region']\n\t\t\t\t\t\t)\n\n\t\t\t\t\t\tif !subnet_struct\n\t\t\t\t\t\t\t# should this be subnet_struct.empty?\n\t\t\t\t\t\t\tMU.log \"Couldn't find a live subnet matching #{subnet}\", MU::ERR, details: MU::Deploy.deployment['subnets']\n\t\t\t\t\t\t\traise \"Couldn't find a live subnet matching #{subnet}\"\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tsubnet_ids << subnet_struct.subnet_id\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t# This should be changed to only include subnets that will work with publicly_accessible\n\t\t\t\t\tsubnet_ids = MU::VPC.listSubnets(vpc_id: vpc_id, region: @db['region'])\n\t\t\t\t\tMU.log \"No subnets specified for #{@db['identifier']}, adding all subnets in #{vpc_id}\", MU::DEBUG, details: subnet_ids\n\t\t\t\tend\n\n\t\t\t\t# Create DB subnet group\n\t\t\t\tif subnet_ids.empty?\n\t\t\t\t\tMU.log \"Couldn't find subnets in #{vpc_id} to add #{@db['identifier']} to\", MU::ERR, details: vpc_id\n\t\t\t\t\traise \"Couldn't find subnets in #{vpc_id} to add #{@db['identifier']} to\"\n\t\t\t\telse\n\t\t\t\t\tsubnet_ids.each { |subnet_id|\n\t\t\t\t\t\t# Make sure we aren't configuring publicly_accessible wrong.\n\t\t\t\t\t\tif MU::VPC.isSubnetPrivate?(subnet_id, region: @db['region']) and @db[\"publicly_accessible\"]\n\t\t\t\t\t\t\tMU.log \"Found a private subnet but publicly_accessible is set to true on #{@db['identifier']}\", MU::ERR\n\t\t\t\t\t\t\traise \"Found a private subnet but publicly_accessible is set to true on #{@db['identifier']}\"\n\t\t\t\t\t\telsif !MU::VPC.isSubnetPrivate?(subnet_id, region: @db['region']) and !@db[\"publicly_accessible\"]\n\t\t\t\t\t\t\tMU.log \"Found a public subnet but publicly_accessible is set to false on #{@db['identifier']}\", MU::ERR\n\t\t\t\t\t\t\traise \"Found a public subnet but publicly_accessible is set to false on #{@db['identifier']}\"\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\n\t\t\t\t\t# Create subnet group\n\t\t\t\t\tresp = MU.rds(@db['region']).create_db_subnet_group(\n\t\t\t\t\t\tdb_subnet_group_name: config[:db_subnet_group_name],\n\t\t\t\t\t\tdb_subnet_group_description: config[:db_subnet_group_name],\n\t\t\t\t\t\tsubnet_ids: subnet_ids\n\t\t\t\t\t)\n\t\t\t\t\taddStandardTags(config[:db_subnet_group_name], \"subgrp\", region: @db['region'])\n\t\t\t\tend\n\n\t\t\t\t# Find NAT and create holes in security groups\n\t\t\t\tif @db[\"vpc\"][\"nat_host_name\"] or @db[\"vpc\"][\"nat_host_id\"]\n\t\t\t\t\tnat_instance, mu_name = MU::Server.find(\n\t\t\t\t\t\tid: @db[\"vpc\"][\"nat_host_id\"],\n\t\t\t\t\t\tname: @db[\"vpc\"][\"nat_host_name\"],\n\t\t\t\t\t\tregion: @db['region']\n\t\t\t\t\t)\n\n\t\t\t\t\tif nat_instance.nil?\n\t\t\t\t\t\tMU.log \"#{@db['name']} is configured to use #{@db['vpc']} but I can't find a running instance matching nat_host_id or nat_host_name\", MU::ERR\n\t\t\t\t\telse\n\t\t\t\t\t\tadmin_sg = MU::FirewallRule.setAdminSG(\n\t\t\t\t\t\t\tvpc_id: vpc_id,\n\t\t\t\t\t\t\tadd_admin_ip: nat_instance[\"private_ip_address\"],\n\t\t\t\t\t\t\tregion: @db['region']\n\t\t\t\t\t\t)\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tadmin_sg = MU::FirewallRule.setAdminSG(vpc_id: vpc_id, region: @db['region'])\n\t\t\t\tend\n\n\t\t\t\t# Create VPC security group and add to config \n\t\t\t\tvpc_db_sg = MU::FirewallRule.createEc2SG(@db['name'], nil, description: \"Database Security Group for #{@db['name']}\", vpc_id: vpc_id, region: @db['region'])\n\t\t\t\tif @db[\"snapshot_id\"].nil?\n\t\t\t\t\tconfig[:vpc_security_group_ids] = [vpc_db_sg, admin_sg]\n\n\t\t\t\t\tif @db[\"add_firewall_rules\"] and !@db[\"add_firewall_rules\"].empty?\n\t\t\t\t\t\t@db[\"add_firewall_rules\"].each { |acl|\n\t\t\t\t\t\t\tsg = MU::FirewallRule.find(sg_id: acl[\"rule_id\"], name: acl[\"rule_name\"], region: @db['region'])\n\t\t\t\t\t\t\tconfig[:vpc_security_group_ids] << sg.group_id if sg\n\t\t\t\t\t\t}\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse\n\t\t\t\t# If we didn't specify a VPC, make the distinction between EC2 Classic\n\t\t\t\t# or having a default VPC, so we can get security groups right.\n\t\t\t\tvpc_id = default_subnet = nil\n\t\t\t\tMU.ec2(@db['region']).describe_vpcs.vpcs.each { |vpc|\n\t\t\t\t\tif vpc.is_default\n\t\t\t\t\t\tvpc_id = vpc.vpc_id\n\t\t\t\t\t\tdefault_subnet = MU.ec2(@db['region']).describe_subnets(filters: [{:name => \"vpc-id\", :values => [vpc_id]}] ).subnets.first.subnet_id\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\tif default_subnet and vpc_id\n\t\t\t\t\t@db['vpc'] = {\n\t\t\t\t\t\t\"vpc_id\" => vpc_id,\n\t\t\t\t\t\t\"subnet_id\" => default_subnet\n\t\t\t\t\t}\n\t\t\t\t\tusing_default_vpc = true\n\t\t\t\telse\n\t\t\t\t\t# Creating an RDS secuirty group if no VPC exist. Not sure if this actually works. \n\t\t\t\t\tdb_sg_name = @db[\"name\"][email protected]+MU.seed.downcase\n\t\t\t\t\tMU.log \"Creating RDS security group #{db_sg_name}\"\n\t\t\t\t\tdb_security_group=MU.rds(@db['region']).create_db_security_group(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdb_security_group_name: db_sg_name,\n\t\t\t\t\t\t\tdb_security_group_description: MU.mu_id\n\t\t\t\t\t\t}\n\t\t\t\t\t)\n\n\t\t\t\t\taddStandardTags(db_sg_name, \"secgrp\", region: @db['region'])\n\n\t\t\t\t\tconfig[:db_security_groups] = [db_sg_name]\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn config\n\t\tend",
"title": ""
},
{
"docid": "980318fd707acbeb7795d1bd131704d2",
"score": "0.5339836",
"text": "def process_network_config(default_gateway_id, puppet_hash={})\n return if network_config.nil?\n logger.debug(\"Network bonding data: #{teams}\")\n network_resources = {}\n current_bond_seq = 0\n logger.debug(\"MTU setting for bonds: #{mtu}\")\n\n teams.each do |team|\n networks = team[:networks]\n macs = team[:mac_addresses]\n # validate\n if networks.length != 1\n logger.error(\"More than one network configuration data found in #{team}\")\n elsif macs.length < 1\n logger.error(\"No macaddress found for the interface that should be configured for #{team}\")\n end\n network = networks[0]\n tagged = @sd.bm_tagged?(network_config, network)\n if network[:static]\n if macs.length > 1\n bonded_static_nic_config(network, macs, tagged, puppet_hash, network_resources, current_bond_seq, default_gateway_id)\n current_bond_seq += 1\n else\n non_bonded_static_nic_config(network, macs, tagged, puppet_hash, network_resources, default_gateway_id)\n end\n elsif macs.length > 1\n bonded_dhcp_nic_config(network, macs, network_resources, current_bond_seq)\n current_bond_seq += 1\n else\n non_bonded_dhcp_nic_config(network, macs, tagged, network_resources)\n end\n end\n\n unless network_resources.empty?\n puppet_hash[\"resources\"] = network_resources\n all_networks = teams.map {|team| team[:networks] }.flatten\n appliance_ip = host_ip_config(all_networks)\n puppet_hash[\"resources\"][\"host\"]= {\"dellasm\" => {\"ensure\" => \"present\", \"ip\" => appliance_ip}}\n end\n\n pxe_nic_cleanup_config = pxe_nic_cleanup\n unless pxe_nic_cleanup_config.empty?\n puppet_hash[\"resources\"] ||= {}\n puppet_hash[\"resources\"][\"network::pxe_cleanup\"] = pxe_nic_cleanup_config\n end\n\n logger.debug(\"Network config node_data for #{@server_component[\"puppetCertName\"]}\")\n puppet_hash\n end",
"title": ""
},
{
"docid": "fead7ecb6c8b9033be22cedcac292fba",
"score": "0.52782995",
"text": "def manageSubnetGroup\n # Finding subnets, creating security groups/adding holes, create subnet group\n subnet_ids = []\n\ndependencies\n raise MuError.new \"Didn't find the VPC specified for #{@mu_name}\", details: @config[\"vpc\"].to_h unless @vpc\n\n mySubnets.each { |subnet|\n next if @config[\"publicly_accessible\"] and subnet.private?\n subnet_ids << subnet.cloud_id\n }\n\n if @config['creation_style'] == \"existing\"\n srcdb_vpc = @config['source'].kitten.cloud_desc.db_subnet_group.vpc_id\n if srcdb_vpc != @vpc.cloud_id\n MU.log \"#{self} is deploying into #{@vpc.cloud_id}, but our source database, #{@config['identifier']}, is in #{srcdb_vpc}\", MU::ERR\n raise MuError, \"Can't use 'existing' to deploy into a different VPC from the source database; try 'new_snapshot' instead\"\n end\n end\n\n if subnet_ids.empty?\n raise MuError, \"Couldn't find subnets in #{@vpc} to add to #{@config[\"subnet_group_name\"]}. Make sure the subnets are valid and publicly_accessible is set correctly\"\n else\n resp = begin\n MU::Cloud::AWS.rds(region: @region, credentials: @credentials).describe_db_subnet_groups(\n db_subnet_group_name: @config[\"subnet_group_name\"]\n )\n# XXX ensure subnet group matches our config?\n rescue ::Aws::RDS::Errors::DBSubnetGroupNotFoundFault\n # Create subnet group\n resp = MU::Cloud::AWS.rds(region: @region, credentials: @credentials).create_db_subnet_group(\n db_subnet_group_name: @config[\"subnet_group_name\"],\n db_subnet_group_description: @config[\"subnet_group_name\"],\n subnet_ids: subnet_ids,\n tags: @tags.each_key.map { |k| { :key => k, :value => @tags[k] } }\n )\n # The API forces it to lowercase, for some reason? Maybe not\n # always? Just rely on what it says.\n @config[\"subnet_group_name\"] = resp.db_subnet_group.db_subnet_group_name\n resp\n end\n\n myFirewallRules.each { |sg|\n next if sg.cloud_desc.vpc_id != @vpc.cloud_id\n @config[\"vpc_security_group_ids\"] ||= []\n @config[\"vpc_security_group_ids\"] << sg.cloud_id\n }\n end\n\n allowBastionAccess\n end",
"title": ""
},
{
"docid": "924e0f235899efebf40f13a40dead0e9",
"score": "0.5185769",
"text": "def cleanup_networks\n # Get list of NICs\n domain = @conn.lookup_domain_by_uuid(@uuid)\n definition = Util::VmDefinition.new(domain.xml_desc)\n nics = definition.get_all_nics\n nics.each do |nic|\n # for each nic remove dhcp entry from network\n network = @conn.lookup_network_by_name(nic[:network])\n network_def = Util::NetworkDefinition.new(nic[:network], network.xml_desc)\n\n @logger.info(\"Removing host entry from network #{nic[:network]}\")\n @logger.debug(\"Removing #{nic[:mac]} defined as:\\n#{network_def.get_host_xml(nic[:mac])}\")\n # 2 should be Libvirt::Network::NETWORK_UPDATE_COMMAND_DELETE\n # but fails as undefined? XXX\n network.update(2,\n Libvirt::Network::NETWORK_SECTION_IP_DHCP_HOST,\n -1,\n network_def.get_host_xml(nic[:mac]),\n Libvirt::Network::NETWORK_UPDATE_AFFECT_CURRENT\n )\n\n # if no entries left, destroy and undefine the network\n network = @conn.lookup_network_by_name(nic[:network])\n network_def = Util::NetworkDefinition.new(nic[:network], network.xml_desc)\n if network_def.hosts.count == 0\n @logger.info(\"Network #{nic[:network]} has no hosts left, deleting.\")\n network.destroy\n network.undefine\n end\n end\n end",
"title": ""
},
{
"docid": "cb1e6999aaa904eb75079b3f5669ca43",
"score": "0.51360613",
"text": "def build_lxc_config(lxc_config)\n lxc_config.clear\n\n lxc_config['lxc.arch'] = self.arch\n lxc_config['lxc.utsname'] = self.fqdn\n\n unless self.aa_profile.nil?\n lxc_config['lxc.aa_profile'] = self.aa_profile\n end\n\n unless self.cap_drop.nil?\n lxc_config['lxc.cap.drop'] = [self.cap_drop].flatten.compact.map(&:downcase).join(' ')\n end\n\n lxc_config.networks = build_lxc_network_conf(self.interfaces)\n\n lxc_config.save\n\n true\n end",
"title": ""
},
{
"docid": "09cf1f3c5cb0522ed86ec13879679250",
"score": "0.51139665",
"text": "def bonded_dhcp_nic_config(nic, macs, dhcp_net_config, current_bond_seq)\n logger.debug(\"Bonded dhcp NIC Partition: #{nic}\")\n logger.debug(\"Current bonded NIC sequence = #{current_bond_seq}\")\n bond_name = \"bond#{current_bond_seq}\"\n\n vlan_id = nic[:vlanId]\n # using static network resource because bootproto for ifcfg-bond<current_bond_seq> must be \"none\"\n # the actual dhcp bootproto must be applied to the ifcfg-bond<current_bond_seq>.<vlan_id> file\n dhcp_net_config[\"network::bond::static\"] ||= {}\n dhcp_net_config[\"network::bond::static\"][bond_name] = {\n \"ensure\" => \"up\",\n \"bonding_opts\" => bonding_opts,\n \"mtu\" => mtu\n }\n dhcp_net_config[\"network::bond::vlan\"] ||= {}\n dhcp_net_config[\"network::bond::vlan\"][bond_name] = {\n \"ensure\" => \"up\",\n \"bootproto\" => \"dhcp\",\n \"vlanId\" => vlan_id,\n \"bonding_opts\" => bonding_opts,\n \"mtu\" => mtu\n }\n\n macs.each do |macaddress|\n logger.debug(\"Bonded NIC Partition: #{nic}\")\n logger.debug(\"Bonded slave for bond#{current_bond_seq} = #{macaddress}\")\n dhcp_net_config[\"network::bond::slave\"] ||= {}\n dhcp_net_config[\"network::bond::slave\"][macaddress] = {\n \"macaddress\" => macaddress,\n \"master\" => \"bond#{current_bond_seq}\"\n }\n end\n end",
"title": ""
},
{
"docid": "a4aa74c988a7c93d04ca81938c886101",
"score": "0.5104158",
"text": "def check_kvm_network_bridge(options)\n exists = check_network_bridge_exists(options)\n if exists == false\n net_dev = options['bridge'].to_s\n handle_output(options,\"Warning:\\tNetwork bridge #{net_dev} doesn't exist\")\n quit(options)\n end\n exists = check_kvm_network_bridge_exists(options)\n if exists == true \n message = \"Warning:\\tKVM VM #{options['bridge']} already exists\"\n handle_output(options,message)\n quit(options)\n end\n kvm_bridge = options['bridge'].to_s\n bridge_file = \"/tmp/\"+kvm_bridge.to_s+\"_bridge.xml\"\n if File.exist?(bridge_file)\n File.delete(bridge_file)\n end\n file = File.open(bridge_file,\"w\")\n file.write(\"<network>\\n\")\n file.write(\" <name>#{kvm_bridge}</name>\\n\")\n file.write(\" <forward mode=\\\"bridge\\\"/>\\n\")\n file.write(\" <bridge name=\\\"#{kvm_bridge}\\\" />\\n\")\n file.write(\"</network>\\n\")\n file.close\n print_contents_of_file(options,\"\",bridge_file)\n if File.exist?(bridge_file)\n message = \"Information:\\tImporting KVM bridge config for #{kvm_bridge}\" \n command = \"virsh net-define #{bridge_file}\"\n execute_command(options,message,command)\n message = \"Information:\\tStarting KVM bridge #{kvm_bridge} config\"\n command = \"virsh net-start #{kvm_bridge}\"\n execute_command(options,message,command)\n message = \"Information:\\tSetting KVM bridge #{kvm_bridge} config to autostart\"\n command = \"virsh net-autostart #{kvm_bridge}\"\n execute_command(options,message,command)\n end\nend",
"title": ""
},
{
"docid": "9a82c1c16e7dc3e35ec08e4147c56cff",
"score": "0.510274",
"text": "def create_bridges\n @bridges = list_bridges\n\n process do |nic|\n create_bridge(nic)\n end\n end",
"title": ""
},
{
"docid": "dd88b32a9066461c83eaf8e518cc53b6",
"score": "0.5099036",
"text": "def domains_create\n debug 'Call: domains_create'\n domains.each do |domain|\n domain_name = domain.fetch 'name'\n next unless domain_name\n if domain_defined? domain_name\n warning \"Domain: #{domain_name} is already defined! Skipping!\"\n next\n end\n resolve_volume_paths domain['volumes']\n domain_create domain_name, domain\n end\n end",
"title": ""
},
{
"docid": "fd61beff01bfd5ae2888174921da6411",
"score": "0.50728744",
"text": "def factory_default\n {\n \"bridge.1.devname\" => \"br0\",\n \"bridge.1.fd\" => \"1\",\n \"bridge.1.port.1.devname\" => \"eth0\",\n \"bridge.1.port.2.devname\" => \"ath0\",\n \"bridge.1.port.3.devname\" => \"eth1\",\n \"bridge.status\" => \"enabled\",\n \"dhcpc.1.devname\" => \"br0\",\n \"dhcpc.1.status\" => \"enabled\",\n \"dhcpc.status\" => \"disabled\",\n \"dhcpd.1.status\" => \"disabled\",\n \"dhcpd.status\" => \"disabled\",\n \"ebtables.1.cmd\" => \"-t nat -A PREROUTING --in-interface ath0 -j arpnat --arpnat-target ACCEPT\",\n \"ebtables.1.status\" => \"enabled\",\n \"ebtables.2.cmd\" => \"-t nat -A POSTROUTING --out-interface ath0 -j arpnat --arpnat-target ACCEPT\",\n \"ebtables.2.status\" => \"enabled\",\n \"ebtables.3.cmd\" => \"-t broute -A BROUTING --protocol 0x888e --in-interface ath0 -j DROP\",\n \"ebtables.3.status\" => \"enabled\",\n \"ebtables.status\" => \"enabled\",\n \"httpd.status\" => \"enabled\",\n \"netconf.1.devname\" => \"eth0\",\n \"netconf.1.ip\" => \"0.0.0.0\",\n \"netconf.1.netmask\" => \"255.255.255.0\",\n \"netconf.1.promisc\" => \"enabled\",\n \"netconf.1.status\" => \"enabled\",\n \"netconf.1.up\" => \"enabled\",\n \"netconf.2.allmulti\" => \"enabled\",\n \"netconf.2.devname\" => \"ath0\",\n \"netconf.2.ip\" => \"0.0.0.0\",\n \"netconf.2.netmask\" => \"255.255.255.0\",\n \"netconf.2.promisc\" => \"enabled\",\n \"netconf.2.status\" => \"enabled\",\n \"netconf.2.up\" => \"enabled\",\n \"netconf.3.devname\" => \"br0\",\n \"netconf.3.ip\" => \"192.168.1.20\",\n \"netconf.3.netmask\" => \"255.255.255.0\",\n \"netconf.3.status\" => \"enabled\",\n \"netconf.3.up\" => \"enabled\",\n \"netconf.status\" => \"enabled\",\n \"radio.1.ack.auto\" => \"enabled\",\n \"radio.1.ackdistance\" => \"600\",\n \"radio.1.acktimeout\" => \"31\",\n \"radio.1.antenna\" => \"4\",\n \"radio.1.clksel\" => \"1\",\n \"radio.1.cwm.enable\" => \"0\",\n \"radio.1.cwm.mode\" => \"1\",\n \"radio.1.devname\" => \"ath0\",\n \"radio.1.dfs.status\" => \"enabled\",\n \"radio.1.freq\" => \"0\",\n \"radio.1.ieee_mode\" => \"auto\",\n \"radio.1.low_txpower_mode\" => \"disabled\",\n \"radio.1.mode\" => \"Managed\",\n \"radio.1.obey\" => \"enabled\",\n \"radio.1.polling\" => \"enabled\",\n \"radio.1.pollingnoack\" => \"0\",\n \"radio.1.pollingpri\" => \"\",\n \"radio.1.reg_obey\" => \"enabled\",\n \"radio.1.status\" => \"enabled\",\n \"radio.1.txpower\" => \"28\",\n \"radio.countrycode\" => \"840\", # United States / FCC\n \"radio.status\" => \"enabled\",\n \"resolv.host.1.name\" => \"ubnt\",\n \"route.1.devname\" => \"br0\",\n \"route.1.gateway\" => \"192.168.1.1\",\n \"route.1.ip\" => \"0.0.0.0\",\n \"route.1.netmask\" => \"0\",\n \"route.1.status\" => \"enabled\",\n \"route.status\" => \"enabled\",\n \"sshd.port\" => \"22\",\n \"sshd.status\" => \"enabled\",\n \"users.1.name\" => \"ubnt\",\n \"users.1.password\" => \"VvpvCwhccFv6Q\",\n \"users.1.status\" => \"enabled\",\n \"users.status\" => \"enabled\",\n \"wireless.1.addmtikie\" => \"enabled\",\n \"wireless.1.devname\" => \"ath0\",\n \"wireless.1.hide_ssid\" => \"disabled\",\n \"wireless.1.security\" => \"none\",\n \"wireless.1.ssid\" => \"ubnt\",\n \"wireless.1.status\" => \"enabled\",\n \"wireless.status\" => \"enabled\",\n \"aaa.status\" => \"disabled\",\n \"wpasupplicant.status\" => \"disabled\",\n \"wpasupplicant.device.1.status\" => \"disabled\",\n }\n end",
"title": ""
},
{
"docid": "ad051743e0db3ff488d7286db687add1",
"score": "0.50697386",
"text": "def process_config(config, delete_extra)\n # Pull out the templates section\n templates = {}\n templates = config.delete('templates')\n\n # Loop over the IPs and their domains\n config.each_pair do |ip, domains|\n unless ip.match(/(\\d+\\.){3}\\d+/)\n $LOG.warn \"\\n~ skipping key #{ip}, not a valid ip address\"\n next\n end\n domains.each_pair do |domain, desired_records|\n using_template = false\n if desired_records.nil?\n if templates.has_key?(ip)\n # There's no deep copy in Ruby, so we do this horrific thing\n desired_records = Marshal::load(Marshal.dump(templates[ip]))\n using_template = true\n else\n $LOG.warn(\"\\ndomain #{domain}: No records, skipping \")\n next\n end\n end\n zone = @zones.detect {|z| z.domain == domain } || Zone.create_for_domain(domain)\n records_for_domain, @records = @records.partition {|r| r.zone_id == zone.id }\n \n $LOG.debug \"\\ndomain #{domain}:\" unless using_template\n $LOG.debug \"\\ndomain #{domain} using template for #{ip}:\" if using_template\n \n # Tell us what needs to be done\n # Reconciler.new(zone, ip, records_for_domain, desired_records).report!\n #puts YAML.dump(records_for_domain)\n \n # Do what needs to be done\n Reconciler.new(zone, ip, records_for_domain, desired_records).process!\n \n @zones.delete(zone)\n end\n end\n\n leftovers = @zones.map{|z| z.domain}.join(', ') unless @zones.empty?\n if delete_extra and leftovers\n puts \"TODO: Delete #{leftovers}.\"\n end\n end",
"title": ""
},
{
"docid": "749df23561431dc0132c7507becc1d8b",
"score": "0.506637",
"text": "def update_dvs(dvs, pnics, mtu)\n # Prepare spec for DVS creation\n spec = RbVmomi::VIM::VMwareDVSConfigSpec.new\n changed = false\n\n orig_spec = RbVmomi::VIM::VMwareDVSConfigSpec.new\n orig_spec.maxMtu = dvs['config.maxMtu']\n orig_spec.uplinkPortPolicy =\n RbVmomi::VIM::DVSNameArrayUplinkPortPolicy.new\n orig_spec.uplinkPortPolicy.uplinkPortName = []\n (0..dvs['config.uplinkPortgroup'].length-1).each do |index|\n orig_spec\n .uplinkPortPolicy\n .uplinkPortName[index]=\"dvUplink#{index+1}\"\n end\n\n # Add more uplinks to default uplink\n # port group according to number of pnics\n if pnics\n pnics = pnics.split(',')\n if !pnics.empty? && dvs['config.uplinkPortgroup']\n .length != pnics.size\n spec.uplinkPortPolicy =\n RbVmomi::VIM::DVSNameArrayUplinkPortPolicy.new\n spec.uplinkPortPolicy.uplinkPortName = []\n (dvs['config.uplinkPortgroup']\n .length..num_pnics-1)\n .each do |index|\n spec\n .uplinkPortPolicy\n .uplinkPortName[index] =\n \"dvUplink#{index+1}\"\n end\n changed = true\n end\n end\n\n # Set maximum MTU\n if mtu != dvs['config.maxMtu']\n spec.maxMtu = mtu\n changed = true\n end\n\n # The DVS must be created in the networkFolder of the datacenter\n return unless changed\n\n spec.configVersion = dvs['config.configVersion']\n\n begin\n dvs\n .item\n .ReconfigureDvs_Task(\n :spec => spec\n ).wait_for_completion\n rescue StandardError => e\n raise \"The Distributed switch #{dvs['name']} could \\\n not be updated. \"\\\n \"Reason: #{e.message}\"\n end\n\n @net_rollback << {\n :action => :update_dvs,\n :dvs => dvs.item,\n :name => dvs['name'],\n :spec => orig_spec\n }\n end",
"title": ""
},
{
"docid": "7f5fc7f9bbc42095f49d06e3168267df",
"score": "0.5029345",
"text": "def enable_dhcp\n @interface_config[\"BOOTPROTO\"] = \"dhcp\"\n @interface_config.delete(\"IPADDR\")\n @interface_config.delete(\"NETMASK\")\n @interface_config.delete(\"GATEWAY\")\n @interface_config.delete(\"PREFIX\")\n @interface_config.delete(\"DNS1\")\n @interface_config.delete(\"DNS2\")\n @interface_config.delete(\"DOMAIN\")\n end",
"title": ""
},
{
"docid": "9cba442db470472c64f71dc4b141e41b",
"score": "0.50259656",
"text": "def undeploy_config\n return false unless remove_config\n host.disable if reload_bacula\n end",
"title": ""
},
{
"docid": "707098dd0c856da8dcdc819fb8756098",
"score": "0.50112724",
"text": "def create\n @domain = Domain.new(domain_params)\n @emails = Email.where(\"email_domain = ?\", @domain.url)\n if @domain.sat_bridge == 6\n @domain.global_bridge = 0\n @domain.save\n end\n respond_to do |format|\n if @domain.save\n @emails.each do |dupdate|\n dupdate.bridge = @domain.sat_bridge\n dupdate.save\n end\n format.html { redirect_to new_domain_path, notice: 'Domain was successfully classified to a bridge.' }\n format.json { render :show, status: :created, location: @domain }\n else\n format.html { render :new }\n format.json { render json: @domain.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "446a72977308d3912fe9867cb4ff8d4c",
"score": "0.4999839",
"text": "def create_config(config)\n # There are more fields the user should not set, but we're not checking for them at this time.\n fail 'BackupConfigurationId should not be set by the user' unless config['BackupConfigurationId'].nil?\n\n # Dup the hash so we don't modify the parent\n my_config = config.dup\n\n # Add fields populated by the API\n my_config['BackupConfigurationId'] = _random_id\n @mock_configurations.push(my_config)\n end",
"title": ""
},
{
"docid": "305322e90e882dbf503e69b2afd9d49f",
"score": "0.49957433",
"text": "def bonded_static_nic_config(nic, macs, tagged, puppet_hash, static_net_config, current_bond_seq, default_gateway_id)\n logger.debug(\"Bonded static NIC Partition: #{nic}\")\n logger.debug(\"Current bonded NIC sequence = #{current_bond_seq}\")\n\n bond_name = \"bond#{current_bond_seq}\"\n default_gateway_dev = nil\n\n if !tagged\n static_net_config[\"network::bond::static\"] ||= {}\n static_net_config[\"network::bond::static\"][bond_name] = {\n \"ensure\" => \"up\",\n \"ipaddress\" => nic[:staticNetworkConfiguration][:ipAddress],\n \"netmask\" => nic[:staticNetworkConfiguration][:subnet],\n \"gateway\" => (nic[:staticNetworkConfiguration][:gateway] || \"\"),\n \"bonding_opts\" => bonding_opts,\n \"mtu\" => mtu\n }\n default_gateway_dev = bond_name\n else\n vlan_id = nic[:vlanId]\n static_net_config[\"network::bond::static\"] ||= {}\n static_net_config[\"network::bond::static\"][bond_name] = {\n \"ensure\" => \"up\",\n \"bonding_opts\" => bonding_opts,\n \"mtu\" => mtu\n }\n default_gateway_dev = \"#{bond_name}.#{vlan_id}\"\n static_net_config[\"network::bond::vlan\"] ||= {}\n static_net_config[\"network::bond::vlan\"][bond_name] = {\n \"ensure\" => \"up\",\n \"ipaddress\" => nic[:staticNetworkConfiguration][:ipAddress],\n \"netmask\" => nic[:staticNetworkConfiguration][:subnet],\n \"gateway\" => (nic[:staticNetworkConfiguration][:gateway] || \"\"),\n \"vlanId\" => vlan_id,\n \"bonding_opts\" => bonding_opts,\n \"mtu\" => mtu\n }\n end\n\n if default_gateway_id == nic[:id] && !default_gateway_dev.nil?\n if supported_suse?(os)\n puppet_hash[\"classes\"][\"network::suse_routes\"][\"device\"] = default_gateway_dev\n else\n puppet_hash[\"classes\"][\"network::global\"][\"gatewaydev\"] = default_gateway_dev\n end\n end\n\n macs.each do |macaddress|\n logger.debug(\"Bonded NIC Partition: #{nic}\")\n logger.debug(\"Bonded slave for bond#{current_bond_seq} = #{macaddress}\")\n static_net_config[\"network::bond::slave\"] ||= {}\n static_net_config[\"network::bond::slave\"][macaddress] = {\n \"macaddress\" => macaddress,\n \"master\" => \"bond#{current_bond_seq}\"\n }\n end\n end",
"title": ""
},
{
"docid": "5b28e36257aaae6abc43159193e3829e",
"score": "0.4976462",
"text": "def setup_domains\n authorize unless @heroku\n each_heroku_app do |heroku_env, app_name, repo|\n # get the domains that we are aiming towards\n domains = @config.domains(heroku_env)\n\n # get the domains that are already on the servers\n existing_domains = (@heroku.list_domains(app_name) || []).map{|a| a[:domain]}\n\n # remove the domains that need to be removed\n existing_domains.each do |existing_domain|\n # check to see if we need to delete this domain\n unless domains.include?(existing_domain)\n # delete this domain if they arent on the approved list\n destroy_command \"heroku domains:remove #{existing_domain} --app #{app_name}\"\n end\n end\n\n # add the domains that dont exist already\n domains.each do |domain|\n # check to see if we need to add this domain\n unless existing_domains.include?(domain)\n # add this domain if they are not already added\n creation_command \"heroku domains:add #{domain} --app #{app_name}\"\n end\n end\n\n # display the destructive commands\n output_destroy_commands(app_name)\n end\n end",
"title": ""
},
{
"docid": "3712a26aba6b2fd81d31ceaa198d969f",
"score": "0.49716166",
"text": "def hostonly_create_network(config)\n options = {\n network_id: config[:name] || next_network_id,\n adapter_ip: config[:adapter_ip],\n netmask: config[:netmask],\n }\n\n if config[:type] == :dhcp\n options[:dhcp] = {\n ip: config[:dhcp_ip],\n lower: config[:dhcp_lower],\n upper: config[:dhcp_upper]\n }\n end\n\n @env[:machine].provider.driver.create_host_only_network(options)\n end",
"title": ""
},
{
"docid": "b4211e3d75dbaa90448d82291c5787f8",
"score": "0.49593017",
"text": "def hostBusAdaptersByType(hbaType)\n storageDeviceInfo.hostBusAdapter.delete_if { |hba| hba.xsiType != hbaType }\n end",
"title": ""
},
{
"docid": "df0fc7ad2c96fb98e5b228b1d97a4bfa",
"score": "0.49562278",
"text": "def add_dnsbl(name,domain,type='ip',codes={\"0\"=>\"OK\",\"127.0.0.2\"=>\"Blacklisted\"})\n\t\t\t@dnsbls[name] = codes\n\t\t\t@dnsbls[name]['domain'] = domain\n\t\t\t@dnsbls[name]['type'] = type\n\t\tend",
"title": ""
},
{
"docid": "2da138155bfdefa56483409cab1f5c95",
"score": "0.49520922",
"text": "def create_elb(config)\n lb_placeholder = @opsworks.elb_client.load_balancers[config['name']]\n if not lb_placeholder.exists?\n puts \"creating new elb #{config['name']}\" if @verbose\n new_config = {:listeners => config['listeners']}\n new_config[:availability_zones] = config['availability_zones'] if config['availability_zones']\n new_config[:subnets] = config['subnets'] if config['subnets']\n new_config[:security_groups] = config['security_groups'] if config['security_groups']\n new_config[:scheme] = config['scheme'] if config['scheme']\n puts new_config\n @opsworks.elb_client.load_balancers.create(config['name'], new_config)\n lb_placeholder = @opsworks.elb_client.load_balancers[config['name']]\n if not lb_placeholder.exists?\n raise \"could not find elb #{config['name']} after creation\"\n end\n else\n puts \"skipping existing elb #{config['name']}\" if @verbose\n end\n\n lb_placeholder.configure_health_check(config['health_check'])\n end",
"title": ""
},
{
"docid": "fe0dec27b200f805e414cb7b7357eea7",
"score": "0.49461272",
"text": "def update_dpg(dpg, vlan_id, num_ports)\n spec = RbVmomi::VIM::DVPortgroupConfigSpec.new\n\n changed = false\n\n orig_spec =\n RbVmomi::VIM::DVPortgroupConfigSpec.new\n orig_spec.numPorts =\n dpg['config.numPorts']\n orig_spec.defaultPortConfig =\n RbVmomi::VIM::VMwareDVSPortSetting.new\n orig_spec.defaultPortConfig.vlan =\n RbVmomi::VIM::VmwareDistributedVirtualSwitchVlanIdSpec.new\n orig_spec.defaultPortConfig.vlan.vlanId =\n dpg['config.defaultPortConfig.vlan.vlanId']\n orig_spec.defaultPortConfig.vlan.inherited =\n false\n\n if num_ports && num_ports != orig_spec.numPorts\n spec.numPorts = num_ports\n changed = true\n end\n\n # earlyBinding. A free DistributedVirtualPort\n # will be selected and\n # assigned to a VirtualMachine when\n # the virtual machine is reconfigured\n # to connect to the portgroup.\n spec.type = 'earlyBinding'\n\n if vlan_id != orig_spec.defaultPortConfig.vlan.vlanId\n spec.defaultPortConfig =\n RbVmomi::VIM::VMwareDVSPortSetting.new\n spec.defaultPortConfig.vlan =\n RbVmomi::VIM::VmwareDistributedVirtualSwitchVlanIdSpec.new\n spec.defaultPortConfig.vlan.vlanId = vlan_id\n spec.defaultPortConfig.vlan.inherited = false\n changed = true\n end\n\n return unless changed\n\n spec.configVersion = dpg['config.configVersion']\n\n begin\n dpg\n .item\n .ReconfigureDVPortgroup_Task(\n :spec => spec\n ).wait_for_completion\n rescue StandardError => e\n raise \"The Distributed port group #{dpg['name']} \\\n could not be created. \"\\\n \"Reason: #{e.message}\"\n end\n\n @net_rollback << {\n :action => :update_dpg,\n :dpg => dpg.item,\n :name => dpg['name'],\n :spec => orig_spec\n }\n end",
"title": ""
},
{
"docid": "723a7b3c831f5cc3a6b14272583e9563",
"score": "0.49264514",
"text": "def bridge_down_check(z)\n if (z > 1) && !@__bridge\n if (sys_tag = front_system_tag) == BridgeUD\n @__bridge = [sys_tag, system_tag]\n end\n elsif (z > 1) && @__bridge\n @__bridge = nil if @__bridge.last == system_tag\n end\n end",
"title": ""
},
{
"docid": "4c4a0e615ee2d4eee3fd7317721ca865",
"score": "0.49243265",
"text": "def create_bridge(nic)\n return if @bridges.key?(nic[:bridge])\n\n OpenNebula.exec_and_log(\"#{command(:ip)} link add name \" \\\n \"#{nic[:bridge]} type bridge #{list_bridge_options(nic)}\", nil, 2)\n\n @bridges[nic[:bridge]] = []\n\n OpenNebula.exec_and_log(\"#{command(:ip)} \" \\\n \"link set #{nic[:bridge]} up\")\n end",
"title": ""
},
{
"docid": "699522bbc1adbb2b9c578ef12fc68d5c",
"score": "0.49060613",
"text": "def test_vlan_mapping\n # This test covers two properties:\n # vlan_mapping & vlan_mapping_enabled\n #\n # This property has several dependencies:\n # - VDC support\n # - Specific linecard (F3)\n # - Bridge Domain Configuration\n # - Feature vni\n intf = mt_full_env_setup\n global_setup\n\n i = Interface.new(intf)\n i.switchport_mode = :trunk\n i.vlan_mapping = []\n assert_equal([], i.vlan_mapping, 'Initial cleanup failed')\n\n # Initial 'should' state\n # rubocop:disable Style/WordArray\n master = [['20', '21'],\n ['40', '41'],\n ['60', '61'],\n ['80', '81']]\n # rubocop:enable Style/WordArray\n\n # Test: Add all mappings when no cmds are present\n should = master.clone\n i.vlan_mapping = should\n result = i.vlan_mapping\n assert_equal(should.sort, result.sort,\n 'Test 1a. From empty, to all mappings')\n i.vlan_mapping_enable = false\n refute(i.vlan_mapping_enable,\n 'Test 1b. Initial test, set to disabled')\n\n # Test: remove half of the mappings\n should.shift(2)\n i.vlan_mapping = should\n result = i.vlan_mapping\n assert_equal(should.sort, result.sort,\n 'Test 2a. Remove half of the mappings')\n i.vlan_mapping_enable = true\n assert(i.vlan_mapping_enable,\n 'Test 2b. Back to enabled')\n\n # Test: restore the removed mappings\n should = master.clone\n i.vlan_mapping = should\n result = i.vlan_mapping\n assert_equal(should.sort, result.sort,\n 'Test 3a. Restore the removed mappings')\n i.vlan_mapping_enable = false\n refute(i.vlan_mapping_enable,\n 'Test 3b. Back to disabled')\n\n # Test: Change original-vlan on existing commands\n should = should.map do |original, translated|\n [original + '1', translated]\n end\n i.vlan_mapping = should\n result = i.vlan_mapping\n assert_equal(should.sort, result.sort,\n 'Test 4. Change original-vlan on existing commands')\n\n # Test: Change translated-vlan on existing commands\n should = should.map do |original, translated|\n [original, translated + '1']\n end\n i.vlan_mapping = should\n result = i.vlan_mapping\n assert_equal(should.sort, result.sort,\n 'Test 5. Change translated-vlan on existing commands')\n\n # Test: 'default'\n should = i.default_vlan_mapping\n i.vlan_mapping = should\n result = i.vlan_mapping\n assert_equal(should.sort, result.sort,\n \"Test 6a. 'default'\")\n i.vlan_mapping_enable = i.default_vlan_mapping_enable\n assert(i.vlan_mapping_enable,\n \"Test 6b. 'default'\")\n end",
"title": ""
},
{
"docid": "c15fddceb63a76891871c316267c8adf",
"score": "0.48903418",
"text": "def get_domains(config)\n domains = config['development']['domains'] || []\n domains << config['development']['domain'] unless config['development']['domain'].nil?\n\n # For backwards compatibility:\n # Eerlier we used the domain .dev and it's still ok\n domains << config['name']+\".dev\"\n domains << \"www.\"+config['name']+\".dev\"\n domains << config['name']+\".seravo.dev\" #test https-domain-alias locally\n domains << \"webgrind.\"+config['name']+\".dev\" #For xdebug\n domains << \"adminer.\"+config['name']+\".dev\" #For DB-administration\n domains << \"mailcatcher.\"+config['name']+\".dev\" #For Mail debugging\n domains << \"browsersync.\"+config['name']+\".dev\" #For browser-sync admin\n domains << \"info.\"+config['name']+\".dev\" #For Info page\n domains << \"terminal.\"+config['name']+\".dev\" #Running ad-hoc commands\n\n # Main domain should be {{site}}.local so that devices in same network can use them as well through zeroconf\n domains << config['name']+\".local\"\n domains << \"www.\"+config['name']+\".local\"\n domains << config['name']+\".seravo.local\" #test https-domain-alias locally\n domains << config['name']+\".wp-palvelu.local\" #test https-domain-alias locally\n domains << \"webgrind.\"+config['name']+\".local\" #For xdebug\n domains << \"adminer.\"+config['name']+\".local\" #For DB-administration\n domains << \"mailcatcher.\"+config['name']+\".local\" #For Mail debugging\n domains << \"browsersync.\"+config['name']+\".local\" #For browser-sync admin\n domains << \"info.\"+config['name']+\".local\" #For Info page\n domains << \"terminal.\"+config['name']+\".local\" #Running ad-hoc commands\n\n domains.uniq #remove duplicates\nend",
"title": ""
},
{
"docid": "17c09e4714191fc11ebe2222008bf4f5",
"score": "0.48625404",
"text": "def complete_launch_config_lb_setups\n translated[\"resources\"].find_all do |resource_name, resource|\n resource[\"type\"] == \"Rackspace::AutoScale::Group\"\n end.each do |name, value|\n if lbs = value[\"properties\"].delete(\"load_balancers\")\n lbs.each do |lb_ref|\n lb_name = resource_name(lb_ref)\n lb_resource = translated[\"resources\"][lb_name]\n vip_resources = translated[\"resources\"].find_all do |k, v|\n k.match(/#{lb_name}Vip\\d+/) && v[\"type\"] == \"Rackspace::Cloud::LoadBalancer\"\n end\n value[\"properties\"][\"launchConfiguration\"][\"args\"].tap do |lnch_config|\n lb_instance = {\n \"loadBalancerId\" => lb_ref,\n }\n # @note search for a port defined within parameters\n # that matches naming of LB ID for when they are\n # passed in rather than defined within the template.\n # Be sure to document this in user docs since it's\n # weird but needed\n if lb_resource\n lb_instance[\"port\"] = lb_resource[\"cache_instance_port\"]\n else\n key = parameters.keys.find_all do |k|\n if k.end_with?(\"Port\")\n lb_ref.values.first.start_with?(k.sub(\"Instance\", \"\").sub(/Port$/, \"\"))\n end\n end\n key = key.detect do |k|\n k.downcase.include?(\"instance\")\n end || key.first\n if key\n lb_instance[\"port\"] = {\"get_param\" => key}\n else\n raise \"Failed to translate load balancer configuartion. No port found! (#{lb_ref})\"\n end\n end\n lnch_config[\"loadBalancers\"] = [lb_instance]\n vip_resources.each do |vip_name, vip_resource|\n lnch_config[\"loadBalancers\"].push(\n \"loadBalancerId\" => {\n \"Ref\" => vip_name,\n },\n \"port\" => vip_resource[\"cache_instance_port\"],\n )\n end\n end\n end\n end\n end\n translated[\"resources\"].find_all do |resource_name, resource|\n resource[\"type\"] == \"Rackspace::Cloud::LoadBalancer\" &&\n !resource[\"properties\"][\"nodes\"].empty?\n end.each do |resource_name, resource|\n resource[\"properties\"][\"nodes\"].map! do |node_ref|\n {\n \"addresses\" => [\n {\n \"get_attr\" => [\n resource_name(node_ref),\n \"accessIPv4\",\n ],\n },\n ],\n \"port\" => resource[\"cache_instance_port\"],\n \"condition\" => \"ENABLED\",\n }\n end\n end\n translated[\"resources\"].values.find_all do |resource|\n resource[\"type\"] == \"Rackspace::Cloud::LoadBalancer\"\n end.each do |resource|\n resource.delete(\"cache_instance_port\")\n end\n true\n end",
"title": ""
},
{
"docid": "ddbe9f1e813a494142c2dd5f3f1a1573",
"score": "0.48593837",
"text": "def configure_disks(vb, server, hostname)\n disks = server['disks'] || {}\n unless File.file?(\".#{hostname}.txt\")\n vb.customize [\n 'storagectl', :id,\n '--name', 'SATA Controller',\n '--add', 'sata',\n '--portcount', disks.size\n ]\n end\n\n disks.each_with_index do |disk, i|\n disk_name = disk.first\n disk_size = disk.last['size']\n disk_uuid = disk.last['uuid']\n\n if File.file?(\"#{disk_name}.vdi\") && File.file?(\".#{disk_name}.txt\")\n file = File.open(\".#{disk_name}.txt\", 'r')\n current_uuid = file.read\n file.close\n elsif File.file?(\"#{disk_name}.vdi\")\n current_uuid = '0'\n elsif server['cluster'] &&\n File.file?(\"#{disk_name}_#{server['cluster']}.vdi\") &&\n File.file?(\".#{disk_name}_#{server['cluster']}.txt\")\n file = File.open(\".#{disk_name}_#{server['cluster']}.txt\", 'r')\n current_uuid = file.read\n file.close\n elsif server['cluster'] && File.file?(\"#{disk_name}_#{server['cluster']}.vdi\")\n current_uuid = '0'\n elsif server['cluster']\n vb.customize [\n 'createhd',\n '--filename', \"#{disk_name}_#{server['cluster']}.vdi\",\n '--size', disk_size.to_s,\n '--variant', 'Fixed'\n ]\n vb.customize [\n 'modifyhd', \"#{disk_name}_#{server['cluster']}.vdi\",\n '--type', 'shareable'\n ]\n current_uuid = '0'\n else\n vb.customize [\n 'createhd',\n '--filename', \"#{disk_name}.vdi\",\n '--size', disk_size.to_s,\n '--variant', 'Standard'\n ]\n current_uuid = '0'\n end\n\n # Conditional for adding disk_uuid\n if server['cluster'] && current_uuid.include?(disk_uuid)\n vb.customize [\n 'storageattach', :id,\n '--storagectl', 'SATA Controller',\n '--port', (i + 1).to_s,\n '--device', 0,\n '--type', 'hdd',\n '--medium', \"#{disk_name}_#{server['cluster']}.vdi\",\n '--mtype', 'shareable'\n ]\n elsif server['cluster']\n vb.customize [\n 'storageattach', :id,\n '--storagectl', 'SATA Controller',\n '--port', (i + 1).to_s,\n '--device', 0,\n '--type', 'hdd',\n '--medium', \"#{disk_name}_#{server['cluster']}.vdi\",\n '--mtype', 'shareable',\n '--setuuid', \"00000000-0000-0000-0000-0000000000#{disk_uuid}\"\n ]\n elsif current_uuid.include? disk_uuid\n vb.customize [\n 'storageattach', :id,\n '--storagectl', 'SATA Controller',\n '--port', (i + 1).to_s,\n '--device', 0,\n '--type', 'hdd',\n '--medium', \"#{disk_name}.vdi\"\n ]\n else\n vb.customize [\n 'storageattach', :id,\n '--storagectl', 'SATA Controller',\n '--port', (i + 1).to_s,\n '--device', 0,\n '--type', 'hdd',\n '--medium', \"#{disk_name}.vdi\",\n '--setuuid', \"00000000-0000-0000-0000-00000000000#{disk_uuid}\"\n ]\n end\n end\nend",
"title": ""
},
{
"docid": "d0f565582fc2738a48c7658482272623",
"score": "0.48355752",
"text": "def clean_configs(app_id, run_id)\n configs_db = nutella.f.persist.get_run_json_object_store(app_id, run_id, 'configs')\n channels_db = nutella.f.persist.get_run_json_object_store(app_id, run_id, 'channels')\n if configs_db['configs'] == nil || channels_db['channels'] == nil\n return\n end\n\n new_configs = configs_db.dup\n\n ids = []\n channels_db['channels'].each do |k, channel|\n ids << k\n end\n\n o = {}\n new_configs['configs'].each do |key, config|\n config = new_configs['configs'][key]\n config['mapping'].each do |mapping|\n mapping['items'].each do |item|\n item['channels'] = item['channels'] & ids # intersection of channels\n #p item['channels']\n end\n end\n o[key] = config\n end\n #new_configs['configs'] = c\n configs_db = nutella.f.persist.get_run_json_object_store(app_id, run_id, 'configs')\n configs_db['configs'] = o.dup\n publish_configs_update(app_id, run_id, o.dup)\nend",
"title": ""
},
{
"docid": "a542c516417b0e8f3bea22e34e3fac41",
"score": "0.48309517",
"text": "def complete_launch_config_lb_setups\n translated[\"resources\"].find_all do |resource_name, resource|\n resource[\"type\"] == \"OS::Heat::AutoScalingGroup\"\n end.each do |name, value|\n if lbs = value[\"properties\"].delete(\"load_balancers\")\n lbs.each do |lb_ref|\n lb_name = resource_name(lb_ref)\n # lb_resource = translated[\"resources\"][lb_name]\n vip_resources = translated[\"resources\"].find_all do |k, v|\n k.match(/#{lb_name}Vip\\d+/) && v[\"type\"] == \"OS::Neutron::LoadBalancer\"\n end\n value[\"properties\"][\"load_balancers\"] = vip_resources.map do |vip_name|\n {\"get_resource\" => vip_name}\n end\n end\n end\n end\n true\n end",
"title": ""
},
{
"docid": "f5031ee3dc5a77f4d91bb86041a9b601",
"score": "0.48246402",
"text": "def set_bridge_options\n @nic[:ovs_bridge_conf].each do |option, value|\n cmd = \"#{command(:ovs_vsctl)} set bridge \" <<\n \"#{@nic[:bridge]} #{option}=#{value}\"\n\n OpenNebula.exec_and_log(cmd)\n end\n end",
"title": ""
},
{
"docid": "44fdf3902d09fac8ef32a54449eb0720",
"score": "0.48225304",
"text": "def non_bonded_static_nic_config(nic, macs, tagged, puppet_hash, static_net_config, default_gateway_id)\n logger.debug(\"Standard static NIC Partition: #{nic}\")\n if supported_suse?(os)\n if !tagged\n logger.debug(\"Creating resources for untagged NIC (SLES) for #{@server_component[\"puppetCertName\"]}..\")\n static_net_config[\"network::if::suse_static\"] ||= {}\n static_net_config[\"network::if::suse_static\"][macs[0]] = {\n \"ensure\" => \"up\",\n \"ipaddress\" => nic[:staticNetworkConfiguration][:ipAddress],\n \"netmask\" => nic[:staticNetworkConfiguration][:subnet],\n \"gateway\" => (nic[:staticNetworkConfiguration][:gateway] || \"\"),\n \"macaddress\" => macs[0],\n \"domain\" => (nic[:staticNetworkConfiguration][:dnsSuffix] || \"\")\n }\n else\n logger.debug(\"Creating resources for tagged NIC (SLES) for #{@server_component[\"puppetCertName\"]}..\")\n vlan_id = nic[:vlanId]\n logger.debug(\"VLAN tagging is required on the OS level for vlan #{vlan_id} configuring static NIC (no bonding)\")\n static_net_config[\"network::if::suse_static\"] ||= {}\n static_net_config[\"network::if::suse_static\"][macs[0]] = {\n \"ensure\" => \"up\",\n \"macaddress\" => macs[0],\n \"bootproto\" => \"\"\n }\n static_net_config[\"network::if::suse_vlan\"] ||= {}\n static_net_config[\"network::if::suse_vlan\"][macs[0]] = {\n \"ensure\" => \"up\",\n \"vlanId\" => vlan_id,\n \"ipaddress\" => nic[:staticNetworkConfiguration][:ipAddress],\n \"netmask\" => nic[:staticNetworkConfiguration][:subnet],\n \"gateway\" => (nic[:staticNetworkConfiguration][:gateway] || \"\"),\n \"domain\" => (nic[:staticNetworkConfiguration][:dnsSuffix] || \"\")\n }\n end\n\n if default_gateway_id == nic[:id]\n puppet_hash[\"classes\"][\"network::suse_routes\"][\"device\"] = tagged ? \"vlan#{vlan_id}\" : macs[0]\n end\n else\n if !tagged\n logger.debug(\"Creating resources for untagged NIC (RHEL) for #{@server_component[\"puppetCertName\"]}..\")\n static_net_config[\"network::if::static\"] ||= {}\n static_net_config[\"network::if::static\"][macs[0]] = {\n \"ensure\" => \"up\",\n \"ipaddress\" => nic[:staticNetworkConfiguration][:ipAddress],\n \"netmask\" => nic[:staticNetworkConfiguration][:subnet],\n \"gateway\" => (nic[:staticNetworkConfiguration][:gateway] || \"\"),\n \"macaddress\" => macs[0],\n \"domain\" => (nic[:staticNetworkConfiguration][:dnsSuffix] || \"\")\n }\n else\n logger.debug(\"Creating resources for tagged NIC (RHEL) for #{@server_component[\"puppetCertName\"]}..\")\n vlan_id = nic[:vlanId]\n logger.debug(\"VLAN tagging is required on the OS level for vlan #{vlan_id} configuring static NIC (no bonding)\")\n static_net_config[\"network::if::static\"] ||= {}\n static_net_config[\"network::if::static\"][macs[0]] = {\n \"ensure\" => \"up\",\n \"macaddress\" => macs[0],\n \"domain\" => (nic[:staticNetworkConfiguration][:dnsSuffix] || \"\")\n }\n static_net_config[\"network::if::vlan\"] ||= {}\n static_net_config[\"network::if::vlan\"][macs[0]] = {\n \"ensure\" => \"up\",\n \"vlanId\" => vlan_id,\n \"ipaddress\" => nic[:staticNetworkConfiguration][:ipAddress],\n \"netmask\" => nic[:staticNetworkConfiguration][:subnet],\n \"gateway\" => (nic[:staticNetworkConfiguration][:gateway] || \"\"),\n \"domain\" => (nic[:staticNetworkConfiguration][:dnsSuffix] || \"\")\n }\n end\n\n if default_gateway_id == nic[:id]\n puppet_hash[\"classes\"][\"network::global\"][\"gatewaydev_macaddress\"] = macs[0]\n puppet_hash[\"classes\"][\"network::global\"][\"vlanId\"] = \"#{vlan_id}\" if vlan_id\n end\n end\n end",
"title": ""
},
{
"docid": "4a093ad4e1b4f2ddbd890284cfca112f",
"score": "0.48193097",
"text": "def configure_disks(vb, server, hostname, name)\n vminfo = vm_info(name)\n disks = server['disks'] || {}\n unless vminfo =~ /Storage Controller Name \\(1\\): *SATA Controller/\n # puts \"Attaching SATA Controller\"\n vb.customize [\n 'storagectl', :id,\n '--name', 'SATA Controller',\n '--add', 'sata',\n '--portcount', disks.size\n ]\n # else\n # puts 'SATA Controller already attached'\n end\n\n disks.each_with_index do |disk, i|\n disk_name = disk.first\n disk_size = disk.last['size']\n disk_uuid = disk.last['uuid']\n real_uuid = \"00000000-0000-0000-0000-#{disk_uuid.rjust(12,'0')}\"\n if server['cluster']\n disk_filename = File.join(VAGRANT_ROOT, \"#{disk_name}_#{server['cluster']}.vdi\")\n else\n disk_filename = File.join(VAGRANT_ROOT, \"#{disk_name}.vdi\")\n end\n\n if File.file?(disk_filename)\n # puts \"Disk #{disk_filename} already created\"\n disk_hash = `VBoxManage showmediuminfo \"#{disk_filename}\"`.scan(/(.*): *(.*)/).to_h\n current_uuid = disk_hash['UUID']\n else\n # puts \"Creating disk #{disk_filename}\"\n current_uuid = '0'\n if server['cluster']\n vb.customize [\n 'createhd',\n '--filename', disk_filename,\n '--size', disk_size.to_s,\n '--variant', 'Fixed'\n ]\n vb.customize [\n 'modifyhd', disk_filename,\n '--type', 'shareable'\n ]\n else\n vb.customize [\n 'createhd',\n '--filename', disk_filename,\n '--size', disk_size.to_s,\n '--variant', 'Standard'\n ]\n end\n end\n\n # Conditional for adding disk_uuid\n if server['cluster'] && current_uuid == real_uuid\n # puts \"Attaching shareable disk #{disk_filename}\"\n vb.customize [\n 'storageattach', :id,\n '--storagectl', 'SATA Controller',\n '--port', (i + 1).to_s,\n '--device', 0,\n '--type', 'hdd',\n '--medium', disk_filename,\n '--mtype', 'shareable'\n ]\n elsif server['cluster']\n # puts \"Attaching shareable disk #{disk_filename}, adding UUID #{real_uuid}\"\n vb.customize [\n 'storageattach', :id,\n '--storagectl', 'SATA Controller',\n '--port', (i + 1).to_s,\n '--device', 0,\n '--type', 'hdd',\n '--medium', disk_filename,\n '--mtype', 'shareable',\n '--setuuid', real_uuid\n ]\n elsif current_uuid == real_uuid\n # puts \"Attaching normal disk #{disk_filename}\"\n vb.customize [\n 'storageattach', :id,\n '--storagectl', 'SATA Controller',\n '--port', (i + 1).to_s,\n '--device', 0,\n '--type', 'hdd',\n '--medium', disk_filename\n ]\n else\n # puts \"Attaching normal disk #{disk_filename}, adding UUID #{real_uuid}\"\n vb.customize [\n 'storageattach', :id,\n '--storagectl', 'SATA Controller',\n '--port', (i + 1).to_s,\n '--device', 0,\n '--type', 'hdd',\n '--medium', disk_filename,\n '--setuuid', real_uuid\n ]\n end\n end\nend",
"title": ""
},
{
"docid": "b552d47c2791295dc96df7e00622a264",
"score": "0.48090968",
"text": "def parse_configuration #read the configuration parameters and parse data\t\t\n\t\t# supernet is a CIDR formatted IP block, assigned as an IPAddress object\n\t\tsupernet = @config.match(/^##\\@supernet=(.*?)$/)\n\t\t@supernet = IPAddress(supernet[1])\n\t\t#subnet_size is an integer, the number of hosts needed for a subnet\n\t\tsubnet_size = @config.match(/^##\\@subnet_size=(.*?)$/)\n\t\t@subnet_size = subnet_size[1].to_i\n\t\t#subnet_gateway is the string \"first\" or \"last\"\n\t\tsubnet_gateway = @config.match(/^##\\@subnet_gateway=(.*?)$/)\n\t\t@subnet_gateway = subnet_gateway[1]\n\t\t\n#\t\tSubnet.subnets = Array.new\n#\t\tReservation.reservations = Array.new\n\t\t\n\t\t# parse subnet configurations and create subnet objects, returns all\n\t\t# # subnet => # end strings into the subnets arrays\n\t\tsubnets = @config.scan(/# subnet.*?# end/m)\n\t\tif subnets.count > 0\n\t\t\t# iterate over the subnets returned and create a subnet for each one\n\t\t\tsubnets.each do |subnet_config|\n\t\t\t\tsubnet = Subnet.new\n\t\t\t\t# parse the 5 comma-separated values that makeup the individual subnet config\n\t\t\t\tconfiguration_fields = subnet_config.match(/subnet - (.*)$/)[1]\n\t\t\t\tsubnet_configuration = configuration_fields.split(\",\")\n\t\t\t\tsubnet.name = subnet_configuration[0]\n\t\t\t\tif subnet_configuration[1]\n\t\t\t\t\tsubnet.ipv4subnet = IPAddress(subnet_configuration[1])\n\t\t\t\t\tsubnet.ipv4gateway = IPAddress(subnet_configuration[2])\n\t\t\t\tend\n\t\t\t\tif subnet_configuration[3]\n\t\t\t\t\tsubnet.ipv6subnet = IPAddress(subnet_configuration[3])\n\t\t\t\t\tsubnet.ipv6gateway = IPAddress(\n\t\t\t\t\t\t\t\t subnet_configuration[4])\n\t\t\t\tend\n\t\t\t\tSubnet.subnets << subnet\n\t\t\t\treservations = subnet_config.scan(/host.*?\\}/m)\n\t\t\t\tif reservations.count > 0\n\t\t\t\t\treservations.each do |reservation_config|\n\t\t\t\t\t\treservation = Reservation.new\n\t\t\t\t\t\treservation.hostname = reservation_config.match(/host (\\S+)/)[1]\n\t\t\t\t\t\treservation.ipv4addr = IPAddress(\"#{reservation_config.match(/fixed-address ((?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))/)[1]}\")\n#\t\t\t\t\t\treservation.ipv6addr = IPAddress(\"#{reservation_config.match(/fixed-address6 ([0-9a-fA-F:]+?)/)[1]}\")\n\t\t\t\t\t\treservation.macaddr = reservation_config.match(/hardware ethernet ((?:[0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2})/)[1]\n\t\t\t\t\t\tReservation.reservations << reservation\n\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"title": ""
},
{
"docid": "a27495318071dd91a782d07ac4e65416",
"score": "0.47878814",
"text": "def destroy_connected_network(name, size)\n bridge = name + \"br\"\n for i in 0..(size - 1)\n `ruby xlxc-destroy.rb -n #{name + i.to_s()}`\n end\n `ruby xlxc-bridge.rb -b #{bridge} --del`\nend",
"title": ""
},
{
"docid": "ebfc27960bcc677c0736fb67a52f2eb4",
"score": "0.47877908",
"text": "def add_lxc_network_config(env, params)\n config = env[:machine].provider_config\n\n if config.use_network_defaults &&\n config.lxc_network_defaults.is_a?(Array)\n # define shortcuts to networks and network_defaults\n network_defaults = config.lxc_network_defaults\n networks = env[:machine].config.vm.networks\n # iterate through networks defined within vm and\n # apply defaults if needed\n networks.each_with_index do |_n, i|\n # merge settings with defaults\n next if networks[i].nil? || networks[i][0].nil?\n next if network_defaults[i].nil? || network_defaults[i][0].nil?\n next unless networks[i][0].to_sym == network_defaults[i][0].to_sym\n # merge network\n networks[i][1] = network_defaults[i][1].merge(networks[i][1])\n env[:ui].detail \"Network merged #{networks[i].inspect}\" if config\n .dry\n end\n end\n\n # ensure machine has public_network defined\n has_public_network = false\n # env[:machine].config.vm.networks got replaced by networks\n networks.each do |n|\n # skip forwarded_port\n if n.first == :forwarded_port\n env[:ui].detail I18n.t('vagrant_proxmox.network_setup_ignored',\n net_config: n) if config.dry\n next\n end\n # help user to find config errors, if no public_network is defined\n has_public_network = true if n.first == :public_network\n # c = network config hash\n c = n.last\n %i(net_id bridge).each do |e|\n unless c.include?(e)\n raise Errors::VMConfigError,\n error_msg: \"Network #{n} has no :#{e} element.\"\n end\n if c[e].nil?\n raise Errors::VMConfigError,\n error_msg: \"Network #{n} has empty :#{e} element.\"\n end\n end\n\n # use interface name detection\n auto_interface = get_lxc_interface_name(c)\n c[:interface] = auto_interface if auto_interface\n\n unless c.include?(:interface)\n raise Errors::VMConfigError,\n error_msg: \"Network #{n} has no :interface element.\"\\\n \" Set it to 'eth0' or similar.\"\n end\n\n # configuration entry\n cfg = []\n # name=<string>\n cfg.push(\"name=#{c[:interface]}\")\n # [,bridge=<bridge>]\n %w(bridge firewall gw gw6 hwaddr).each do |entry|\n e = entry.to_sym\n next if c[e].to_s.empty? # ignore element if empty\n cfg.push(\"#{entry}=#{c[e]}\") if c.include?(e)\n end\n has_ip = false\n # IPv4 - primary ip protocol\n e = :ip\n if c[:type] == 'dhcp' || (c.include?(e) && c[e] == 'dhcp')\n cfg.push('ip=dhcp')\n has_ip = true\n else\n v = get_ip_cidr4(c)\n if v\n cfg.push(\"ip=#{v}\")\n has_ip = true\n end\n end\n # IPv6 - additionally used ip protocol\n e = :ip6\n if c.include?(e) && c[e] == 'dhcp'\n cfg.push('ip6=dhcp')\n has_ip = true\n else\n v = get_ip_cidr6(c)\n if v\n cfg.push(\"ip6=#{v}\")\n has_ip = true\n end\n end\n\n if has_ip == false\n raise Errors::VMConfigError,\n error_msg: \"Network #{n} has no :ip or :ip6 element.\"\\\n ' You need to set an IP-Address'\n end\n # other options\n %w(mtu rate tag trunks).each do |entry|\n e = entry.to_sym\n next if c[e].to_s.empty? # ignore element if empty\n cfg.push(\"#{entry}=#{c[e]}\") if c.include?(e)\n end\n # static interface type, similar in all cases\n cfg.push('type=veth')\n # give user feedback about network used setup\n env[:ui].detail I18n.t('vagrant_proxmox.network_setup_info',\n net_id: c[:net_id].to_s,\n net_config: cfg.join(','))\n params[c[:net_id].to_s] = cfg.join(',')\n end\n if has_public_network == false\n raise Errors::VMConfigError,\n error_msg: 'Machine has no public_network. vagrant-proxmox'\\\n ' won\\'t be able to connect to it. Please edit '\\\n ' your config.'\n end\n end",
"title": ""
},
{
"docid": "7da63ce0aa9a4abfd8c4b3bba909a02e",
"score": "0.47857672",
"text": "def validate(config)\n raise ConfigurationError, \"domain: #{config[:domain]} does not exist within project\" unless domain?(config[:domain])\n raise ConfigurationError, 'disk size must be positive' unless config[:disk_size_gb].positive?\n raise ConfigurationError, 'size must be positive' unless config[:size].positive?\n\n # @check the networking options\n raise ConfigurationError, 'the network does not exist' unless network?(config[:network])\n raise ConfigurationError, 'the subnetwork does not exist' unless subnet?(config[:subnetwork], config[:network]) && !config[:create_subnetwork]\n if config[:enable_private_network] && !config[:master_ipv4_cidr_block]\n raise ConfigurationError, 'you must specify a master_ipv4_cidr_block'\n end\n\n # These checks only need to be run if the cluster doesn't exists already\n unless cluster?(config[:name])\n # @check if subnets exist - need to do something more clever\n # and check for overlapping subnety really but i can't find a gem\n network_checks = []\n network_checks.push(config[:cluster_ipv4_cidr]) unless config[:cluster_ipv4_cidr].empty?\n network_checks.push(config[:services_ipv4_cidr]) unless config[:services_ipv4_cidr].empty?\n\n if config[:enable_private_network]\n network_checks.push(config[:master_ipv4_cidr_block]) unless config[:master_ipv4_cidr_block].empty?\n end\n\n network_checks.each do |n|\n list = subnets(config[:network]) || []\n list.each do |x|\n raise ConfigurationError, \"subnetwork: #{n} already exists\" if x.ip_cidr_range.equal?(n)\n\n (x.secondary_ip_ranges || []).each do |j|\n raise ConfigurationError, \"subnetwork: #{n} already exists\" if j.ip_cidr_range.equal?(n)\n end\n end\n end\n\n if config[:enable_private_network]\n # @check for any conflicts in peering\n (peered_networks(config[:network]) || []).each do |n|\n network_checks.each do |x|\n raise ConfigurationError, \"conflicting peered network: #{n.dest_range}\" if n.dest_range == x\n end\n end\n end\n end\n\n config\n end",
"title": ""
},
{
"docid": "b375b00e11cda23d83db13ef18588b10",
"score": "0.4780715",
"text": "def vnx_host_access_configuration(storage_component)\n storage_group_name = \"ASM-#{@id}\"\n\n #create storagegroup before adding LUNs and Hosts to storagegroup\n process_generic(\n storage_component['puppetCertName'],\n {'asm::volume::vnx' => {'createstoragegroup' => {'sgname' => storage_group_name}}},\n 'apply',\n true,\n nil,\n storage_component['asmGUID']\n )\n storage_info = ASM::PrivateUtil.get_vnx_storage_group_info(storage_component['asmGUID'])\n host_lun_count = 0\n storage_group_hashes = []\n luns = []\n vnx_connectedhosts = []\n\n vnx_components.each do |vnx_component|\n resource_hash = ASM::PrivateUtil.build_component_configuration(vnx_component, :decrypt => decrypt?)\n (resource_hash['asm::volume::vnx'] || {}).each do |title, params|\n related_servers = find_related_components('SERVER', vnx_component)\n resource_hash['asm::volume::vnx'][title]['sgname'] = storage_group_name\n\n related_servers.each do |server_comp|\n server_hash = ASM::PrivateUtil.build_component_configuration(server_comp, :decrypt => true)\n host_name = ASM::Resource::Server.create(server_hash).first.os_host_name\n if ASM::PrivateUtil.is_host_connected_to_vnx(vnx_component[\"asmGUID\"], host_name, logger)\n vnx_connectedhosts << host_name\n end\n end\n alu = ASM::PrivateUtil.get_vnx_lun_id(vnx_component[\"asmGUID\"], title, logger)\n raise(\"Unable to find VNX LUN #{title} on the storage \") unless alu\n raise(\"Hosts are not connected to the storage, perhaps host are not added to brocade zone or alias\") if vnx_connectedhosts.empty?\n\n host_lun_number = host_lun_info(storage_group_name, storage_info, alu)\n unless host_lun_number\n host_lun_number = host_lun_count\n host_lun_count += 1\n end\n luns << {\"hlu\" => host_lun_number, \"alu\" => alu}\n end\n end\n\n # adding luns and connecting hosts\n vnx_connectedhosts.sort.uniq.each do |host_name|\n resource_hash = ASM::PrivateUtil.build_component_configuration(storage_component, :decrypt => decrypt?)\n (resource_hash['asm::volume::vnx'] || {}).each do |title, params|\n params.delete(\"add_to_sdrs\")\n resource_hash['asm::volume::vnx'][title]['host_name'] = host_name\n resource_hash['asm::volume::vnx'][title]['sgname'] = storage_group_name\n # alu is the LUN id you see on the navisphere, hlu is the LUN id that connected host can see\n resource_hash['asm::volume::vnx'][title]['luns'] = luns\n storage_group_hashes << resource_hash\n end\n end\n logger.debug(\"Storage group hashes: #{storage_group_hashes}\")\n storage_group_hashes.each do |vnx_host_access_hash|\n process_generic(\n storage_component['puppetCertName'],\n vnx_host_access_hash,\n 'apply',\n true,\n nil,\n storage_component['asmGUID']\n )\n end\n end",
"title": ""
},
{
"docid": "71250d3e733a92efdfcfaab0845f7411",
"score": "0.47696257",
"text": "def generate_config(options)\n path = options.path\n FileUtils.mkdir_p(File.join(path, 'config/pools'))\n FileUtils.mkdir_p(File.join(path, 'lib/deadpool/monitor'))\n FileUtils.mkdir_p(File.join(path, 'lib/deadpool/failover_protocol'))\n File.open File.join(path, 'config/pools/example.yml'), 'w' do |file|\n file.write <<-EOF\npool_name: 'example_database'\nprimary_host: '10.1.2.3'\nsecondary_host: '10.2.3.4'\ncheck_interval: 1\nmax_failed_checks: 10\n\n# There can be only one monitor per pool at this time. The deadpool system\n# defines no rules for the monitor configuration except that it is called\n# monitor_config: and has monitor_class: defined at the base level. \n# All other configuration variables are plugin specific.\nmonitor_config:\n monitor_class: Mysql\n nagios_plugin_path: '/usr/lib/nagios/plugins'\n\n# There can be as many Failover Protocols as you want and you can use \n# the same plugin multiple times. The deadpool defines no riles for the \n# failover protocol config except that it be an array element of \n# failover_protocol_configs and defines protocol_class at it's base. The rest\n# of the configuration is specific to the failover protocol.\nfailover_protocol_configs:\n - protocol_class: EtcHosts\n script_path: 'etc_hosts_switch'\n service_host_name: 'master.mysql.example.project.client'\n username: 'deadpool'\n password: 'p4ssw0rd'\n use_sudo: 1\n client_hosts:\n - '10.3.4.5' # app server 1 (web server)\n - '10.4.5.6' # app server 2 (web server)\n\n - protocol_class: ExecRemoteCommand\n test_command: '/etc/init.d/nginx status'\n exec_command: '/etc/init.d/nginx restart'\n username: 'deadpool'\n password: 'p4ssw0rd'\n use_sudo: 1\n client_hosts:\n - '10.3.4.5' # app server 1 (web server)\n - '10.4.5.6' # app server 2 (web server)\n EOF\n end\n File.open File.join(path, 'config/environment.yml'), 'w' do |file|\n file.write <<-EOF\n# log_path: '/var/log/deadpool.log'\n# log_level: INFO\n# system_check_interval: 30\n# admin_hostname: 'localhost'\n# admin_port: 5507\n EOF\n end\n end",
"title": ""
},
{
"docid": "0d7a1ddedfa3c4a7e3c729b2a97704be",
"score": "0.4758689",
"text": "def add_bridged_network_to_vbox_vm(options,nic_name)\n message = \"Information:\\tAdding bridged network \"+nic_name+\" to \"+options['name']\n command = \"#{options['vboxmanage']} modifyvm #{options['name']} --nic1 bridged --bridgeadapter1 #{nic_name}\"\n execute_command(options,message,command)\n return\nend",
"title": ""
},
{
"docid": "bce630b6e62fee75d2b5f03430ccdbac",
"score": "0.47501418",
"text": "def add_edge_gateway_rules(edge_gateway_name, vdc_id, edge_gateway_ip, vapp_id, ports)\n edge_vapp_ip = get_vapp_edge_public_ip(vapp_id)\n edge_network_id = find_edge_gateway_network(\n edge_gateway_name,\n vdc_id,\n edge_gateway_ip\n )\n edge_gateway_id = find_edge_gateway_id(edge_gateway_name, vdc_id)\n\n ### FIXME: tsugliani\n # We need to check the previous variables, especially (edge_*)\n # which can fail in some *weird* situations.\n params = {\n 'method' => :get,\n 'command' => \"/admin/edgeGateway/#{edge_gateway_id}\"\n }\n\n response, _headers = send_request(params)\n\n interesting = response.css(\n 'EdgeGateway Configuration EdgeGatewayServiceConfiguration'\n )\n\n add_snat_rule = true\n interesting.css('NatService NatRule').each do |node|\n if node.css('RuleType').text == 'DNAT' &&\n node.css('GatewayNatRule/OriginalIp').text == edge_gateway_ip &&\n node.css('GatewayNatRule/TranslatedIp').text == edge_vapp_ip &&\n node.css('GatewayNatRule/OriginalPort').text == 'any'\n # remove old DNAT rule any -> any from older vagrant-vcloudair versions\n node.remove\n end\n if node.css('RuleType').text == 'SNAT' &&\n node.css('GatewayNatRule/OriginalIp').text == edge_vapp_ip &&\n node.css('GatewayNatRule/TranslatedIp').text == edge_gateway_ip\n add_snat_rule = false\n end\n end\n\n add_firewall_rule = true\n interesting.css('FirewallService FirewallRule').each do |node|\n if node.css('Port').text == '-1' &&\n node.css('DestinationIp').text == edge_gateway_ip &&\n node.css('DestinationPortRange').text == 'Any'\n add_firewall_rule = false\n end\n end\n\n builder = Nokogiri::XML::Builder.new\n builder << interesting\n\n set_edge_rules = Nokogiri::XML(builder.to_xml) do |config|\n config.default_xml.noblanks\n end\n\n nat_rules = set_edge_rules.at_css('NatService')\n\n # Add all DNAT port rules edge -> vApp for the given list\n ports.each do |port|\n nat_rule = Nokogiri::XML::Builder.new do |xml|\n xml.NatRule {\n xml.RuleType 'DNAT'\n xml.IsEnabled 'true'\n xml.GatewayNatRule {\n xml.Interface('href' => edge_network_id )\n xml.OriginalIp edge_gateway_ip\n xml.OriginalPort port\n xml.TranslatedIp edge_vapp_ip\n xml.TranslatedPort port\n xml.Protocol 'tcpudp'\n }\n }\n end\n nat_rules << nat_rule.doc.root.to_xml\n end\n\n if (add_snat_rule)\n snat_rule = Nokogiri::XML::Builder.new do |xml|\n xml.NatRule {\n xml.RuleType 'SNAT'\n xml.IsEnabled 'true'\n xml.GatewayNatRule {\n xml.Interface('href' => edge_network_id )\n xml.OriginalIp edge_vapp_ip\n xml.TranslatedIp edge_gateway_ip\n xml.Protocol 'any'\n }\n }\n end\n nat_rules << snat_rule.doc.root.to_xml\n end\n\n\n if (add_firewall_rule)\n firewall_rule_1 = Nokogiri::XML::Builder.new do |xml|\n xml.FirewallRule {\n xml.IsEnabled 'true'\n xml.Description 'Allow Vagrant Communications'\n xml.Policy 'allow'\n xml.Protocols {\n xml.Any 'true'\n }\n xml.DestinationPortRange 'Any'\n xml.DestinationIp edge_gateway_ip\n xml.SourcePortRange 'Any'\n xml.SourceIp 'Any'\n xml.EnableLogging 'false'\n }\n end\n fw_rules = set_edge_rules.at_css('FirewallService')\n fw_rules << firewall_rule_1.doc.root.to_xml\n end\n\n xml = set_edge_rules.at_css 'EdgeGatewayServiceConfiguration'\n xml['xmlns'] = 'http://www.vmware.com/vcloud/v1.5'\n\n params = {\n 'method' => :post,\n 'command' => \"/admin/edgeGateway/#{edge_gateway_id}/action/\" +\n 'configureServices'\n }\n\n _response, headers = send_request(\n params,\n set_edge_rules.to_xml,\n 'application/vnd.vmware.admin.edgeGatewayServiceConfiguration+xml'\n )\n\n task_id = URI(headers['Location']).path.gsub('/api/task/', '')\n task_id\n end",
"title": ""
},
{
"docid": "af66fce59967d397fb43bf96108c4180",
"score": "0.4724018",
"text": "def enable_nat(bridge, ui)\n\tbridge_name \t= get_interface_name(bridge)\n\treturn if execute(true, \"ifconfig #{bridge_name} | grep inet\") == 0\n\n\tdirectory\t= @data_dir\n\t# Choose a subnet for this bridge\n\tindex = bridge_name =~ /\\d/\n\tbridge_num = bridge_name[index..-1]\n\tsub_net = \"172.16.\" + bridge_num\n\n\t# Config IP for the bridge\n\texecute(false, \"#{@sudo} ifconfig #{bridge_name} #{sub_net}.1/24\")\n\n\t# Get default gateway\n\tgateway = execute(false, \"netstat -4rn | grep default | awk '{print $4}'\")\n\tstore_attr('gateway', gateway)\n\t# Add gateway as a bridge member\n\texecute(false, \"#{@sudo} ifconfig #{bridge_name} addm #{gateway}\")\n\t\n\t# Enable forwarding\n\texecute(false, \"#{@sudo} sysctl net.inet.ip.forwarding=1 >/dev/null 2>&1\")\n\t\n\t# Change pf's configuration\n\tpf_conf = directory.join(\"pf.conf\")\n\tpf_conf.open(\"w\") do |pf_file|\n\t pf_file.puts \"#vagrant-bhyve nat\"\n\t pf_file.puts \"set skip on #{bridge_name}\"\n\t pf_file.puts \"nat on #{gateway} from {#{sub_net}.0/24} to any ->(#{gateway})\"\n\tend\n\t# Use pfctl to enable pf rules\n\texecute(false, \"#{@sudo} cp #{pf_conf.to_s} /usr/local/etc/pf.#{bridge_name}.conf\")\n\texecute(false, \"#{@sudo} pfctl -a vagrant_#{bridge_name} -f /usr/local/etc/pf.#{bridge_name}.conf\")\n\n\t# Create a basic dnsmasq setting\n\t# Basic settings\n\tdnsmasq = execute(true, 'which dnsmasq')\n\tif dnsmasq != 0\n\t ui.warn \"dnsmasq is not installed on your system, installing using pkg.\"\n\t pkg_install('dnsmasq')\n\tend\n\tdnsmasq_conf = directory.join(\"dnsmasq.conf\")\n\tdnsmasq_conf.open(\"w\") do |dnsmasq_file|\n\t dnsmasq_file.puts <<-EOF\n\t domain-needed\n\t except-interface=lo0\n\t bind-interfaces\n\t local-service\n\t dhcp-authoritative\n\t EOF\n\t # DHCP part\n\t dnsmasq_file.puts \"interface=#{bridge_name}\"\n\t dnsmasq_file.puts \"dhcp-range=#{sub_net + \".10,\" + sub_net + \".254\"}\"\n\t dnsmasq_file.puts \"dhcp-option=option:dns-server,#{sub_net + \".1\"}\"\n\tend\n\texecute(false, \"#{@sudo} cp #{dnsmasq_conf.to_s} /usr/local/etc/dnsmasq.#{bridge_name}.conf\")\n\tdnsmasq_cmd = \"dnsmasq -C /usr/local/etc/dnsmasq.#{bridge_name}.conf -l /var/run/dnsmasq.#{bridge_name}.leases -x /var/run/dnsmasq.#{bridge_name}.pid\"\n\texecute(false, \"#{@sudo} #{dnsmasq_cmd}\")\n\n end",
"title": ""
},
{
"docid": "950019845b139f0ae17e6881a9087058",
"score": "0.47148374",
"text": "def add_dhcp_client(options)\n if not options['mac'].to_s.match(/:/)\n options['mac'] = options['mac'][0..1]+\":\"+options['mac'][2..3]+\":\"+options['mac'][4..5]+\":\"+options['mac'][6..7]+\":\"+options['mac'][8..9]+\":\"+options['mac'][10..11]\n end\n tmp_file = \"/tmp/dhcp_\"+options['name']\n if not options['arch'].to_s.match(/sparc/)\n tftp_pxe_file = options['mac'].gsub(/:/,\"\")\n tftp_pxe_file = tftp_pxe_file.upcase\n if options['service'].to_s.match(/sol/)\n suffix = \".bios\"\n else\n if options['service'].to_s.match(/bsd/)\n suffix = \".pxeboot\"\n else\n suffix = \".pxelinux\"\n end\n end\n tftp_pxe_file = \"01\"+tftp_pxe_file+suffix\n else\n tftp_pxe_file = \"http://#{options['publisherhost'].to_s.strip}:5555/cgi-bin/wanboot-cgi\"\n end\n message = \"Checking:\\fIf DHCPd configuration contains \"+options['name']\n command = \"cat #{options['dhcpdfile']} | grep '#{options['name']}'\"\n output = execute_command(options,message,command)\n if not output.match(/#{options['name']}/)\n backup_file(options,options['dhcpdfile'])\n file = File.open(tmp_file,\"w\")\n file_info=IO.readlines(options['dhcpdfile'])\n file_info.each do |line|\n file.write(line)\n end\n file.write(\"\\n\")\n file.write(\"host #{options['name']} {\\n\")\n file.write(\" fixed-address #{options['ip']};\\n\")\n file.write(\" hardware ethernet #{options['mac']};\\n\")\n if options['service'].to_s.match(/[a-z,A-Z]/)\n #if options['biostype'].to_s.match(/efi/)\n # if options['service'].to_s.match(/vmware|esx|vsphere/)\n # file.write(\" filename \\\"#{options['service'].to_s}/bootx64.efi\\\";\\n\")\n # else\n # file.write(\" filename \\\"shimx64.efi\\\";\\n\")\n # end\n #else\n file.write(\" filename \\\"#{tftp_pxe_file}\\\";\\n\")\n #end\n end\n file.write(\"}\\n\")\n file.close\n message = \"Updating:\\tDHCPd file \"+options['dhcpdfile']\n command = \"cp #{tmp_file} #{options['dhcpdfile']} ; rm #{tmp_file}\"\n execute_command(options,message,command)\n restart_dhcpd(options)\n end\n check_dhcpd(options)\n check_tftpd(options)\n return\nend",
"title": ""
},
{
"docid": "3f2ee7f21792115016fe4921052f7be1",
"score": "0.471482",
"text": "def do_configure\n # check and set each of the properties we manage\n\n @managed_props.each do |prop|\n next if @zone.current_props[prop] == @zone.desired_props[prop]\n Chef::Log.info(\"Setting #{prop} to #{@zone.desired_props[prop]} for zone #{@zone.name}\")\n shell_out!(\"zonecfg -z #{@zone.name} \\\"set #{prop}=#{@zone.desired_props[prop]}\\\"\")\n new_resource.updated_by_last_action(true)\n end\n\n name_string = ''\n # rubocop:disable Style/Next\n @special_props.each do |prop|\n case prop\n when 'inherit-pkg-dir'\n name_string = 'dir'\n when 'dataset'\n name_string = 'name'\n when 'net'\n name_string = 'address'\n when 'fs'\n name_string = 'dir'\n end\n unless @zone.current_props[prop].sort == @zone.desired_props[prop]\n # values to be removed\n (@zone.current_props[prop] - @zone.desired_props[prop]).each do |value|\n Chef::Log.info(\"Removing #{prop} #{value} from zone #{@zone.name}\")\n if prop == 'net'\n net_array = value.split(':')\n shell_out!(\"zonecfg -z #{@zone.name} \\\"remove #{prop} #{name_string}=#{net_array[0]}\\\"\")\n else\n shell_out!(\"zonecfg -z #{@zone.name} \\\"remove #{prop} #{name_string}=#{value}\\\"\")\n end\n new_resource.updated_by_last_action(true)\n end\n # values to be added\n (@zone.desired_props[prop] - @zone.current_props[prop]).each do |value|\n Chef::Log.info(\"Adding #{prop} #{value} to zone #{@zone.name}\")\n if prop == 'net'\n net_array = value.split(':')\n shell_out!(\"zonecfg -z #{@zone.name} \\\"add #{prop}; set #{name_string}=#{net_array[0]};set physical=#{net_array[1]};#{net_array[2].nil? ? '' : 'set defrouter=' + net_array[2] + ';'}end\\\"\")\n elsif prop == 'fs'\n shell_out!(\"zonecfg -z #{@zone.name} \\\"add #{prop}; set #{name_string}=#{value}; set special=#{value}; set type=lofs; add options [ro,nodevices]; end\\\"\")\n else\n shell_out!(\"zonecfg -z #{@zone.name} \\\"add #{prop}; set #{name_string}=#{value};end\\\"\")\n end\n new_resource.updated_by_last_action(true)\n end\n end\n end\n # rubocop:enable Style/Next\nend",
"title": ""
},
{
"docid": "8bc3d80d97b0b7cec04d1c0139119b9b",
"score": "0.4712974",
"text": "def undeploy_config\n remove_config && reload_bacula\n end",
"title": ""
},
{
"docid": "4d10ad29542c710c4b05688869ea468b",
"score": "0.47023666",
"text": "def generate_config_ApplicationELB(awsregion,awsservice)\n applicationelbinstances = Array.new\n applicationelbtargetgroupinstances = Array.new\n\n Aws.config.update({\n region: \"#{awsregion}\",\n })\n\n applicationelb = Aws::ElasticLoadBalancingV2::Client.new(region: awsregion)\n applicationelb.describe_load_balancers.each do |instances|\n instances.load_balancers.each do |instance|\n instancename = instance.load_balancer_name\n instancearn = instance.load_balancer_arn\n\n unless $skipinstances.nil?\n unless $skipinstances['ApplicationELB'].nil?\n if $skipinstances['ApplicationELB'].include? \"#{instancename}\"\n $log.debug(\"Skipping config for: #{instancename} (on skipinstances list)\")\n next\n end\n end\n end\n\n applicationelbinstance = Hash.new\n applicationelbinstance['name'] = instancename\n # The ID is the last section of the ARN, with sections separated by colons.\n # ..but there is also a stray 'loadbalancer/' in front of it. Sigh.\n applicationelbinstance['id'] = instancearn.rpartition('loadbalancer/').last\n applicationelbinstance[\"tags\"] = Hash.new\n applicationelb.describe_tags({ resource_arns: [ \"#{instancearn}\" ] }).tag_descriptions.each do |tags|\n tags.tags.each do |tag|\n applicationelbinstance[\"tags\"][\"#{tag.key}\"] = \"#{tag.value}\"\n end\n end\n\n # TODO: What's the right way to figure out if both a parent and child are null?\n unless $matchtags.nil?\n unless $matchtags['ApplicationELB'].nil?\n # Default to excluding the instance; we'll set this to true if the instance matches one or more of the sets of tags.\n includeinstance=false\n\n $matchtags['ApplicationELB'].each do |matchtag|\n includeinstance=true if applicationelbinstance[\"tags\"].contain?( matchtag )\n end\n\n if (includeinstance == false)\n $log.debug(\"Skipping config for: #{applicationelbinstance['name']} (matchtags doesn't include a tag for it)\")\n next\n end\n end\n end\n\n # Iterate over the target groups..\n applicationelb.describe_target_groups( { load_balancer_arn: \"#{instancearn}\" }).target_groups.each do |targetgroup|\n applicationelbtargetgroupinstance = Hash.new\n # Specify parent ELB, for use in the json building exercise\n applicationelbtargetgroupinstance['parent'] = instancename\n # Ugh. Also need to include parent id, as have to do two dimensions..\n applicationelbtargetgroupinstance['parentid'] = applicationelbinstance['id']\n # Gonna specify our own name, not use the AWS name..\n #applicationelbtargetgroupinstance['name'] = targetgroup.target_group_name\n applicationelbtargetgroupinstance['arn'] = targetgroup.target_group_arn\n # The Target group ID is the last section of the ARN, with sections separate by colons.\n applicationelbtargetgroupinstance['id'] = applicationelbtargetgroupinstance['arn'].rpartition(':').last\n applicationelbtargetgroupinstance[\"tags\"] = Hash.new\n tags = applicationelb.describe_tags({ resource_arns: [ \"#{applicationelbtargetgroupinstance['arn']}\" ] }).tag_descriptions.each do |tags|\n tags.tags.each do |tag|\n applicationelbtargetgroupinstance[\"tags\"][\"#{tag.key}\"] = \"#{tag.value}\"\n end\n end\n\n # Take the name tag, strip off the application elb name from the front, and use it as our name..\n # TODO: Fallback to the actual 'name' parameter if this doesn't give us anything useful.\n instancenamestrippedalb = instancename.sub('alb','')\n applicationelbtargetgroupinstance['name'] = applicationelbtargetgroupinstance[\"tags\"][\"Name\"].sub(instancenamestrippedalb,'')\n\n applicationelbtargetgroupinstances.push(applicationelbtargetgroupinstance)\n end\n\n applicationelbinstances.push(applicationelbinstance)\n end\n end\n dimensionname = $dimensionname[\"#{awsservice}\"]\n buildjson(awsregion,applicationelbinstances,\"#{awsservice}\",\"detailed\",60,\"#{dimensionname}\")\n\n # Build JSON for target groups\n buildjson(awsregion,applicationelbtargetgroupinstances,\"ApplicationELB-Target\",\"detailed\",60,\"TargetGroup\")\nend",
"title": ""
},
{
"docid": "8a3e026cfef94f52d41646d2a7ccc63a",
"score": "0.46984732",
"text": "def config_common(config)\n config.vm.box_check_update = false\n # NOTE No new keys s.t. easy access for non-host machines (only need vagrant key)\n config.ssh.insert_key = false\nend",
"title": ""
},
{
"docid": "fe2e110cedb8c561abf60ea7d72b9eb1",
"score": "0.46950287",
"text": "def pxe_nic_cleanup\n logger.debug(\"Determine if PXE NIC should be removed explicitly from the OS network config...\")\n pxe_nics = network_config.get_partitions(\"PXE\")\n logger.debug(\"PXE network interface(s) detail: #{pxe_nics}\")\n\n cleanup_config = {}\n if pxe_nics && pxe_nics.size > 0\n pxe_nics.each do |pxe_nic|\n unless pxe_nic.networks.size > 1\n cleanup_config[pxe_nic[\"mac_address\"]] = {\n \"ensure\" => \"clean\"\n }\n end\n end\n end\n\n cleanup_config\n end",
"title": ""
},
{
"docid": "6f08e0f00aac2f98c2e864097f80760f",
"score": "0.46849066",
"text": "def cleanup_shipping_configurations(client, org)\n puts \"Cleaning up configurations and lanes for org #{org}\"\n # delete all the variant configurations\n each_shipping_configuration(client, org) do |sc|\n if sc.type == ::Io::Flow::V0::Models::ShippingConfigurationType.variant\n client.shipping_configurations.delete_by_key(org, sc.key)\n puts \"Deleted variant shipping configuration #{sc.key} for org #{org}\"\n end\n end\n\n # delete lanes only from default\n default_sc = default_shipping_configuration(client, org)\n each_shipping_lane(client, org, default_sc) do |lane|\n client.shipping_configurations.delete_lanes_by_key_and_id(org, default_sc.key, lane.id)\n puts \"Deleted shipping lane #{lane.id} config #{default_sc.key} for org #{org}\"\n end\n puts \"Done cleaning up configurations and lanes for org #{org}\"\nend",
"title": ""
},
{
"docid": "38370d84a60a892c2ff772f24695aa8f",
"score": "0.4680402",
"text": "def test_deploy_many_times\n deploy_app(SearchApp.new.sd(selfdir+\"sd/banana.sd\"))\n\n # sanity check for field from sd\n assert_match(\"age\", get_document_config())\n \n (0..15).each do |i|\n # deploy a new app, but do not activate config\n deploy_app(SearchApp.new.sd(selfdir+\"sd-extend/banana.sd\"), {:no_activate => true, :skip_create_model => true})\n end\n\n # restart configserver and keep zookeeper data\n restart_config_server(vespa.configservers[\"0\"], :keep_zookeeper_data => true)\n\n # we should still run with the same application as before all the 15 deployments\n # since we did not activate config, so similarfruits should not be there\n assert_match(\"age\", get_document_config())\n assert_no_match(\"similarfruits\", get_document_config())\n end",
"title": ""
},
{
"docid": "c1604e2def7ba18d01cfb0994655e8ba",
"score": "0.46778613",
"text": "def createDb\n # Shared configuration elements between most database creation styles\n config = {\n db_instance_identifier: @config['identifier'],\n db_instance_class: @config[\"size\"],\n engine: @config[\"engine\"],\n auto_minor_version_upgrade: @config[\"auto_minor_version_upgrade\"],\n license_model: @config[\"license_model\"],\n db_subnet_group_name: @config[\"subnet_group_name\"],\n publicly_accessible: @config[\"publicly_accessible\"],\n copy_tags_to_snapshot: true,\n tags: allTags\n }\n\n unless @config[\"add_cluster_node\"]\n config[:storage_type] = @config[\"storage_type\"] \n config[:port] = @config[\"port\"] if @config[\"port\"]\n config[:iops] = @config[\"iops\"] if @config['storage_type'] == \"io1\"\n config[:multi_az] = @config['multi_az_on_create']\n end\n\n if @config[\"creation_style\"] == \"new\"\n unless @config[\"add_cluster_node\"]\n config[:preferred_backup_window] = @config[\"preferred_backup_window\"]\n config[:backup_retention_period] = @config[\"backup_retention_period\"]\n config[:storage_encrypted] = @config[\"storage_encrypted\"]\n config[:allocated_storage] = @config[\"storage\"]\n config[:db_name] = @config[\"db_name\"]\n config[:master_username] = @config['master_user']\n config[:master_user_password] = @config['password']\n config[:vpc_security_group_ids] = @config[\"vpc_security_group_ids\"]\n end\n\n config[:engine_version] = @config[\"engine_version\"]\n config[:preferred_maintenance_window] = @config[\"preferred_maintenance_window\"] if @config[\"preferred_maintenance_window\"]\n config[:db_parameter_group_name] = @config[\"parameter_group_name\"] if @config[\"parameter_group_name\"]\n config[:db_cluster_identifier] = @config[\"cluster_identifier\"] if @config[\"add_cluster_node\"]\n end\n \n if %w{existing_snapshot new_snapshot}.include?(@config[\"creation_style\"])\n config[:db_snapshot_identifier] = @config[\"snapshot_id\"]\n end\n\n if @config[\"creation_style\"] == \"point_in_time\"\n point_in_time_config = config\n point_in_time_config.delete(:db_instance_identifier)\n point_in_time_config[:source_db_instance_identifier] = @config['source_identifier']\n point_in_time_config[:target_db_instance_identifier] = @config['identifier']\n point_in_time_config[:restore_time] = @config['restore_time'] unless @config[\"restore_time\"] == \"latest\"\n point_in_time_config[:use_latest_restorable_time] = true if @config['restore_time'] == \"latest\"\n end\n\n if @config[\"read_replica_of\"]# || @config[\"create_read_replica\"]\n srcdb = @config['source_identifier']\n if @config[\"read_replica_of\"][\"region\"] and @config['region'] != @config[\"read_replica_of\"][\"region\"]\n srcdb = MU::Cloud::AWS::Database.getARN(@config['source_identifier'], \"db\", \"rds\", region: @config[\"read_replica_of\"][\"region\"], credentials: @config['credentials'])\n end\n read_replica_struct = {\n db_instance_identifier: @config['identifier'],\n source_db_instance_identifier: srcdb,\n db_instance_class: @config[\"size\"],\n auto_minor_version_upgrade: @config[\"auto_minor_version_upgrade\"],\n publicly_accessible: @config[\"publicly_accessible\"],\n tags: allTags,\n db_subnet_group_name: @config[\"subnet_group_name\"],\n storage_type: @config[\"storage_type\"]\n }\n\n read_replica_struct[:port] = @config[\"port\"] if @config[\"port\"]\n read_replica_struct[:iops] = @config[\"iops\"] if @config['storage_type'] == \"io1\"\n end\n\n # Creating DB instance\n attempts = 0\n\n begin\n if %w{existing_snapshot new_snapshot}.include?(@config[\"creation_style\"])\n MU.log \"Creating database instance #{@config['identifier']} from snapshot #{@config[\"snapshot_id\"]}\"\n resp = MU::Cloud::AWS.rds(region: @config['region'], credentials: @config['credentials']).restore_db_instance_from_db_snapshot(config)\n elsif @config[\"creation_style\"] == \"point_in_time\"\n MU.log \"Creating database instance #{@config['identifier']} based on point in time backup #{@config['restore_time']} of #{@config['source_identifier']}\"\n resp = MU::Cloud::AWS.rds(region: @config['region'], credentials: @config['credentials']).restore_db_instance_to_point_in_time(point_in_time_config)\n elsif @config[\"read_replica_of\"]\n MU.log \"Creating read replica database instance #{@config['identifier']} for #{@config['source_identifier']}\"\n begin\n resp = MU::Cloud::AWS.rds(region: @config['region'], credentials: @config['credentials']).create_db_instance_read_replica(read_replica_struct)\n rescue Aws::RDS::Errors::DBSubnetGroupNotAllowedFault => e\n MU.log \"Being forced to use source database's subnet group: #{e.message}\", MU::WARN\n read_replica_struct.delete(:db_subnet_group_name)\n resp = MU::Cloud::AWS.rds(region: @config['region'], credentials: @config['credentials']).create_db_instance_read_replica(read_replica_struct)\n end\n elsif @config[\"creation_style\"] == \"new\"\n MU.log \"Creating pristine database instance #{@config['identifier']} (#{@config['name']}) in #{@config['region']}\"\n resp = MU::Cloud::AWS.rds(region: @config['region'], credentials: @config['credentials']).create_db_instance(config)\n end\n rescue Aws::RDS::Errors::InvalidParameterValue => e\n if attempts < 5\n MU.log \"Got #{e.inspect} creating #{@config['identifier']}, will retry a few times in case of transient errors.\", MU::WARN, details: config\n attempts += 1\n sleep 10\n retry\n else\n raise MuError, \"Exhausted retries trying to create database instance #{@config['identifier']}: #{e.inspect}\"\n end\n end\n\n wait_start_time = Time.now\n retries = 0\n\n begin\n MU::Cloud::AWS.rds(region: @config['region'], credentials: @config['credentials']).wait_until(:db_instance_available, db_instance_identifier: @config['identifier']) do |waiter|\n # Does create_db_instance implement wait_until_available ?\n waiter.max_attempts = nil\n waiter.before_attempt do |attempts|\n MU.log \"Waiting for RDS database #{@config['identifier']} to be ready..\", MU::NOTICE if attempts % 10 == 0\n end\n waiter.before_wait do |attempts, resp|\n throw :success if resp.db_instances.first.db_instance_status == \"available\"\n throw :failure if Time.now - wait_start_time > 3600\n end\n end\n rescue Aws::Waiters::Errors::TooManyAttemptsError => e\n raise MuError, \"Waited #{(Time.now - wait_start_time).round/60*(retries+1)} minutes for #{@config['identifier']} to become available, giving up. #{e}\" if retries > 2\n wait_start_time = Time.now\n retries += 1\n retry\n end\n\n database = MU::Cloud::AWS::Database.getDatabaseById(@config['identifier'], region: @config['region'], credentials: @config['credentials'])\n MU::Cloud::AWS::DNSZone.genericMuDNSEntry(name: database.db_instance_identifier, target: \"#{database.endpoint.address}.\", cloudclass: MU::Cloud::Database, sync_wait: @config['dns_sync_wait'])\n MU.log \"Database #{@config['name']} is at #{database.endpoint.address}\", MU::SUMMARY\n if @config['auth_vault']\n MU.log \"knife vault show #{@config['auth_vault']['vault']} #{@config['auth_vault']['item']} for Database #{@config['name']} credentials\", MU::SUMMARY\n end\n\n # If referencing an existing DB, insert this deploy's DB security group so it can access db\n if @config[\"creation_style\"] == 'existing'\n vpc_sg_ids = []\n database.vpc_security_groups.each { |vpc_sg|\n vpc_sg_ids << vpc_sg.vpc_security_group_id\n }\n\n localdeploy_rule = @deploy.findLitterMate(type: \"firewall_rule\", name: \"database\"+@config['name'])\n if localdeploy_rule.nil?\n raise MU::MuError, \"Database #{@config['name']} failed to find its generic security group 'database#{@config['name']}'\"\n end\n MU.log \"Found this deploy's DB security group: #{localdeploy_rule.cloud_id}\", MU::DEBUG\n vpc_sg_ids << localdeploy_rule.cloud_id\n mod_config = Hash.new\n mod_config[:vpc_security_group_ids] = vpc_sg_ids\n mod_config[:db_instance_identifier] = @config[\"identifier\"]\n\n MU::Cloud::AWS.rds(region: @config['region'], credentials: @config['credentials']).modify_db_instance(mod_config)\n MU.log \"Modified database #{@config['identifier']} with new security groups: #{mod_config}\", MU::NOTICE\n end\n\n # When creating from a snapshot, some of the create arguments aren't\n # applicable- but we can apply them after the fact with a modify.\n if %w{existing_snapshot new_snapshot point_in_time}.include?(@config[\"creation_style\"]) or @config[\"read_replica_of\"]\n mod_config = Hash.new\n if !@config[\"read_replica_of\"]\n mod_config[:preferred_backup_window] = @config[\"preferred_backup_window\"]\n mod_config[:backup_retention_period] = @config[\"backup_retention_period\"]\n mod_config[:engine_version] = @config[\"engine_version\"]\n mod_config[:allow_major_version_upgrade] = @config[\"allow_major_version_upgrade\"] if @config['allow_major_version_upgrade']\n mod_config[:db_parameter_group_name] = @config[\"parameter_group_name\"] if @config[\"parameter_group_name\"]\n mod_config[:master_user_password] = @config['password']\n mod_config[:allocated_storage] = @config[\"storage\"] if @config[\"storage\"]\n end\n mod_config[:db_instance_identifier] = database.db_instance_identifier\n mod_config[:preferred_maintenance_window] = @config[\"preferred_maintenance_window\"] if @config[\"preferred_maintenance_window\"]\n mod_config[:vpc_security_group_ids] = @config[\"vpc_security_group_ids\"]\n mod_config[:apply_immediately] = true\n\n MU::Cloud::AWS.rds(region: @config['region'], credentials: @config['credentials']).modify_db_instance(mod_config)\n wait_start_time = Time.now\n retries = 0\n\n begin\n MU::Cloud::AWS.rds(region: @config['region'], credentials: @config['credentials']).wait_until(:db_instance_available, db_instance_identifier: @config['identifier']) do |waiter|\n # Does create_db_instance implement wait_until_available ?\n waiter.max_attempts = nil\n waiter.before_attempt do |attempts|\n MU.log \"Waiting for RDS database #{@config['identifier'] } to be ready..\", MU::NOTICE if attempts % 10 == 0\n end\n waiter.before_wait do |attempts, resp|\n throw :success if resp.db_instances.first.db_instance_status == \"available\"\n throw :failure if Time.now - wait_start_time > 2400\n end\n end\n rescue Aws::Waiters::Errors::TooManyAttemptsError => e\n raise MuError, \"Waited #{(Time.now - wait_start_time).round/60*(retries+1)} minutes for #{@config['identifier']} to become available, giving up. #{e}\" if retries > 2\n wait_start_time = Time.now\n retries += 1\n retry\n end\n end\n\n # Maybe wait for DB instance to be in available state. DB should still be writeable at this state\n if @config['allow_major_version_upgrade'] && @config[\"creation_style\"] == \"new\"\n MU.log \"Setting major database version upgrade on #{@config['identifier']}'\"\n MU::Cloud::AWS.rds(region: @config['region'], credentials: @config['credentials']).modify_db_instance(\n db_instance_identifier: @config['identifier'],\n apply_immediately: true,\n allow_major_version_upgrade: true\n )\n end\n\n MU.log \"Database #{@config['identifier']} is ready to use\"\n return database.db_instance_identifier\n end",
"title": ""
},
{
"docid": "678a9201a6578fd18636b1eae0ebacd2",
"score": "0.46718246",
"text": "def add_bridge_port(port, dpdk_path = nil)\n return if @bridges[@nic[:bridge]].include? port\n\n ovs_cmd = \"#{command(:ovs_vsctl)} add-port #{@nic[:bridge]} #{port}\"\n\n if dpdk_path && dpdk?\n ovs_cmd << \" -- set Interface #{port} type=dpdkvhostuserclient\"\\\n \" options:vhost-server-path=#{dpdk_path}\"\n end\n\n OpenNebula.exec_and_log(ovs_cmd)\n\n @bridges[@nic[:bridge]] << port\n end",
"title": ""
},
{
"docid": "a547783a35218a00962a6706f1ffb88e",
"score": "0.46695396",
"text": "def config_container(name, bridge)\n container = File.join(XLXC::LXC, name)\n rootfs = File.join(container, \"rootfs\")\n config = File.join(container, \"config\")\n fstab = File.join(container, \"fstab\")\n bridge_file = File.join(container, \"bridge\")\n\n # Set up container config file.\n open(config, 'w') { |f|\n f.puts(XLXC::LXC_CONFIG_TEMPLATE)\n f.puts(\"lxc.network.link=#{bridge}\\n\" \\\n \"lxc.network.veth.pair=#{name}veth\\n\" \\\n \"lxc.rootfs=#{rootfs}\\n\" \\\n \"lxc.utsname=#{name}\\n\" \\\n \"lxc.mount=#{fstab}\")\n }\n\n # Set up container fstab file.\n open(fstab, 'w') { |f|\n f.puts(XLXC::FSTAB_TEMPLATE)\n }\n\n # Set up container hosts files.\n open(File.join(rootfs, XLXC::HOSTS_FILE), 'w') { |f|\n f.puts(sprintf(XLXC::HOSTS_TEMPLATE, name))\n }\n\n open(File.join(rootfs, XLXC::HOSTNAME_FILE), 'w') { |f|\n f.puts(name)\n }\n\n open(bridge_file, 'w') { |f|\n f.puts(bridge)\n }\nend",
"title": ""
},
{
"docid": "2670ce824b9d642a9104fdeb14c91cdd",
"score": "0.46683183",
"text": "def drop_database(config)\n case config[:adapter]\n when 'postgresql'\n `dropdb \"#{config[:database]}\"`\n when 'mysql'\n connection = RR::ConnectionExtenders.db_connect(config.merge({'database' => nil}))\n connection.drop_database config[:database]\n else\n puts \"adapter #{config[:adapter]} not supported\"\n end\nend",
"title": ""
},
{
"docid": "0dcae3d999cb73a5ab4fa2a65992d748",
"score": "0.46567082",
"text": "def deactivate\n lock\n\n @bridges = list_bridges\n\n attach_nic_id = @vm['TEMPLATE/NIC[ATTACH=\"YES\"]/NIC_ID']\n\n if @bridges\n process do |nic|\n next if attach_nic_id && attach_nic_id != nic[:nic_id]\n\n @nic = nic\n\n next if @nic[:phydev].nil?\n next if @bridges[@nic[:bridge]].nil?\n\n # Get the name of the vlan device.\n gen_vlan_dev_name\n\n # Return if the bridge doesn't exist because it was already\n # deleted (handles last vm with multiple nics on the same\n # vlan)\n next unless @bridges.include? @nic[:bridge]\n\n # Return if we want to keep the empty bridge\n next if @nic[:conf][:keep_empty_bridge]\n\n # Return if the vlan device is not the only left device in\n # the bridge.\n next if (@bridges[@nic[:bridge]].length > 1) || \\\n !@bridges[@nic[:bridge]].include?(@nic[:vlan_dev])\n\n # Delete the vlan device.\n delete_vlan_dev\n\n @bridges[@nic[:bridge]].delete(@nic[:vlan_dev])\n\n # Delete the bridge.\n OpenNebula.exec_and_log(\"#{command(:ip)} link delete\"\\\n \" #{@nic[:bridge]}\")\n @bridges.delete(@nic[:bridge])\n end\n end\n\n unlock\n\n 0\n end",
"title": ""
},
{
"docid": "8a03bb260d935dd1e337bde99b903f18",
"score": "0.4655488",
"text": "def configure_network\n add_static_ips\n add_dhcp_adapters\n configure_routes\n end",
"title": ""
},
{
"docid": "768dd9129da333010685236475f76f8d",
"score": "0.4654107",
"text": "def domain_create(domain_name, domain_attributes)\n name = domain_attributes.fetch 'name', domain_name\n fail 'There is no domain name!' unless name\n ram = domain_attributes.fetch 'ram', '1024'\n cpu = domain_attributes.fetch 'cpu', '2'\n volumes = domain_attributes.fetch 'volumes', {}\n networks = domain_attributes.fetch 'networks', {}\n commands = [\n 'virt-install',\n '--name', name,\n '--ram', ram,\n '--vcpus', \"#{cpu},cores=#{cpu}\",\n '--os-type', 'linux',\n '--virt-type', options[:virt],\n '--pxe',\n '--boot', 'network,hd',\n '--noautoconsole',\n '--graphics', 'vnc,listen=0.0.0.0',\n '--autostart',\n ]\n\n volumes.each do |volume|\n volume['serial'] = generate_disk_serial unless volume['serial']\n volume['cache'] = 'none' unless volume['cache']\n volume['bus'] = 'virtio' unless volume['bus']\n\n unless volume['path']\n warning \"Volume: #{volume.inspect} has no path defined! Skipping!\"\n next\n end\n\n disk_string = volume.reject do |attribute_name, _attribute_value|\n %w(size name).include? attribute_name\n end.map do |attribute_name, attribute_value|\n \"#{attribute_name}=#{attribute_value}\"\n end.join ','\n\n commands += ['--disk', disk_string]\n end\n\n networks.each do |network|\n network['model'] = 'virtio' unless network['model']\n\n unless network['network']\n warning \"Network: #{network.inspect} has no 'network' defined! Skipping!\"\n next\n end\n\n network_string = network.map do |attribute_name, attribute_value|\n \"#{attribute_name}=#{attribute_value}\"\n end.join ','\n commands += ['--network', network_string]\n end\n\n debug \"Domain create: #{commands.join ' '}\"\n _output, success = run commands\n error \"Failed to create the domain: #{name}\" unless success\n success\n end",
"title": ""
},
{
"docid": "1c766ca5433e033598049c1673c5e309",
"score": "0.46536836",
"text": "def deactivate\n lock\n\n @bridges = list_bridges\n\n attach_nic_id = @vm['TEMPLATE/NIC[ATTACH=\"YES\"]/NIC_ID']\n\n if @bridges\n process do |nic|\n next if attach_nic_id && attach_nic_id != nic[:nic_id]\n\n @nic = nic\n\n next if @bridges[@nic[:bridge]].nil?\n\n # Return if the bridge doesn't exist because it was already\n # deleted (handles last vm with multiple nics on the same\n # vlan)\n next unless @bridges.include? @nic[:bridge]\n\n # Return if we want to keep the empty bridge\n next if @nic[:conf][:keep_empty_bridge]\n\n # Return if the phydev device is not the only left device in\n # the bridge.A\n if @nic[:phydev].nil?\n keep = !@bridges[@nic[:bridge]].empty?\n else\n\n keep = @bridges[@nic[:bridge]].length > 1 ||\n !@bridges[@nic[:bridge]].include?(@nic[:phydev])\n end\n\n next if keep\n\n # Delete the bridge.\n OpenNebula.exec_and_log(\"#{command(:ip)} link delete\"\\\n \" #{@nic[:bridge]}\")\n @bridges.delete(@nic[:bridge])\n end\n end\n\n unlock\n\n 0\n end",
"title": ""
},
{
"docid": "e6ca88444d855bcd52f107d343673013",
"score": "0.464281",
"text": "def create_ubuntu_lxc_config(options)\n tmp_file = \"/tmp/lxc_\"+options['name']\n options['ip'] = single_install_ip(options)\n options['clientdir'] = options['lxcdir']+\"/\"+options['name']\n config_file = options['clientdir']+\"/config\"\n message = \"Information:\\tCreating configuration for \"+options['name']\n command = \"cp #{config_file} #{tmp_file}\"\n execute_command(options,message,command)\n copy = []\n info = IO.readlines(config_file)\n info.each do |line|\n if line.match(/hwaddr/)\n if options['mac'].to_s.match(/[0-9]/)\n output = \"lxc.network.hwaddr = \"+options['mac']+\"\\n\"\n copy.push(output)\n output = \"lxc.network.ipv4 = \"+options['ip']+\"\\n\"\n copy.push(output)\n else\n copy.push(line)\n output = \"lxc.network.ipv4 = \"+options['ip']+\"\\n\"\n copy.push(output)\n end\n else\n copy.push(line)\n end\n end\n copy = copy.join\n File.open(tmp_file,\"w\") { |file| file.write(copy) }\n message = \"Information:\\tCreating network configuration file \"+config_file\n command = \"cp #{tmp_file} #{config_file} ; rm #{tmp_file}\"\n execute_command(options,message,command)\n print_contents_of_file(options,\"\",config_file)\n file = File.open(tmp_file,\"w\")\n gateway = options['q_struct']['gateway'].value\n broadcast = options['q_struct']['broadcast'].value\n netmask = options['q_struct']['netmask'].value\n network = options['q_struct']['network_address'].value\n nameserver = options['q_struct']['nameserver'].value\n file.write(\"# The loopback network interface\\n\")\n file.write(\"auto lo\\n\")\n file.write(\"iface lo inet loopback\\n\")\n file.write(\"\\n\")\n file.write(\"auto eth0\\n\")\n file.write(\"iface eth0 inet static\\n\")\n file.write(\"address #{options['ip']}\\n\")\n file.write(\"netmask #{netmask}\\n\")\n file.write(\"gateway #{gateway}\\n\")\n file.write(\"network #{network}\\n\")\n file.write(\"broadcast #{broadcast}\\n\")\n file.write(\"dns-nameservers #{nameserver}\\n\")\n file.write(\"post-up route add default gw 192.168.1.#{options['gatewaynode']}\\n\")\n file.write(\"\\n\")\n file.close\n options['clientdir'] = options['clientdir']+\"/rootfs\"\n net_file = options['clientdir']+\"/etc/network/interfaces\"\n message = \"Information:\\tCreating network interface file \"+net_file\n command = \"cp #{tmp_file} #{net_file} ; rm #{tmp_file}\"\n execute_command(options,message,command)\n user_username = options['q_struct']['user_username'].value\n user_uid = options['q_struct']['user_uid'].value\n user_gid = options['q_struct']['user_gid'].value\n user_crypt = options['q_struct']['user_crypt'].value\n root_crypt = options['q_struct']['root_crypt'].value\n user_fullname = options['q_struct']['user_fullname'].value\n user_home = options['q_struct']['user_home'].value\n user_shell = options['q_struct']['user_shell'].value\n passwd_file = options['clientdir']+\"/etc/passwd\"\n shadow_file = options['clientdir']+\"/etc/shadow\"\n info = IO.readlines(passwd_file)\n file = File.open(tmp_file,\"w\")\n info.each do |line|\n field = line.split(\":\")\n if field[0] != \"ubuntu\" and field[0] != \"#{user_username}\"\n file.write(line)\n end\n end\n output = user_username+\":x:\"+user_uid+\":\"+user_gid+\":\"+user_fullname+\":\"+user_home+\":\"+user_shell+\"\\n\"\n file.write(output)\n file.close\n message = \"Information:\\tCreating password file\"\n command = \"cat #{tmp_file} > #{passwd_file} ; rm #{tmp_file}\"\n execute_command(options,message,command)\n print_contents_of_file(options,\"\",passwd_file)\n info = IO.readlines(shadow_file)\n file = File.open(tmp_file,\"w\")\n info.each do |line|\n field = line.split(\":\")\n if field[0] != \"ubuntu\" and field[0] != \"root\" and field[0] != \"#{user_username}\"\n file.write(line)\n end\n if field[0] == \"root\"\n field[1] = root_crypt\n copy = field.join(\":\")\n file.write(copy)\n end\n end\n output = user_username+\":\"+user_crypt+\":::99999:7:::\\n\"\n file.write(output)\n file.close\n message = \"Information:\\tCreating shadow file\"\n command = \"cat #{tmp_file} > #{shadow_file} ; rm #{tmp_file}\"\n execute_command(options,message,command)\n print_contents_of_file(options,\"\",shadow_file)\n client_home = options['clientdir']+user_home\n message = \"Information:\\tCreating SSH directory for \"+user_username\n command = \"mkdir -p #{client_home}/.ssh ; cd #{options['clientdir']}/home ; chown -R #{user_uid}:#{user_gid} #{user_username}\"\n execute_command(options,message,command)\n # Copy admin user keys\n rsa_file = user_home+\"/.ssh/id_rsa.pub\"\n dsa_file = user_home+\"/.ssh/id_dsa.pub\"\n key_file = client_home+\"/.ssh/authorized_keys\"\n if File.exist?(key_file)\n system(\"rm #{key_file}\")\n end\n [rsa_file,dsa_file].each do |pub_file|\n if File.exist?(pub_file)\n message = \"Information:\\tCopying SSH public key \"+pub_file+\" to \"+key_file\n command = \"cat #{pub_file} >> #{key_file}\"\n execute_command(options,message,command)\n end\n end\n message = \"Information:\\tCreating SSH directory for root\"\n command = \"mkdir -p #{options['clientdir']}/root/.ssh ; cd #{options['clientdir']} ; chown -R 0:0 root\"\n execute_command(options,message,command)\n # Copy root keys\n rsa_file = \"/root/.ssh/id_rsa.pub\"\n dsa_file = \"/root/.ssh/id_dsa.pub\"\n key_file = options['clientdir']+\"/root/.ssh/authorized_keys\"\n if File.exist?(key_file)\n system(\"rm #{key_file}\")\n end\n [rsa_file,dsa_file].each do |pub_file|\n if File.exist?(pub_file)\n message = \"Information:\\tCopying SSH public key \"+pub_file+\" to \"+key_file\n command = \"cat #{pub_file} >> #{key_file}\"\n execute_command(options,message,command)\n end\n end\n # Fix permissions\n message = \"Information:\\tFixing SSH permissions for \"+user_username\n command = \"cd #{options['clientdir']}/home ; chown -R #{user_uid}:#{user_gid} #{user_username}\"\n execute_command(options,message,command)\n message = \"Information:\\tFixing SSH permissions for root \"\n command = \"cd #{options['clientdir']} ; chown -R 0:0 root\"\n execute_command(options,message,command)\n # Add sudoers entry\n sudoers_file = options['clientdir']+\"/etc/sudoers.d/\"+user_username\n message = \"Information:\\tCreating sudoers file \"+sudoers_file\n command = \"echo 'administrator ALL=(ALL) NOPASSWD:ALL' > #{sudoers_file}\"\n execute_command(options,message,command)\n # Add default route\n rc_file = options['clientdir']+\"/etc/rc.local\"\n info = IO.readlines(rc_file)\n file = File.open(tmp_file,\"w\")\n info.each do |line|\n if line.match(/exit 0/)\n output = \"route add default gw #{gateway}\\n\"\n file.write(output)\n file.write(line)\n else\n file.write(line)\n end\n end\n file.close\n message = \"Information:\\tAdding default route to \"+rc_file\n command = \"cp #{tmp_file} #{rc_file} ; rm #{tmp_file}\"\n execute_command(options,message,command)\n return\nend",
"title": ""
},
{
"docid": "23958e929d1bf99ee5a3f29e7e72ca2c",
"score": "0.46395037",
"text": "def list_bridge_options(nic)\n bridge_options = nic[:conf][:bridge_conf] || {}\n ip_bridge_options = {}\n\n # options transform table from brctl to ip-route2\n brctl_to_ipbridge = {\n :setageing => :ageing_time,\n :sethello => :hello_time,\n :setmaxage => :max_age,\n :stp => :stp_state,\n :setbridgeprio => :priority,\n :setfd => :forward_delay\n }\n\n # translate bridge_options to ip_bridge_options\n bridge_options.each do |brctl_opt, brctl_val|\n next unless brctl_to_ipbridge.include? brctl_opt\n\n ip_bridge_options[brctl_to_ipbridge[brctl_opt]] = brctl_val\n end\n\n # merge, conf section `:ip_bridge_conf` has higher priority\n ip_bridge_options.merge!(nic[:conf][:ip_bridge_conf]) \\\n if nic[:conf][:ip_bridge_conf]\n\n bridge_options_str = ''\n ip_bridge_options.each do |option, value|\n case value\n when true\n value = '1'\n when false\n value = '0'\n end\n\n bridge_options_str << \"#{option} #{value} \"\n end\n\n bridge_options_str.strip\n end",
"title": ""
},
{
"docid": "d3910b2c26a74da8f516423da2dece4f",
"score": "0.46338695",
"text": "def cleanup\n # => Some tests change the config, this needs to be reloaded.\n load_config!\n @domain.destroy\n rescue Errno::ENOENT\n nil\n end",
"title": ""
},
{
"docid": "b57d972e699aec626581222148cd8267",
"score": "0.46323693",
"text": "def create_vnet_config(resource_group_name, vnet_name, vnet_subnet_name)\n raise ArgumentError, \"GatewaySubnet cannot be used as the name for --azure-vnet-subnet-name option. GatewaySubnet can only be used for virtual network gateways.\" if vnet_subnet_name == \"GatewaySubnet\"\n\n vnet_config = {}\n subnets = nil\n flag = true\n ## check whether user passed or default named virtual network exist or not ##\n vnet = get_vnet(resource_group_name, vnet_name)\n vnet_config[:virtualNetworkName] = vnet_name\n if vnet ## handle resources in the existing virtual network ##\n vnet_config[:addressPrefixes] = vnet_address_spaces(vnet)\n vnet_config[:subnets] = []\n subnets = subnets_list(resource_group_name, vnet_name)\n if subnets\n subnets.each do |subnet|\n flag = false if subnet.name == vnet_subnet_name ## given subnet already exist in the virtual network ##\n ## preserve the existing subnet resources ##\n vnet_config[:subnets].push(\n subnet(subnet.name, subnet_address_prefix(subnet))\n )\n end\n end\n else ## create config for new vnet ##\n vnet_config[:addressPrefixes] = [ \"10.0.0.0/16\" ]\n vnet_config[:subnets] = []\n vnet_config[:subnets].push(\n subnet(vnet_subnet_name, \"10.0.0.0/24\")\n )\n flag = false\n end\n\n ## given subnet does not exist, so create new one in the virtual network ##\n vnet_config = add_subnet(vnet_subnet_name, vnet_config, subnets) if flag\n\n vnet_config\n end",
"title": ""
},
{
"docid": "c76242ddfe15d735b477827a31724252",
"score": "0.46298417",
"text": "def load_bridge_info\n\n config = Hash.new\n bridge = nil\n interface = nil\n\n brctl('show').split(\"\\n\").each do |line|\n\n # skip header\n next if line.include?('bridge name')\n\n line.scan(/^(.*?)\\s+(.*?)\\s+(.*?)\\s+(.*)$/)\n\n # get bridge, keep previous entry if it is empty\n if ! $1.empty? \n # new bridge defined\n bridge = $1\n config[bridge] = Hash.new\n config[bridge]['interfaces'] = Array.new\n end\n\n # get interfaces\n if ! $4.empty?\n # interface defined\n config[bridge]['interfaces'] << $4\n end\n\n end\n\n return config\n\n end",
"title": ""
},
{
"docid": "0dcb2d2dc1936c389936e6296b8cd6ef",
"score": "0.46287066",
"text": "def unconfigure_ai_server(options)\n if options['host-os-name'].to_s.match(/SunOS/)\n service_base_name = get_service_base_name(options['service'])\n smf_install_service = \"svc:/application/pkg/server:\"+service_base_name\n smf_service_test = %x[svcs -a |grep \"#{smf_install_service}']\n if smf_service_test.match(/pkg/)\n unconfigure_ai_pkg_repo(smf_install_service)\n end\n if not options['service'].to_s.match(/i386|sparc/)\n ['i386\",\"sparc'].each do |sys_arch|\n service_test = %x[installadm list |grep #{options['service']} |grep #{sys_arch}]\n if service_test.match(/[a-z,A-Z,0-9]/)\n message = \"Information:\\tDeleting service \"+options['service']+\"_\"+sys_arch+\" and all clients under it\"\n command = \"installadm delete-service \"+options['service']+\"_\"+sys_arch+\" -r -y\"\n execute_command(options,message,command)\n end\n end\n else\n service_test=%x[installadm list |grep #{options['service']}]\n if service_test.match(/[a-z,A-Z,0-9]/)\n message = \"Information:\\tDeleting service \"+options['service']+\" and all clients under it\"\n command = \"installadm delete-service \"+options['service']+\" -r -y\"\n execute_command(options,message,command)\n end\n end\n file=\"/etc/inet/dhcpd4.conf\"\n if File.exist?(file)\n bu_file = file+\".preai\"\n message = \"Information:\\tRestoring file \"+bu_file+\" to \"+file\n command = \"cp #{bu_file} #{file}\"\n execute_command(options,message,command)\n smf_install_service = \"svc:/network/dhcp/server:ipv4\"\n refresh_smf_service(smf_install_service)\n end\n remove_apache_proxy(options)\n repo_dir = options['baserepodir']+\"/\"+service_base_name\n test_dir = repo_dir+\"/publisher\"\n if File.directory?(test_dir) and options['yes'] == true\n destroy_zfs_fs(repo_dir)\n end\n else\n remove_apache_proxy(options)\n end\n return\nend",
"title": ""
},
{
"docid": "40edb26cf7bb9e03888e2ad07e6fac08",
"score": "0.4626999",
"text": "def del_bridge_port(nic)\n return true unless /ovswitch/ =~ nic['VN_MAD']\n\n cmd = 'sudo -n ovs-vsctl --if-exists del-port '\\\n \"#{nic['BRIDGE']} #{nic['TARGET']}\"\n\n rc, _o, e = Command.execute(cmd, false)\n\n return true if rc.zero?\n\n OpenNebula.log_error \"#{__method__}: #{e}\"\n false\n end",
"title": ""
},
{
"docid": "5f2ec8486d4617764cfbfed87550d7cc",
"score": "0.46233666",
"text": "def add_dhcp_client(client_name,client_mac,client_ip,client_arch,service_name)\n if !client_mac.match(/:/)\n client_mac = client_mac[0..1]+\":\"+client_mac[2..3]+\":\"+client_mac[4..5]+\":\"+client_mac[6..7]+\":\"+client_mac[8..9]+\":\"+client_mac[10..11]\n end\n tmp_file = \"/tmp/dhcp_\"+client_name\n if !client_arch.match(/sparc/)\n tftp_pxe_file = client_mac.gsub(/:/,\"\")\n tftp_pxe_file = tftp_pxe_file.upcase\n if service_name.match(/sol/)\n suffix = \".bios\"\n else\n if service_name.match(/bsd/)\n suffix = \".pxeboot\"\n else\n suffix = \".pxelinux\"\n end\n end\n tftp_pxe_file = \"01\"+tftp_pxe_file+suffix\n else\n tftp_pxe_file = \"http://#{$default_host}:5555/cgi-bin/wanboot-cgi\"\n end\n message = \"Checking:\\fIf DHCPd configuration contains \"+client_name\n command = \"cat #{$dhcpd_file} | grep '#{client_name}'\"\n output = execute_command(message,command)\n if !output.match(/#{client_name}/)\n backup_file($dhcpd_file)\n file = File.open(tmp_file,\"w\")\n file_info=IO.readlines($dhcpd_file)\n file_info.each do |line|\n file.write(line)\n end\n file.write(\"\\n\")\n file.write(\"host #{client_name} {\\n\")\n file.write(\" fixed-address #{client_ip};\\n\")\n file.write(\" hardware ethernet #{client_mac};\\n\")\n if service_name.match(/[A-z]/)\n file.write(\" filename \\\"#{tftp_pxe_file}\\\";\\n\")\n end\n file.write(\"}\\n\")\n file.close\n message = \"Updating:\\tDHCPd file \"+$dhcpd_file\n command = \"cp #{tmp_file} #{$dhcpd_file} ; rm #{tmp_file}\"\n execute_command(message,command)\n restart_dhcpd()\n end\n check_dhcpd()\n check_tftpd()\n return\nend",
"title": ""
},
{
"docid": "6704861e43a93edfdf243e326df67e1b",
"score": "0.46211162",
"text": "def create_hostonly_network(config)\n # Create the options that are going to be used to create our\n # new network.\n options = config.dup\n options[:ip] = options[:adapter_ip]\n\n @env[:machine].provider.driver.create_host_only_network(options)\n end",
"title": ""
},
{
"docid": "11f12258dc293ba4eedc3e9da272e72f",
"score": "0.46175927",
"text": "def define_db(config)\n config.vm.box = \"centos/7\"\n config.vm.network \"private_network\", ip: \"192.168.50.3\"\n configure_proxy(config)\n invoke_ansible(config)\nend",
"title": ""
},
{
"docid": "a2ff4de6842eb4bb65e17b5d6b762c97",
"score": "0.46039325",
"text": "def delete_unused_host_only_networks\n end",
"title": ""
},
{
"docid": "b0b5676b8979c3927ee470487ba93b69",
"score": "0.46017748",
"text": "def add_nonbridged_network_to_vbox_vm(options,nic_name)\n message = \"Information:\\tAdding network \"+nic_name+\" to \"+options['name']\n if nic_name.match(/vboxnet/)\n command = \"#{options['vboxmanage']} modifyvm #{options['name']} --hostonlyadapter1 #{nic_name} ; #{options['vboxmanage']} modifyvm #{options['name']} --nic1 hostonly\"\n else\n command = \"#{options['vboxmanage']} modifyvm #{options['name']} --nic1 #{nic_name}\"\n end\n execute_command(options,message,command)\n return\nend",
"title": ""
},
{
"docid": "cbf07306b2eecce789cf972f18c4deec",
"score": "0.45972008",
"text": "def create_missing_deployment_configs\n @config_maps_by_uid.each_value do |map|\n next if map.deployment_config.present?\n\n begin\n map.create_deployment_config\n rescue TopologicalInventory::Orchestrator::ObjectManager::QuotaError\n logger.info(\"Skipping Deployment Config creation for config map #{map} because it would exceed quota.\")\n metrics&.record_error(:quota_error)\n end\n end\n end",
"title": ""
},
{
"docid": "839ccbff2216e053b478282a9868c2b6",
"score": "0.45965594",
"text": "def get_interfaces\n bridges = Hash.new\n brctl_exit =`#{CONF[:brctl]} show`\n cur_bridge = \"\"\n\n brctl_exit.split(\"\\n\")[1..-1].each do |l| \n l = l.split\n\n if l.length > 1\n cur_bridge = l[0]\n\n bridges[cur_bridge] = Array.new\n bridges[cur_bridge] << l[3]\n else\n bridges[cur_bridge] << l[0]\n end\n end\n\n bridges\nend",
"title": ""
},
{
"docid": "5d3d108db171445197e5902bd768fa9f",
"score": "0.4588276",
"text": "def dns_clean(agent)\n # remove any existing resources that we will be testing against\n resource_titles(agent, :domain_name, :clean)\n\n if operating_system == 'ios_xr'\n clean_commands = ['no domain list test.com',\n 'no domain list test.net',\n 'no domain name switch1.test.com',\n 'no domain name switch2.test.com',\n 'no domain name-server 2001:4860:4860::8888',\n 'no domain name-server 8.8.8.8']\n\n clean_commands.each do |cmd|\n command_config(agent, cmd, cmd)\n end\n else\n # These resources currently do not support ensure=absent; they can use\n # resource_titles above if they're ever updated.\n on(agent, get_vshell_cmd('show run | i domain-list|name-server'))\n stdout.scan(/ip domain-list \\S+|ip name-server .*/).each do |cli|\n command_config(agent, \"no #{cli}\", \"removing #{cli}\")\n end\n end\nend",
"title": ""
},
{
"docid": "8f8c500108708d361bfedcb6dcec0b1b",
"score": "0.45876333",
"text": "def configure_network_interface\n\t# if !@current_resource.dhcp_disabled\n\t\tpowershell_script \"Disable DHCP\" do\n\t\t\tcode <<-EOH\n\t\t\t\tImport-Module NetAdapter\n\t\t\t\t$ipconfig = Get-NetIPAddress | ?{$_.IpAddress -eq $netip.IPv4Address.IpAddress}\n\t\t\t\tif ( $ipconfig.PrefixOrigin -eq \"Dhcp\" )\n\t\t\t\t{\n\t\t\t\t\tGet-NetAdapter | Set-NetIPInterface -DHCP Disabled\n\t\t\t\t}\n\t\t\tEOH\n\t\tend\n\t\tif new_resource.existing_dc_ips.size > 0\n\t\t\tpowershell_script \"Set DNS to #{new_resource.existing_dc_ips.join(\",\")}\" do\n\t\t\t\tcode <<-EOH\n\t\t\t\t\tImport-Module NetTCPIP\n\t\t\t\t\t$netip = Get-NetIPConfiguration\n\t\t\t\t\tif ( $netip.DNSServer.ServerAddresses -ne \"\" )\n\t\t\t\t\t{\t\n\t\t\t\t\t\tGet-NetAdapter | Set-DnsClientServerAddress -PassThru -ServerAddresses #{new_resource.existing_dc_ips.join(\",\")}\n\t\t\t\t\t}\n\t\t\t\tEOH\n\t\t\tend\n\t\tend\n\t# end\n\t# @current_resource.dhcp_disabled = true\nend",
"title": ""
},
{
"docid": "ed70d443d788de8de5138647f5c02c28",
"score": "0.45832777",
"text": "def unconfigure_ai_server(service_name)\n if $os_name.match(/SunOS/)\n service_base_name = get_service_base_name(service_name)\n smf_service_name = \"svc:/application/pkg/server:\"+service_base_name\n smf_service_test = %x[svcs -a |grep \"#{smf_service_name}\"]\n if smf_service_test.match(/pkg/)\n unconfigure_ai_pkg_repo(smf_service_name)\n end\n if !service_name.match(/i386|sparc/)\n [\"i386\",\"sparc\"].each do |sys_arch|\n service_test=%x[installadm list |grep #{service_name} |grep #{sys_arch}]\n if service_test.match(/[A-z|0-9]/)\n message = \"Deleting:\\tService \"+service_name+\"_\"+sys_arch+\" and all clients under it\"\n command = \"installadm delete-service \"+service_name+\"_\"+sys_arch+\" -r -y\"\n execute_command(message,command)\n end\n end\n else\n service_test=%x[installadm list |grep #{service_name}]\n if service_test.match(/[A-z|0-9]/)\n message = \"Deleting:\\tService \"+service_name+\" and all clients under it\"\n command = \"installadm delete-service \"+service_name+\" -r -y\"\n execute_command(message,command)\n end\n end\n file=\"/etc/inet/dhcpd4.conf\"\n if File.exist?(file)\n backup_file = file+\".preai\"\n message = \"Restoring:\\tFile \"+backup_file+\" to \"+file\n command = \"cp #{backup_file} #{file}\"\n execute_command(message,command)\n smf_service_name = \"svc:/network/dhcp/server:ipv4\"\n refresh_smf_service(smf_service_name)\n end\n remove_apache_proxy(service_name)\n repo_version_dir = $repo_base_dir+\"/\"+service_base_name\n test_dir = repo_version_dir+\"/publisher\"\n if File.directory?(test_dir)\n destroy_zfs_fs(repo_version_dir)\n end\n else\n remove_apache_proxy(service_name)\n end\n return\nend",
"title": ""
},
{
"docid": "dd0a9fc089eaf09e731b60747e55f9f7",
"score": "0.45812887",
"text": "def remove_host(hostname, displayname, collector, description, groups, properties, alertenable)\n puts \"d LogicMonitor host \\\"#{hostname}\\\"\"\n groups.each do |group|\n if get_group(group).nil?\n puts \"Couldn't find parent group #{group}. Creating.\"\n recursive_group_create( group, nil, nil, true)\n end\n end\n add_resp = rpc(\"addHost\", build_host_hash(hostname, displayname, collector, description, groups, properties, alertenable))\n if @debug\n puts add_resp\n end\nend",
"title": ""
},
{
"docid": "c90490f9d2ea2a6234f8dca3cb64e65c",
"score": "0.45793852",
"text": "def new_subnet_address_prefix(vnet_address_prefix, subnets)\n if subnets.empty? ## no subnets exist in the given address space of the virtual network, so divide the network into smaller subnets (based on the network size) and allocate space for the new subnet to be added ##\n divide_network(vnet_address_prefix)\n else ## subnets exist in vnet, calculate new address_prefix for the new subnet based on the space taken by these existing subnets under the given address space of the virtual network ##\n vnet_network_address = IPAddress(vnet_address_prefix)\n subnets = sort_subnets_by_cidr_prefix(subnets)\n available_networks_pool = []\n used_networks_pool = []\n subnets.each do |subnet|\n ## in case the larger network is not divided into smaller subnets but\n ## divided into only 1 largest subnet of the complete network size ##\n if vnet_network_address.prefix == subnet_cidr_prefix(subnet)\n break\n end\n\n ## add all the possible subnets (calculated using the current subnet's\n ## cidr prefix value) into the available_networks_pool ##\n available_networks_pool.push(\n vnet_network_address.subnet(subnet_cidr_prefix(subnet))\n ).flatten!.uniq! { |nwrk| [ nwrk.network.address, nwrk.prefix ].join(\":\") }\n\n ## add current subnet into the used_networks_pool ##\n used_networks_pool.push(\n IPAddress(subnet_address_prefix(subnet))\n )\n\n ## sort both the network pools before trimming the available_networks_pool ##\n available_networks_pool, used_networks_pool = sort_pools(\n available_networks_pool, used_networks_pool\n )\n\n ## trim the available_networks_pool based on the networks already\n ## allocated to the existing subnets ##\n used_networks_pool.each do |subnet_network|\n available_networks_pool.delete_if do |available_network|\n in_use_network?(subnet_network, available_network)\n end\n end\n\n ## sort both the network pools after trimming the available_networks_pool ##\n available_networks_pool, used_networks_pool = sort_pools(\n available_networks_pool, used_networks_pool\n )\n end\n\n ## space available in the vnet_address_prefix network for the new subnet ##\n if !available_networks_pool.empty? && available_networks_pool.first.network?\n available_networks_pool.first.network.address.concat(\"/\" + available_networks_pool.first.prefix.to_s)\n else ## space not available in the vnet_address_prefix network for the new subnet ##\n nil\n end\n end\n end",
"title": ""
},
{
"docid": "b8c5e4bbfa1ef8c1e91d6f2450bed7a7",
"score": "0.45774573",
"text": "def pvlan_assoc_cleanup(agent, intf)\n logger.info(\"\\n#{'-' * 60}\\nPrivate-vlan cleanup\")\n resource_set(agent, ['cisco_interface', intf, 'switchport_mode', 'disabled'])\nend",
"title": ""
},
{
"docid": "56c261a95ec9541105d2f667d55934f9",
"score": "0.45762452",
"text": "def parse_bpduguard(config)\n val = /spanning-tree bpduguard enable/ =~ config\n { bpduguard: !val.nil? }\n end",
"title": ""
},
{
"docid": "d0b3ee6c11fc416adb7663b31ea285d1",
"score": "0.4572059",
"text": "def delete_disabled_adapters\n end",
"title": ""
},
{
"docid": "0b65192ddd5dcd6aa59896c364c1be13",
"score": "0.4571318",
"text": "def build_config(host, iface, node)\n # binding.pry\n\n #ip -6 tunnel add gt6naspr01 mode ip6gre local 2a04:2f80:f:f003::2 remote 2a04:2f80:f:f003::1\n #ip link set mtu 1500 dev gt6naspr01 up\n #ip addr add 2a04:2f80:f:f003::2/64 dev gt6naspr01\n\n #ip -4 tunnel add gt4naspr01 mode gre local 169.254.193.2 remote 169.254.193.1\n #ip link set mtu 1500 dev gt4naspr01 up\n #ip addr add 169.254.193.2/30 dev gt4naspr01\n # binding.pry if host.name == \"scable-1\"\n\n # cfg = iface.delegate.tunnel\n\n # iname = Util.clean_if(cfg.gt, gre_delegate.name)\n # local_ifaces[local_iface.name] ||= OpenStruct.new(:iface => local_iface, :inames => [])\n # local_ifaces[local_iface.name].inames << iname\n # binding.pry if iface.host.name == \"fanout-de\"\n\n # writer = host.result.etc_network_interfaces.get(iface)\n #writer.skip_interfaces.header.interface_name(iname)\n local = endpoint.endpoint_address.get_address.first_by_family(endpoint.tunnel.transport_family).to_s\n remote = endpoint.remote.endpoint_address.get_service_address.first_by_family(endpoint.tunnel.transport_family).to_s\n # binding.pry\n throw \"there must be a local or remote address\" if local.nil? or remote.nil?\n up_downer = host.result_types.find_instances_from_type(Construqt::Flavour::Nixian::Services::UpDowner::OncePerHost)\n up_downer.add(iface, Tastes::Entities::Gre.new(cfg, local, remote))\n\n # binding.pry\n Device.build_config(host, iface, node)\n\n # local_ifaces.values.each do |val|\n # if val.iface.clazz == \"vrrp\"\n # vrrp = host.result.etc_network_vrrp(val.iface.name)\n # val.inames.each do |iname|\n # vrrp.add_master(\"/bin/bash /etc/network/#{iname}-up.iface\")\n # end\n #\n # val.inames.each do |iname|\n # vrrp.add_backup(\"/bin/bash /etc/network/#{iname}-down.iface\")\n # end\n # else\n # writer_local = host.result.etc_network_interfaces.get(val.iface)\n # val.inames.each do |iname|\n # writer_local.lines.up(\"/bin/bash /etc/network/#{iname}-up.iface\")\n # writer_local.lines.down(\"/bin/bash /etc/network/#{iname}-down.iface\")\n # end\n # end\n # end\n end",
"title": ""
},
{
"docid": "7ebe208db38710cd682370b49b57d0fe",
"score": "0.45693022",
"text": "def create_config\n hash = super\n hash[:DoNotListen] = true\n hash\n end",
"title": ""
},
{
"docid": "a903a41475c324d79fe05ef4551e8341",
"score": "0.45661825",
"text": "def deploy_config\n return false unless send_config\n if reload_bacula\n if host.bacula_ready?\n host.set_deployed\n else\n host.set_inactive\n end\n else\n host.dispatch || host.redispatch\n end\n end",
"title": ""
},
{
"docid": "c4a764ab90b2be231699122a3e30adf7",
"score": "0.45647526",
"text": "def deploy_config\n send_config && reload_bacula\n end",
"title": ""
},
{
"docid": "1b7499d7c4a89c7d877957957bc79a22",
"score": "0.45550722",
"text": "def volumes_delete\n debug 'Call: volumes_delete'\n domains.each do |domain|\n volumes = domain.fetch 'volumes', {}\n volumes.each do |volume|\n volume_name = volume.fetch 'name'\n next unless volume_name\n unless volume_defined? volume_name, options[:pool]\n info \"Volume: #{volume_name} of the pool: #{options[:pool]} is not defined! Skipping!\"\n next\n end\n volume_delete volume_name, options[:pool]\n end\n end\n end",
"title": ""
},
{
"docid": "fe77d54148caaf1daae076990e3859ba",
"score": "0.4554776",
"text": "def configureNetworkCard(nic_info, source_file)\n \n # add interfaces entry\n template \"/etc/network/interfaces.d/ifcfg-#{nic_info['nic_name']}\" do\n source source_file\n variables(\n nic_name: nic_info['nic_name'],\n nic_ip: nic_info['nic_ip'],\n nic_subnet: nic_info['nic_subnet'],\n nic_gateway: nic_info['nic_gateway'],\n nic_dns: nic_info['nic_dns']\n )\n end\n \n # down the NIC\n execute \"down #{nic_info['nic_name']}\" do\n command \"ifdown #{nic_info['nic_name']}\"\n #only_if \"ifconfig | grep '#{nic_info['nic_name']}'\"\n end\n \n # up the NIC \n execute \"up #{nic_info['nic_name']}\" do\n command \"ifup #{nic_info['nic_name']}\"\n #not_if \"ifconfig | grep '#{nic_info['nic_name']}'\"\n end\n \n ## if enable network\n #ifconfig nic_ip do\n # action :enable\n # device nic_name\n #end\n \nend",
"title": ""
},
{
"docid": "dc0dca14dc57ebe788fa1b9a495c7c20",
"score": "0.4553656",
"text": "def createDBParameterGroup\n MU.log \"Creating a database parameter group #{@config[\"parameter_group_name\"]}\"\n MU::Cloud::AWS.rds(region: @config['region'], credentials: @config['credentials']).create_db_parameter_group(\n db_parameter_group_name: @config[\"parameter_group_name\"],\n db_parameter_group_family: @config[\"parameter_group_family\"],\n description: \"Parameter group for #{@config[\"parameter_group_family\"]}\",\n tags: allTags\n )\n\n if @config[\"db_parameter_group_parameters\"] && !@config[\"db_parameter_group_parameters\"].empty?\n params = []\n @config[\"db_parameter_group_parameters\"].each { |item|\n params << {parameter_name: item['name'], parameter_value: item['value'], apply_method: item['apply_method']}\n }\n\n MU.log \"Modifiying database parameter group #{@config[\"parameter_group_name\"]}\"\n MU::Cloud::AWS.rds(region: @config['region'], credentials: @config['credentials']).modify_db_parameter_group(\n db_parameter_group_name: @config[\"parameter_group_name\"],\n parameters: params\n )\n end\n end",
"title": ""
},
{
"docid": "300e710532fd12905e963115abd26eb8",
"score": "0.45517123",
"text": "def create_config_dir\n directory 'config'\n\n if options[:skip_capistrano]\n remove_file 'config/deploy/'\n remove_file 'config/deploy.rb'\n end\n remove_file 'config/initializers/sequel.rb' if mongodb?\n end",
"title": ""
},
{
"docid": "45e323abeeffc4fdda7713b96d3153e1",
"score": "0.454699",
"text": "def create_configuration_files\n #CatalogController\n copy_file \"catalog_controller.rb\", \"app/controllers/catalog_controller.rb\"\n\n # Initializers\n file_path = \"config/initializers/hydra_config.rb\"\n copy_file \"config/initializers/hydra_config.rb\", file_path\n insert_into_file file_path, :after => '# specify the user model' do \n \"\\n config[:user_model] = '#{model_name.classify}'\" \n end\n \n\n copy_file \"config/initializers/action_dispatch_http_upload_monkey_patch.rb\", \"config/initializers/action_dispatch_http_upload_monkey_patch.rb\"\n\n # Role Mappings\n copy_file \"config/role_map_cucumber.yml\", \"config/role_map_cucumber.yml\"\n copy_file \"config/role_map_development.yml\", \"config/role_map_development.yml\"\n copy_file \"config/role_map_production.yml\", \"config/role_map_production.yml\"\n copy_file \"config/role_map_test.yml\", \"config/role_map_test.yml\"\n \n # Fedora & Solr YAML files\n begin\n invoke('active_fedora:config')\n rescue NoMethodError\n # Looks like we are falling back on the old way of doing this\n copy_file \"config/fedora.yml\", \"config/fedora.yml\"\n copy_file \"config/solr.yml\", \"config/solr.yml\"\n copy_file \"config/jetty.yml\", \"config/jetty.yml\"\n # Fedora & Solr Config files\n directory \"fedora_conf\"\n directory \"solr_conf\"\n end\n end",
"title": ""
},
{
"docid": "7cd0dbb05f737177507020163f0157d1",
"score": "0.45431438",
"text": "def configure debug = false\n config = self.get_config\n puts 'What is the ip address of your wifi link? (' + self.get_config['host'] + '). Enter a blank line to broadcast UDP commands.'\n host = STDIN.gets.chomp\n if ! host.to_s.empty?\n config['host'] = host\n end\n puts 'What is the address of your google calendar? (' + self.get_config['calendar'] + '). Optional!'\n calendar = STDIN.gets.chomp\n if ! calendar.to_s.empty?\n config['calendar'] = calendar\n end\n device = 'x'\n while ! device.to_s.empty?\n puts 'Enter the name of a room and its devices, space separated. For example \"lounge light socket tv\". Enter a blank line to finish.'\n if device = STDIN.gets.chomp\n parts = device.split ' '\n if !parts[0].to_s.empty? and !parts[1].to_s.empty?\n new_room = parts.shift\n if ! config['room']\n config['room'] = [ ]\n end\n found = false\n config['room'].each do | room |\n if room['name'] == new_room\n room['device'] = parts\n found = true\n end\n debug and ( p 'so now room is ' + room.to_s )\n end\n if ! found\n config['room'].push 'name' => new_room, 'device' => parts, 'mood' => nil\n end\n debug and ( p 'added ' + parts.to_s + ' to ' + new_room )\n end\n end\n end\n debug and ( p 'end of configure, config is now ' + config.to_s )\n self.put_config config\n end",
"title": ""
},
{
"docid": "dd424d7c22513b595f3236a53cca7aad",
"score": "0.45407784",
"text": "def base_net_config\n base_config = {\n use_dhcp_assigned_default_route: true\n }\n if (ENV.keys & [\"VAGRANT_KVM_BRIDGE\", \"VAGRANT_VBOX_BRIDGE\"]).empty?\n if ENV.include? \"VAGRANT_DHCP\"\n # Use dhcp if VAGRANT_DHCP is set. This only applies to NAT networking, as\n # bridged networking uses type: bridged (even though the virtual interface still\n # gets its IP from dhcp). If not using dhcp, the VM will use the 192.168.77.77 IP\n base_config[:type] = \"dhcp\"\n else\n base_config[:ip] = \"192.168.77.77\"\n end\n end\n base_config\nend",
"title": ""
},
{
"docid": "fd963a8321dd7376a0ff93bf5eb09058",
"score": "0.45340955",
"text": "def __setup_DRb_services\n DRb.install_acl( ACL.new( %w{deny all allow localhost allow 127.0.0.1}) )\n \n $provider = DRbObject.new(nil, \"druby://127.0.0.1:#{$service[:port_in]}\")\n $provider.for(\"#{$service[:domain]}\".to_sym, \"#{$service[:name]}\".to_sym).status = \"Booting..\" \n \n @serv = DRb.start_service \"druby://127.0.0.1:#{$service[:port_out]}\", ($service_manager=ServiceManager.new)\nend",
"title": ""
},
{
"docid": "74fe83072b2e3ba938eb8101da8735ce",
"score": "0.45319435",
"text": "def configure_networks(server_id, network_spec)\n not_implemented(:configure_networks)\n end",
"title": ""
},
{
"docid": "612dd411b13efd6f3a9e517617f396dd",
"score": "0.45316574",
"text": "def create_ad_domain\n\n\tif node_is_dc? == false\n\t\trequire 'chef/win32/version'\n\t\tversion = Chef::ReservedNames::Win32::Version.new\n\t\t\n\t\tif version.windows_server_2012?\n\t\t\tcode =<<-EOH\n\t\t\t\t$DCPromoFile = @\"\n\t\t\t\t[DCINSTALL]\n\t\t\t\tInstallDNS=yes\n\t\t\t\tNewDomain=forest\n\t\t\t\tNewDomainDNSName=#{new_resource.dns_name}\n\t\t\t\tDomainNetBiosName=#{new_resource.netbios_name}\n\t\t\t\tSiteName=#{new_resource.site_name}\n\t\t\t\tReplicaorNewDomain=domain\n\t\t\t\tForestLevel=5\n\t\t\t\tDomainLevel=5\n\t\t\t\tConfirmGC=Yes\n\t\t\t\tSafeModeAdminPassword=\"#{new_resource.safe_mode_pw}\"\n\t\t\t\tRebootonCompletion=Yes\n\t\t\t\t\"@\n\t\t\t\t$DCPromoFile | out-file c:\\dcpromoanswerfile.txt -Force\n\t\t\t\tdcpromo.exe /unattend:c:\\dcpromoanswerfile.txt\n\t\t\tEOH\n\t\t\tcmd = powershell_out(code)\n\t\t\treturn true\n\t\telsif version.windows_server_2012_r2?\n\t\t\tcmd = powershell_out(\"echo $env:PSModulePath ; Import-Module ADDSDeployment ; Install-ADDSForest -DomainName #{new_resource.dns_name} -SafeModeAdministratorPassword (convertto-securestring '#{new_resource.safe_mode_pw}' -asplaintext -force) -DomainMode Win2012R2 -DomainNetbiosName #{new_resource.netbios_name} -ForestMode Win2012R2 -Confirm:$false -Force\")\n\t\t\tcmd.run_command\n\t\t\tif cmd.exitstatus != 0\n\t\t\t\tlog \"Install-ADDSForest stdout: \"+cmd.stdout\n\t\t\t\tlog \"Install-ADDSForest stderr: \"+cmd.stderr\n\t\t\t\tChef::Application.fatal!(\"FAILED: Import-Module ADDSDeployment ; Install-ADDSForest -DomainName #{new_resource.dns_name} -SafeModeAdministratorPassword (convertto-securestring '#{new_resource.safe_mode_pw}' -asplaintext -force) -DomainMode Win2012R2 -DomainNetbiosName #{new_resource.netbios_name} -ForestMode Win2012R2 -Confirm:$false -Force\\n#{cmd.stderr}\\n#{cmd.stdout}\")\n\t\t\tend\n\t\t\tpowershell_script \"Set-Service NTDS -StartupType Automatic\"\n\t\t\tpowershell_script \"Set-Service ADWS -StartupType Automatic\"\n#\t\t\tnode.normal.deployment.servers['ad'][Chef::Config[:node_name]]['activedirectory_domain_created'] = true\n#\t\t\tnode.save\n\t\t\t\n\t\t\tChef::Application.fatal!(\"Just created AD domain, now rebooting. Will need to invoke Chef again.\")\n\t\tend\n\t\treturn true\n\tend\nend",
"title": ""
},
{
"docid": "1bfe1f5063aba34ab856b38b844f62e2",
"score": "0.45298597",
"text": "def configure_network_adaptor(device, ip, netmask, gateway, nameservers)\n raise \"ERROR: 'nameserver' parameter must be an array\" unless nameservers.is_a?(Array)\n raise \"ERROR: invalid IP address: '#{nameserver}'\" unless valid_ipv4?(ip)\n raise \"ERROR: invalid netmask: '#{netmask}'\" unless valid_ipv4?(netmask)\n nameservers.each do |nameserver|\n raise \"ERROR: invalid nameserver: '#{nameserver}'\" unless valid_ipv4?(nameserver)\n end\n\n # gateway is optional\n if gateway\n raise \"ERROR: invalid gateway IP address: '#{gateway}'\" unless valid_ipv4?(gateway)\n end\n end",
"title": ""
}
] |
be05d0e0c1c5c671cb1edba98c7d529d
|
Lines that start with a Colon are Comments and will be ignored
|
[
{
"docid": "90f647a5b99e775003066192a555dd41",
"score": "0.0",
"text": "def send_ping\n @connections.each do |socket|\n begin\n socket << \":\\n\"\n rescue Reel::SocketError\n @connections.delete(socket)\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "a6a9d647781630cb7091bd9be551a72e",
"score": "0.7017745",
"text": "def lex_comment line\n # do nothing\n end",
"title": ""
},
{
"docid": "6b4c1a45f8a72b6d15b5dfb20c3ec50f",
"score": "0.6943724",
"text": "def verify_comment(line) \n end",
"title": ""
},
{
"docid": "b09ca0a1e3b4c0fa2ab7c3f0efafb51e",
"score": "0.68863285",
"text": "def is_comment?(line)\n line =~ /^\\s*#/\n end",
"title": ""
},
{
"docid": "a5d883b47d93e43abc1afb562f9cb311",
"score": "0.68169147",
"text": "def has_comment?(line)\n line =~ /#[^{]/\n end",
"title": ""
},
{
"docid": "8deab95b84fef25aa61bdecbfd2b7c51",
"score": "0.6671601",
"text": "def comment_line?(line_source)\n /^\\s*#/.match?(line_source)\n end",
"title": ""
},
{
"docid": "65308505709342c6ad931be0a0795342",
"score": "0.6642567",
"text": "def è_un_commento?\n @contenuto.start_with? \"#\"\n end",
"title": ""
},
{
"docid": "a25c861e5ac7f6c82f8ed849d9479338",
"score": "0.66328126",
"text": "def line_comments_option; end",
"title": ""
},
{
"docid": "db03b8bc7b9dcf03cc672666e2192ff0",
"score": "0.66127586",
"text": "def is_comment?(line)\n true if line =~ /^\\#.*$/\n end",
"title": ""
},
{
"docid": "ae75c1e996abf086f7de0688b00e3af8",
"score": "0.652141",
"text": "def lex_en_line_comment; end",
"title": ""
},
{
"docid": "ae75c1e996abf086f7de0688b00e3af8",
"score": "0.652141",
"text": "def lex_en_line_comment; end",
"title": ""
},
{
"docid": "ae75c1e996abf086f7de0688b00e3af8",
"score": "0.652141",
"text": "def lex_en_line_comment; end",
"title": ""
},
{
"docid": "752171205636b59ee9180308c48e5651",
"score": "0.6520557",
"text": "def comment_line?(line_source); end",
"title": ""
},
{
"docid": "752171205636b59ee9180308c48e5651",
"score": "0.6520557",
"text": "def comment_line?(line_source); end",
"title": ""
},
{
"docid": "1a9f838ab4a2708924d52486aded167d",
"score": "0.65028965",
"text": "def strip_comments\n in_str = false\n @src_lines.each do |line|\n pos = line.each_char.with_index do |ch,i|\n if ch == '\"'\n if in_str\n in_str = false\n else\n in_str = true\n end\n end\n \n if ch == \";\" && !in_str\n break i\n end\n \n end\n \n if pos.class == Fixnum\n #strip them to the end of the file\n line.slice!(pos..-1)\n end\n \n end\n end",
"title": ""
},
{
"docid": "75c451d36cf6c881be8843c51abe8c17",
"score": "0.6478698",
"text": "def line_comment!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 78 )\n\n\n\n type = LINE_COMMENT\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 608:8: '#' (~ ( '\\\\n' | '\\\\r' ) )* ( '\\\\r' )? '\\\\n'\n match( 0x23 )\n # at line 608:12: (~ ( '\\\\n' | '\\\\r' ) )*\n while true # decision 25\n alt_25 = 2\n look_25_0 = @input.peek( 1 )\n\n if ( look_25_0.between?( 0x0, 0x9 ) || look_25_0.between?( 0xb, 0xc ) || look_25_0.between?( 0xe, 0xffff ) )\n alt_25 = 1\n\n end\n case alt_25\n when 1\n # at line \n if @input.peek( 1 ).between?( 0x0, 0x9 ) || @input.peek( 1 ).between?( 0xb, 0xc ) || @input.peek( 1 ).between?( 0xe, 0xffff )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n\n else\n break # out of loop for decision 25\n end\n end # loop for decision 25\n\n # at line 608:26: ( '\\\\r' )?\n alt_26 = 2\n look_26_0 = @input.peek( 1 )\n\n if ( look_26_0 == 0xd )\n alt_26 = 1\n end\n case alt_26\n when 1\n # at line 608:26: '\\\\r'\n match( 0xd )\n\n end\n match( 0xa )\n\n # --> action\n channel=HIDDEN;\n # <-- action\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 78 )\n\n\n end",
"title": ""
},
{
"docid": "d0c66025d6d1fc4763ae742149ceca6e",
"score": "0.6474406",
"text": "def detect_comments\n if @input =~ %r{^\\s*[/]{2}}\n @mode = :comment\n @expression = ''\n end\n end",
"title": ""
},
{
"docid": "8e6b53d6799d791cf75e25f22f35c679",
"score": "0.64544964",
"text": "def pbCompilerEachCommentedLine(filename)\r\n File.open(filename,\"rb\") { |f|\r\n FileLineData.file = filename\r\n lineno = 1\r\n f.each_line { |line|\r\n if lineno==1 && line[0].ord==0xEF && line[1].ord==0xBB && line[2].ord==0xBF\r\n line = line[3,line.length-3]\r\n end\r\n line.force_encoding(Encoding::UTF_8)\r\n if !line[/^\\#/] && !line[/^\\s*$/]\r\n FileLineData.setLine(line,lineno)\r\n yield line, lineno\r\n end\r\n lineno += 1\r\n }\r\n }\r\n end",
"title": ""
},
{
"docid": "e65580ca7d1f40ce1ae06c51d9249c22",
"score": "0.6439836",
"text": "def consume_comments; end",
"title": ""
},
{
"docid": "66c9174a32a9be9d926843c023626ead",
"score": "0.63796836",
"text": "def comment!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 13 )\n\n type = COMMENT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 63:5: '#' (~ ( '\\\\r' | '\\\\n' ) )*\n match( 0x23 )\n # at line 63:9: (~ ( '\\\\r' | '\\\\n' ) )*\n while true # decision 22\n alt_22 = 2\n look_22_0 = @input.peek( 1 )\n\n if ( look_22_0.between?( 0x0, 0x9 ) || look_22_0.between?( 0xb, 0xc ) || look_22_0.between?( 0xe, 0xffff ) )\n alt_22 = 1\n\n end\n case alt_22\n when 1\n # at line 63:11: ~ ( '\\\\r' | '\\\\n' )\n if @input.peek( 1 ).between?( 0x0, 0x9 ) || @input.peek( 1 ).between?( 0xb, 0xc ) || @input.peek( 1 ).between?( 0xe, 0xff )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n break # out of loop for decision 22\n end\n end # loop for decision 22\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__, 13 )\n\n end",
"title": ""
},
{
"docid": "ae88cad1f3c4ed44322e082c5463136b",
"score": "0.63771343",
"text": "def mark_commented_lines\n [].tap do |reg|\n in_block_comment = false\n line_no = 0\n start_block = 0\n end_block = 0\n @source.each_line do |line|\n line_no = line_no+1\n\n start_block = line_no if !in_block_comment and line =~ @start_block_comment_regex\n end_block = line_no if start_block < line_no and line =~ @end_block_comment_regex\n end_block = line_no if line =~ @oneline_block_comment_regex\n\n in_block_comment = end_block < start_block\n\n reg << line_no if in_block_comment or end_block == line_no or line =~ @comment_regex\n end\n end\n end",
"title": ""
},
{
"docid": "2eb50742123b027638a19c120c068a4e",
"score": "0.6337199",
"text": "def clean_comments(file)\n @in_file = file.readlines\n @in_file.delete_if{|index| index.match(/^[\\/]{2}/) }\n end",
"title": ""
},
{
"docid": "ada5e59d8f3acf0894453da7bf9c194a",
"score": "0.6319888",
"text": "def is_continuing_line?(line)\n line.expunge =~ /^[^#]*\\\\\\s*(#.*)?$/\n #first use expunge to eliminate inline closures\n #that may contain comment char '#'\n end",
"title": ""
},
{
"docid": "4c8d11754a612d82c342025a29d4ae1a",
"score": "0.62952685",
"text": "def check_comments(input, markers)\n lines = input.split(\"\\n\")\n output = ''\n lines.each do |line|\n line_end = line.length\n line.chars.each_with_index do |char, index|\n line_end = index if markers.include?(char)\n end\n new_line = line[0...line_end].rstrip\n output += new_line + (line == lines.last ? '' : \"\\n\")\n end\n output\nend",
"title": ""
},
{
"docid": "68e5066b0a9c9344348c2eb219feafff",
"score": "0.62581944",
"text": "def process_initial_comment(tk)\n if @statement.empty? && (@comments_last_line || 0) < tk.line_no - 2\n @comments = nil\n end\n\n return unless tk.class == TkCOMMENT\n\n case tk.text\n when Parser::SourceParser::SHEBANG_LINE\n if !@last_ns_tk && !@encoding_line\n @shebang_line = tk.text\n return\n end\n when Parser::SourceParser::ENCODING_LINE\n if (@last_ns_tk.class == TkCOMMENT && @last_ns_tk.text == @shebang_line) ||\n !@last_ns_tk\n @encoding_line = tk.text\n return\n end\n end\n\n return if [email protected]? && @comments\n return if @first_line && tk.line_no > @first_line\n\n if @comments_last_line && @comments_last_line < tk.line_no - 1\n if @comments && @statement.empty?\n @tokens.unshift(tk)\n return @done = true\n end\n @comments = nil\n end\n @comments_line = tk.line_no unless @comments\n\n # Remove the \"#\" and up to 1 space before the text\n # Since, of course, the convention is to have \"# text\"\n # and not \"#text\", which I deem ugly (you heard it here first)\n @comments ||= []\n if tk.text.start_with?('=begin')\n lines = tk.text.count(\"\\n\")\n @comments += tk.text.gsub(/\\A=begin.*\\r?\\n|\\r?\\n=end.*\\r?\\n?\\Z/, '').split(/\\r?\\n/)\n @comments_last_line = tk.line_no + lines\n else\n @comments << tk.text.gsub(/^(#+)\\s{0,1}/, '')\n @comments_hash_flag = $1 == '##' if @comments_hash_flag.nil?\n @comments_last_line = tk.line_no\n end\n @comments.pop if @comments.size == 1 && @comments.first =~ /^\\s*$/\n true\n end",
"title": ""
},
{
"docid": "a9ce50d89236b871ac145f8f383df20f",
"score": "0.6226284",
"text": "def comment!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 35 )\n\n type = COMMENT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 350:9: '#' (~ ( '\\\\n' | '\\\\r' ) )*\n match( 0x23 )\n # at line 350:13: (~ ( '\\\\n' | '\\\\r' ) )*\n while true # decision 13\n alt_13 = 2\n look_13_0 = @input.peek( 1 )\n\n if ( look_13_0.between?( 0x0, 0x9 ) || look_13_0.between?( 0xb, 0xc ) || look_13_0.between?( 0xe, 0xffff ) )\n alt_13 = 1\n\n end\n case alt_13\n when 1\n # at line 350:13: ~ ( '\\\\n' | '\\\\r' )\n if @input.peek( 1 ).between?( 0x0, 0x9 ) || @input.peek( 1 ).between?( 0xb, 0xc ) || @input.peek( 1 ).between?( 0xe, 0xff )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n break # out of loop for decision 13\n end\n end # loop for decision 13\n # --> action\n channel=HIDDEN;\n # <-- action\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 35 )\n\n end",
"title": ""
},
{
"docid": "e5df234ccd08e8d8b1417ce5542379f7",
"score": "0.6220605",
"text": "def lex_en_line_comment=(_arg0); end",
"title": ""
},
{
"docid": "e5df234ccd08e8d8b1417ce5542379f7",
"score": "0.6220605",
"text": "def lex_en_line_comment=(_arg0); end",
"title": ""
},
{
"docid": "e5df234ccd08e8d8b1417ce5542379f7",
"score": "0.6220605",
"text": "def lex_en_line_comment=(_arg0); end",
"title": ""
},
{
"docid": "b19285e7b6acd76e3a03b22b08ccc8ea",
"score": "0.6217027",
"text": "def without_comment_markers(text)\n text.to_s.lines.map do |line|\n line.strip.gsub(/^(\\s*(\\/\\*+|\\/\\/|\\*+\\/|\\*)+\\s?)/m, '')\n end.join(\"\\n\").strip\n end",
"title": ""
},
{
"docid": "4e44ee41dfb98ccc0860666210619754",
"score": "0.62124914",
"text": "def irrelevant_line?(source_line)\n source_line.blank? || !count_comments? && comment_line?(source_line)\n end",
"title": ""
},
{
"docid": "79e2ce1d2e4c7c181bc26018c3f7dd62",
"score": "0.61899036",
"text": "def parse_with_comments(source_buffer); end",
"title": ""
},
{
"docid": "79e2ce1d2e4c7c181bc26018c3f7dd62",
"score": "0.61899036",
"text": "def parse_with_comments(source_buffer); end",
"title": ""
},
{
"docid": "79e2ce1d2e4c7c181bc26018c3f7dd62",
"score": "0.61899036",
"text": "def parse_with_comments(source_buffer); end",
"title": ""
},
{
"docid": "766d0c105ca333eba52664856afd4a65",
"score": "0.61840045",
"text": "def remove_config_comment_lines\n # NOTE: (2016-02-09) jonk => don't want this\n end",
"title": ""
},
{
"docid": "2f2edddde4d4efdcf72da7f97d5964ac",
"score": "0.61807203",
"text": "def multiline_comment!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 50 )\n\n\n\n type = MULTILINE_COMMENT\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 229:21: '/*' ( . )* '*/'\n match( \"/*\" )\n\n # at line 229:26: ( . )*\n while true # decision 7\n alt_7 = 2\n look_7_0 = @input.peek( 1 )\n\n if ( look_7_0 == 0x2a )\n look_7_1 = @input.peek( 2 )\n\n if ( look_7_1 == 0x2f )\n alt_7 = 2\n elsif ( look_7_1.between?( 0x0, 0x2e ) || look_7_1.between?( 0x30, 0xffff ) )\n alt_7 = 1\n\n end\n elsif ( look_7_0.between?( 0x0, 0x29 ) || look_7_0.between?( 0x2b, 0xffff ) )\n alt_7 = 1\n\n end\n case alt_7\n when 1\n # at line 229:26: .\n match_any\n\n else\n break # out of loop for decision 7\n end\n end # loop for decision 7\n\n\n match( \"*/\" )\n\n\n # --> action\n channel = HIDDEN;\n # <-- action\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 50 )\n\n\n end",
"title": ""
},
{
"docid": "707c3f856f21f940223ce3c5dfa5e5d2",
"score": "0.61768353",
"text": "def parse_with_comments(source); end",
"title": ""
},
{
"docid": "f2d568c9bd189ad0e49b2e82b0b81e00",
"score": "0.6176641",
"text": "def skip_whitespace\n while @char =~ /[\\s,;#]/\n # Comments begin with a semicolon and extend to the end of the line\n # Treat #! as a comment for shebang lines\n if @char == ';' || (@char == '#' && peek_char == '!')\n while @char && @char != \"\\n\"\n next_char\n end\n elsif @char == '#'\n break unless peek_char == '_'\n next_char; next_char # skip #_\n skip_whitespace\n incomplete_error \"Unexpected end of program after #_, expected a form\" unless @char\n parse_form # discard next form\n else\n next_char\n end\n end\n end",
"title": ""
},
{
"docid": "c9eca3eac61525a227cb66685b4151ee",
"score": "0.61678773",
"text": "def skip(a_line)\n @line_cnt ||= 0\n @line_cnt += 1\n 1 == @line_cnt ||\n a_line.empty? ||\n a_line.strip.start_with?('#')\n end",
"title": ""
},
{
"docid": "74550114df5d1c31b9f31ceab820347a",
"score": "0.615999",
"text": "def missed_lines; end",
"title": ""
},
{
"docid": "74550114df5d1c31b9f31ceab820347a",
"score": "0.615999",
"text": "def missed_lines; end",
"title": ""
},
{
"docid": "6d48d1f865b8f7c8804db7bd418f701f",
"score": "0.6157843",
"text": "def clean_lines\n lines = @file_content.split(\"\\r\").select { |line| !line.match(/$\\s*#/)} unless @file_content.nil?\n end",
"title": ""
},
{
"docid": "40a916bcf5bf6446c66031fe751fff31",
"score": "0.61362",
"text": "def comment!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 15)\n\n type = COMMENT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 148:3: ( ( '#' | '//' ) (~ '\\\\n' )* | '/*' ( . )* '*/' )\n alt_10 = 2\n look_10_0 = @input.peek(1)\n\n if (look_10_0 == ?#) \n alt_10 = 1\n elsif (look_10_0 == ?/) \n look_10_2 = @input.peek(2)\n\n if (look_10_2 == ?/) \n alt_10 = 1\n elsif (look_10_2 == ?*) \n alt_10 = 2\n else\n nvae = NoViableAlternative(\"\", 10, 2)\n raise nvae\n end\n else\n nvae = NoViableAlternative(\"\", 10, 0)\n raise nvae\n end\n case alt_10\n when 1\n # at line 148:5: ( '#' | '//' ) (~ '\\\\n' )*\n # at line 148:5: ( '#' | '//' )\n alt_7 = 2\n look_7_0 = @input.peek(1)\n\n if (look_7_0 == ?#) \n alt_7 = 1\n elsif (look_7_0 == ?/) \n alt_7 = 2\n else\n nvae = NoViableAlternative(\"\", 7, 0)\n raise nvae\n end\n case alt_7\n when 1\n # at line 148:7: '#'\n match(?#)\n\n when 2\n # at line 148:13: '//'\n match(\"//\")\n\n end\n # at line 148:20: (~ '\\\\n' )*\n while true # decision 8\n alt_8 = 2\n look_8_0 = @input.peek(1)\n\n if (look_8_0.between?(0x0000, ?\\t) || look_8_0.between?(0x000B, 0xFFFF)) \n alt_8 = 1\n\n end\n case alt_8\n when 1\n # at line 148:20: ~ '\\\\n'\n if @input.peek(1).between?(0x0000, ?\\t) || @input.peek(1).between?(0x000B, 0x00FF)\n @input.consume\n else\n mse = MismatchedSet(nil)\n recover(mse)\n raise mse\n end\n\n\n\n else\n break # out of loop for decision 8\n end\n end # loop for decision 8\n\n when 2\n # at line 149:5: '/*' ( . )* '*/'\n match(\"/*\")\n # at line 149:10: ( . )*\n while true # decision 9\n alt_9 = 2\n look_9_0 = @input.peek(1)\n\n if (look_9_0 == ?*) \n look_9_1 = @input.peek(2)\n\n if (look_9_1 == ?/) \n alt_9 = 2\n elsif (look_9_1.between?(0x0000, ?.) || look_9_1.between?(?0, 0xFFFF)) \n alt_9 = 1\n\n end\n elsif (look_9_0.between?(0x0000, ?)) || look_9_0.between?(?+, 0xFFFF)) \n alt_9 = 1\n\n end\n case alt_9\n when 1\n # at line 149:10: .\n match_any\n\n else\n break # out of loop for decision 9\n end\n end # loop for decision 9\n match(\"*/\")\n\n end\n \n @state.type = type\n @state.channel = channel\n # --> action\n skip \n # <-- action\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 15)\n\n end",
"title": ""
},
{
"docid": "1c74ba653779f5bfb01d72d095f2327b",
"score": "0.6130207",
"text": "def preprocess_obvervation_line(text)\n matches = text.match(/can\\d\\s+([\\d|A-F]+\\#[\\d|A-F]+)\\n?$/)\n return nil if matches.nil?\n matches[1]\nend",
"title": ""
},
{
"docid": "3c288679a81035730f00bbdfd1fbe847",
"score": "0.61214733",
"text": "def never_lines; end",
"title": ""
},
{
"docid": "3c288679a81035730f00bbdfd1fbe847",
"score": "0.61214733",
"text": "def never_lines; end",
"title": ""
},
{
"docid": "4f3b230557cf9f347342b1140e1abf62",
"score": "0.6107084",
"text": "def extract_magic_comments(processed_source); end",
"title": ""
},
{
"docid": "6fd9336ef4b412b826450e906930fb0d",
"score": "0.610686",
"text": "def irrelevant_line(source_line); end",
"title": ""
},
{
"docid": "fe122fdd631c2ef618320e98fda7497d",
"score": "0.61048895",
"text": "def _comment\n\n _save = self.pos\n while true # sequence\n _tmp = match_string(\"#\")\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while true # sequence\n _save3 = self.pos\n _tmp = apply(:_end_hyphen_of_hyphen_line)\n _tmp = _tmp ? nil : true\n self.pos = _save3\n unless _tmp\n self.pos = _save2\n break\n end\n _tmp = apply(:_utf8)\n unless _tmp\n self.pos = _save2\n end\n break\n end # end sequence\n\n break unless _tmp\n end\n _tmp = true\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_comment unless _tmp\n return _tmp\n end",
"title": ""
},
{
"docid": "bd448ff73e952374289455a4a6ad6f25",
"score": "0.6102098",
"text": "def lines\n File\n .read(@source_path)\n .lines\n .map(&:chomp)\n .reject { |line| line.strip.empty? || line.match(Tokens::COMMENT_MATCHER) }\n end",
"title": ""
},
{
"docid": "dffaa331f99d8522adf3ff57a0f92fca",
"score": "0.60949653",
"text": "def ensure_comments_section\n if self.body.match(/^\\* COMMENT Comments$/)\n self.body[$~.end(0)..-1] = self.body[$~.end(0)..-1].gsub(/^\\* COMMENT Comments/, '')\n else\n self.body << \"\\n* COMMENT Comments\\n\"\n end\n end",
"title": ""
},
{
"docid": "2cd247fb6f663a3c00798648e36fd859",
"score": "0.60822374",
"text": "def skip?(line)\n line[0] == '#' || !line.include?(@delimeter) || line.split(@delimeter).size < 2\n end",
"title": ""
},
{
"docid": "a789b3c62a4b3080653fdc5925788ae3",
"score": "0.6077527",
"text": "def comment?\n return @assigned_paragraph_type == :comment if @assigned_paragraph_type\n return block_type.casecmp(\"COMMENT\") if begin_block? or end_block?\n return @line =~ /^[ \\t]*?#[ \\t]/\n end",
"title": ""
},
{
"docid": "5010779cba50bd10c6da231ce25eda32",
"score": "0.60772",
"text": "def remove_coding_comment text\n text.sub(/\\A# .*coding[=:].*$/, '')\n end",
"title": ""
},
{
"docid": "b18d6cef3daf9e7625a2a3d4f2b1ad20",
"score": "0.6069998",
"text": "def list?(line)\n return line =~ /^# \\* / ? '\\n' : ''\nend",
"title": ""
},
{
"docid": "7c85a17405ba1658d33797ab292d6fae",
"score": "0.6058282",
"text": "def comment!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 49 )\n\n\n\n type = COMMENT\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 228:11: '//' ( . )* ( '\\\\n' | '\\\\r' )\n match( \"//\" )\n\n # at line 228:16: ( . )*\n while true # decision 6\n alt_6 = 2\n look_6_0 = @input.peek( 1 )\n\n if ( look_6_0 == 0xa || look_6_0 == 0xd )\n alt_6 = 2\n elsif ( look_6_0.between?( 0x0, 0x9 ) || look_6_0.between?( 0xb, 0xc ) || look_6_0.between?( 0xe, 0xffff ) )\n alt_6 = 1\n\n end\n case alt_6\n when 1\n # at line 228:16: .\n match_any\n\n else\n break # out of loop for decision 6\n end\n end # loop for decision 6\n\n if @input.peek(1) == 0xa || @input.peek(1) == 0xd\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n\n # --> action\n channel = HIDDEN;\n # <-- action\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 49 )\n\n\n end",
"title": ""
},
{
"docid": "c81a04579446c1ba90498a1d0f77822d",
"score": "0.6040198",
"text": "def _comment\n\n _save = self.pos\n begin # sequence\n _tmp = match_string(\"#\")\n break unless _tmp\n while true # kleene\n\n _save1 = self.pos\n begin # sequence\n _save2 = self.pos\n _tmp = apply(:_eol)\n _tmp = !_tmp\n self.pos = _save2\n break unless _tmp\n _tmp = match_dot\n end while false\n unless _tmp\n self.pos = _save1\n end # end sequence\n\n break unless _tmp\n end\n _tmp = true # end kleene\n break unless _tmp\n _tmp = apply(:_eol)\n end while false\n unless _tmp\n self.pos = _save\n end # end sequence\n\n set_failed_rule :_comment unless _tmp\n return _tmp\n end",
"title": ""
},
{
"docid": "c1c3b13c79dfb485d127f15829d3d193",
"score": "0.602243",
"text": "def irrelevant_line?(source_line); end",
"title": ""
},
{
"docid": "49296d554924c0fafad9b79f2e3347d1",
"score": "0.60051155",
"text": "def ignore_rules\n # Read the ignore file\n ignore = File.open(@ignore_file).readlines\n # Strip out comments and blank lines\n ignore.reject! {|line| line !~ /^FC/}\n # Split the line into its component parts\n ignore.map! {|rule| rule.chomp.split(/: ?/)}\n # Throw away the rule name\n ignore.each {|rule| rule.delete_at(1)}\n end",
"title": ""
},
{
"docid": "098a03a1b94a0fe70a1eac675d4079f3",
"score": "0.59935033",
"text": "def should_parse?(line)\n stripped = line.strip\n (!stripped.empty?) && (!stripped.start_with?('#'))\n end",
"title": ""
},
{
"docid": "c448a3cb3bfe135fe6de2908b8dbd6d0",
"score": "0.59869975",
"text": "def strip_comments(line)\n line.strip.split(\" \").first\n end",
"title": ""
},
{
"docid": "a03ca97d0b9acc6601bb68d80fd27dc6",
"score": "0.5975059",
"text": "def parse_file\n line_count = 0\n @text.each_line do |line|\n if line == nil || line == '' || line.size == 0 || line[0] == '#' || line[0] == \"\\n\"\n next\n end\n elements = line.split(' ')\n if elements.size > 2\n puts 'Waring : '.red + 'in file \"' + @file_name.yellow + '\" ignoring line ' + line_count.to_s.yellow + ' ( it has more than one space and is not a comment )'\n else\n if elements.size == 1\n @ret << Manga_data.new(nil, nil, nil, elements[0], nil)\n else\n @ret << Manga_data.new(nil, elements[0], elements[1], nil, nil)\n end\n end\n line_count += 1\n end\n end",
"title": ""
},
{
"docid": "97cd298dd13acadecb3bb07888143b70",
"score": "0.5965162",
"text": "def _Comment\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:__hyphen_)\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = match_string(\"//\")\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while true # sequence\n _save3 = self.pos\n _tmp = apply(:_Nl)\n _tmp = _tmp ? nil : true\n self.pos = _save3\n unless _tmp\n self.pos = _save2\n break\n end\n _tmp = get_byte\n unless _tmp\n self.pos = _save2\n end\n break\n end # end sequence\n\n break unless _tmp\n end\n _tmp = true\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:_Nl)\n unless _tmp\n self.pos = _save\n break\n end\n while true\n _tmp = apply(:_EmptyLine)\n break unless _tmp\n end\n _tmp = true\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_Comment unless _tmp\n return _tmp\n end",
"title": ""
},
{
"docid": "108962fdbf13335b032d38269761bf0a",
"score": "0.59647685",
"text": "def extract_comment(lines)\n lines.take_while { |line| !line.match?(FILE_MARKER) }\n .join\n end",
"title": ""
},
{
"docid": "2cc4ac3d39c16b600238d598ff3bf3ac",
"score": "0.596372",
"text": "def spaceFirstComment(theLines)\n\n\ttheLines.each_with_index do |theLine, theIndex|\n\n\t\t# Two blank lines between brace and leading comment\n\t\tif (theLine[:text] == \"{\" && theLine[:comment].empty?)\n\t\t\n\t\t\tnextLine = theLines[theIndex + 1];\n\n\t\t\tif (nextLine[:text] =~ /^\\s*$/ && !nextLine[:comment].empty?)\n\t\t\t\ttheLines.insert(theIndex + 1, EMPTY_LINE);\n\t\t\t\ttheLines.insert(theIndex + 1, EMPTY_LINE);\n\t\t\t\tbreak;\n\t\t\tend\n\t\tend\n\n\tend\n\nend",
"title": ""
},
{
"docid": "ac802c25a6f53ab974872c995200bafd",
"score": "0.59592676",
"text": "def single_line_comment\n # //\n if @codes[@pos] == 0x2f and @codes[@pos + 1] == 0x2f\n @pos += 2\n pos0 = @pos\n while (code = @codes[@pos]) and !line_terminator?(code)\n @pos += 1\n end\n return ECMA262::SingleLineComment.new(@codes[pos0...@pos].pack(\"U*\"))\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "86d5a9df6ff1aded0e7cab570fad3ad8",
"score": "0.59491515",
"text": "def comments_of_file(file)\n File.readlines(file).map { |s| s[2..-1].rstrip if s.start_with?('# ') }.compact\n end",
"title": ""
},
{
"docid": "294750bf9abde3d4de1300e1ef5dac90",
"score": "0.5904362",
"text": "def _comment\n\n _save = self.pos\n while true # sequence\n _tmp = match_string(\"#\")\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while true # sequence\n _save3 = self.pos\n _tmp = apply(:_eol)\n _tmp = _tmp ? nil : true\n self.pos = _save3\n unless _tmp\n self.pos = _save2\n break\n end\n _tmp = get_byte\n unless _tmp\n self.pos = _save2\n end\n break\n end # end sequence\n\n break unless _tmp\n end\n _tmp = true\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:_eol)\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_comment unless _tmp\n return _tmp\n end",
"title": ""
},
{
"docid": "cb4eea7cfb9b65895c220a362940d20c",
"score": "0.58901626",
"text": "def multi_line_comment\n # /*\n if @codes[@pos] == 0x2f and @codes[@pos + 1] == 0x2a\n @pos += 2\n pos0 = @pos\n # */\n while (code = @codes[@pos] != 0x2a) or @codes[@pos + 1] != 0x2f\n raise ParseError.new(\"no `*/' at end of comment\", self) if code.nil?\n @pos += 1\n end\n @pos +=2\n return ECMA262::MultiLineComment.new(@codes[pos0...(@pos-2)].pack(\"U*\"))\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "7447f04c5c4765b979211bf1854f0ae6",
"score": "0.5888336",
"text": "def default_allows_comments?; true; end",
"title": ""
},
{
"docid": "db4bd28ed9900efb8d0a5a71eaf2d8bc",
"score": "0.5878286",
"text": "def is_comment(line)\n result = false\n # If source supports single line comments\n if comment_symbols[:single_line]\n result ||= line =~ /^\\s*#{Regexp.escape(comment_symbols[:single_line])}/\n end\n\n # If source supports multi-line comments\n if comment_symbols[:multiline]\n result ||= line =~ /^\\s*#{Regexp.escape(comment_symbols[:multiline][:begin])}/\n end\n result\n end",
"title": ""
},
{
"docid": "d10bd274967f091a3f81a4eb569ba131",
"score": "0.5855423",
"text": "def ignore_comment\n\traise 'Expected #' if gets[ 0 ] != '#'\nend",
"title": ""
},
{
"docid": "2342b630326981ee859ed3332f0b561a",
"score": "0.5839111",
"text": "def uncomment! \n\traise \"Cannot change a frozen text.\" if @frozen\n\t@[email protected]_line.each_with_object([]) do |line,new_content|\n\t line.chomp! # remove the newline if any\n\t m=line.match(TexLineComment) # check if the whole line is commented\n\t next unless m.nil? # read the next line if the whole line is commented\n\t m=line.match(TeXComment) # match comment if any\n\t new_content << (m.nil? ? line : m.pre_match) # keep only the pre-match\n\tend.join(\"\\n\")\n\treturn self\n end",
"title": ""
},
{
"docid": "e6f71cc4ab5e118c9aecb5b79461dc4b",
"score": "0.58263814",
"text": "def remove_commented_out_lines\n @content = @content.gsub(%r%//.*rb_define_%, '//')\n end",
"title": ""
},
{
"docid": "2968a78c341ef4c7ed8391376e2367da",
"score": "0.5813643",
"text": "def strip_comments(line)\n if line.include?('#')\n line.split(\"#\", 2)[0]\n else\n line\n end\n end",
"title": ""
},
{
"docid": "eb74b12ee9751079d08c8448020beaf2",
"score": "0.5804958",
"text": "def collect_first_comment\n skip_tkspace\n comment = ''.dup\n comment = RDoc::Encoding.change_encoding comment, @encoding if @encoding\n first_line = true\n first_comment_tk_kind = nil\n line_no = nil\n\n tk = get_tk\n\n while tk && (:on_comment == tk[:kind] or :on_embdoc == tk[:kind])\n comment_body = retrieve_comment_body(tk)\n if first_line and comment_body =~ /\\A#!/ then\n skip_tkspace\n tk = get_tk\n elsif first_line and comment_body =~ /\\A#\\s*-\\*-/ then\n first_line = false\n skip_tkspace\n tk = get_tk\n else\n break if first_comment_tk_kind and not first_comment_tk_kind === tk[:kind]\n first_comment_tk_kind = tk[:kind]\n\n line_no = tk[:line_no] if first_line\n first_line = false\n comment << comment_body\n tk = get_tk\n\n if :on_nl === tk then\n skip_tkspace_without_nl\n tk = get_tk\n end\n end\n end\n\n unget_tk tk\n\n new_comment comment, line_no\n end",
"title": ""
},
{
"docid": "c8cba600b8176679eac01aa50303e1fa",
"score": "0.5800509",
"text": "def skipped_lines; end",
"title": ""
},
{
"docid": "c8cba600b8176679eac01aa50303e1fa",
"score": "0.5800509",
"text": "def skipped_lines; end",
"title": ""
},
{
"docid": "6aed0b607b6a1f58a1e4ff0cae723387",
"score": "0.57929265",
"text": "def comment_lines(path, flag, *args)\n flag = flag.respond_to?(:source) ? flag.source : flag\n\n gsub_file(path, /^(\\s*)([^#|\\n]*#{flag})/, '\\1# \\2', *args)\n end",
"title": ""
},
{
"docid": "9ceb3d054d2259fa436574decb14fb5f",
"score": "0.5779181",
"text": "def skip_white_space_or_to_eoln\r\n while (next_char = @source.get)\r\n return next_char if (next_char > ' ') || @source.eoln?\r\n end\r\n end",
"title": ""
},
{
"docid": "7c1e2c99d0c85589e7931688ad6c9b83",
"score": "0.57602066",
"text": "def comment(string); end",
"title": ""
},
{
"docid": "7c1e2c99d0c85589e7931688ad6c9b83",
"score": "0.57602066",
"text": "def comment(string); end",
"title": ""
},
{
"docid": "7c1e2c99d0c85589e7931688ad6c9b83",
"score": "0.57602066",
"text": "def comment(string); end",
"title": ""
},
{
"docid": "7c1e2c99d0c85589e7931688ad6c9b83",
"score": "0.57602066",
"text": "def comment(string); end",
"title": ""
},
{
"docid": "3cc226622c77d09453c64ffeaf0136a6",
"score": "0.57592577",
"text": "def filter_text txt\n txt.split(\"\\n\").reject { |l| l =~ /^[ ]*$/ or l =~ /^[ ]*#(.*?)$/ }\n end",
"title": ""
},
{
"docid": "d606ed87ec3cada3344be978e1c9e1d4",
"score": "0.575788",
"text": "def skip_meta_statements\n while @scanner.peek.type == :comment\n\t write(\"#{@scanner.peek.value}\\n\")\n\t @scanner.next\n end\n rescue StopIteration\n false\n end",
"title": ""
},
{
"docid": "8362738717736490e7b1b3e74e9b4eee",
"score": "0.57519156",
"text": "def strip_comments(line)\n\t\tline.strip!\n\t\t\n\t\tif line.start_with?(COMMENTS[0]) or line.start_with?(COMMENTS[1])\n\t\t\treturn ''\n\t\tend\n\t\t\n\t\tcomment_exists = (0 ... line.length).find_all {|i| line[i, 1] == COMMENTS[0] or line[i, 1] == COMMENTS[1]}\n\t\t\n\t\tif comment_exists.empty?\n\t\t\treturn line\n\t\tend\n\t\t\n\t\tif comment_exists\n\t\t\tline1 = String.new(line)\n\t\t\t#ignore delimiters within the text in the line itself.\n\t\t\t#replace quoted string with ' ' for the length and then remove comments.\n\t\t\t#return original line with the newly calculated index values.\n\t\t\t#asked question in forum and got this idea.\n\t\t\tline.scan(REGEX_STRING).each do |item|\n\t\t\t\tline1.sub!(item,' ' * item.length)\n\t\t\tend\n\n\t\t\tcomment_start = line1.index(COMMENTS[0])\n\t\t\t\n\t\t\tunless comment_start\n\t\t\t\tcomment_start = line1.index(COMMENTS[1])\n\t\t\t\t\tunless comment_start\n\t\t\t\t\t\treturn line\n\t\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\toutput = line[0..comment_start - 1]\n\t\t\t#strip again for whitespace before comment \n\t\t\toutput.strip!\n\t\t\treturn output\n\t\tend\n\t\t#if comment doesn't exist, return the line\n\t\tline\n\tend",
"title": ""
},
{
"docid": "3e64f5b4dbf8bc337666e62b2c4e396f",
"score": "0.57426435",
"text": "def potential_lines(filename); end",
"title": ""
},
{
"docid": "87f1b703300e1a618c59ed39f22eb834",
"score": "0.57327265",
"text": "def postprocess_comments(comment_lines)\n comment_lines.map! {|l| l.sub(/^\\s([^\\s])/, '\\\\1').rstrip }\n comment_lines.delete_at(0) while comment_lines.size > 0 && comment_lines[0].empty?\n comment_lines.delete_at(-1) while comment_lines.size > 0 && comment_lines[-1].empty?\n end",
"title": ""
},
{
"docid": "2dc81b340a6db819da9ef560324b51c7",
"score": "0.57294095",
"text": "def allow_comments?\n case @comments\n when :guess\n @prompt && [email protected]? && !end_chars.include?('#')\n else\n @comments\n end\n end",
"title": ""
},
{
"docid": "f9afa7173b1aacf6e6f80d35ac6304a6",
"score": "0.5721117",
"text": "def remove_blank_and_comment_line(str)\n str.gsub! /^\\s*#.*/, ''\n str.gsub! /^\\s*\\/\\*((?!\\*\\/).)*\\*\\//m, ''\n str.gsub! /\\n\\s*/, \"\\n\"\n str.strip\n end",
"title": ""
},
{
"docid": "024a18c0574a76122d507f6c1f13daa0",
"score": "0.5720144",
"text": "def remove_comments(code_array)\n code_array.select { |line| !(line.match(Parser::COMMENT_REGEXP)) }\n end",
"title": ""
},
{
"docid": "d320830fb4fb2514b01bff06201ae786",
"score": "0.57161224",
"text": "def comment\n comment = buffer.options.comment_line.to_s\n indent = nil\n lines = []\n\n each_line do |line, fc, tc|\n line_fc = \"#{line}.#{fc}\"\n line_tc = \"#{line}.#{tc}\"\n\n next if buffer.at_end == line_tc\n\n lines << line\n\n next if indent == 0 # can't get lower\n\n line = buffer.get(\"#{line}.#{fc}\", \"#{line}.#{tc}\")\n\n next unless start = line =~ /\\S/\n\n indent ||= start\n indent = start if start < indent\n end\n\n indent ||= 0\n\n buffer.undo_record do |record|\n lines.each do |line|\n record.insert(\"#{line}.#{indent}\", comment)\n end\n end\n end",
"title": ""
},
{
"docid": "778c3d6cc6612398a9a9d74aefb26961",
"score": "0.5699793",
"text": "def remove_comments(code_msg)\n codes = ''\n code_msg.each_line do |line|\n res_c = []\n line.scan('%') do\n # scans the code for '%' to determine comments\n res_c << Regexp.last_match.offset(0).first\n end\n res_s = scan_for_index_start_and_end(line, regex_verify_string_comment)\n # find all those '%' that are inside of strings\n if !res_c.empty? && !res_s.empty?\n res_c.each do |res|\n # removes every comment at line end\n if is_not_in_string?(res, res_s)\n line.slice!(res..-1)\n end\n end\n elsif !res_c.empty?\n line.slice!(res_c[0]..-1)\n end\n codes += line.chomp + \"\\n\"\n end\n codes\nend",
"title": ""
},
{
"docid": "da0e67d3abbd2ad69adcb9de72f64687",
"score": "0.56948316",
"text": "def read_file_omitting_comments(input)\n return '' unless File.exist?(input)\n\n File.readlines(input).reject { |line| line =~ /^\\s*#/ }.join('')\n end",
"title": ""
},
{
"docid": "c628ea7c73b4553227c3b0df6152375b",
"score": "0.56888556",
"text": "def inline_comment(line)\n # For each single quote, if there is an odd number of double quote before\n # we are in a string, but if there is an even number of double quote before\n # we are out of a string so this is an inline comment and we can remove all\n # that comes after.\n double_quote = 0\n i = 0\n line.each_char do |c|\n double_quote += 1 if c == '\"'\n if c == \"'\" && double_quote.even?\n line = line[...i]\n break\n end\n i += 1\n end\n return line\n end",
"title": ""
},
{
"docid": "419f4055e8dda99f39abebb4989d13b6",
"score": "0.5688197",
"text": "def possibly_add_line_number_comment(line)\n if @state[:ll_end]\n return line + \" # WPLINE_#{@state[:line_number]}\"\n else\n return line\n end\n end",
"title": ""
},
{
"docid": "16773bbd1e1d2678b4fb490e568e3727",
"score": "0.5681879",
"text": "def comment_begins?\n\t\t\n\tend",
"title": ""
},
{
"docid": "1a9bd19e857154f45107a5f301791b96",
"score": "0.56807566",
"text": "def ml_comment!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 40)\n\n type = ML_COMMENT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 478:4: '/*' ( . )* '*/'\n match(\"/*\")\n # --> action\n if @input.peek(1) == ?* then type = DOC_COMMENT else channel = HIDDEN end \n # <-- action\n # at line 478:88: ( . )*\n loop do #loop 4\n alt_4 = 2\n look_4_0 = @input.peek(1)\n\n if (look_4_0 == ?*) \n look_4_1 = @input.peek(2)\n\n if (look_4_1 == ?/) \n alt_4 = 2\n elsif (look_4_1.between?(0x0000, ?.) || look_4_1.between?(?0, 0xFFFF)) \n alt_4 = 1\n\n end\n elsif (look_4_0.between?(0x0000, ?)) || look_4_0.between?(?+, 0xFFFF)) \n alt_4 = 1\n\n end\n case alt_4\n when 1\n # at line 478:88: .\n match_any\n\n else\n break #loop 4\n end\n end\n match(\"*/\")\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 40)\n\n end",
"title": ""
},
{
"docid": "9003558e7b49a24d7e3274eea61947f0",
"score": "0.56763035",
"text": "def extract_comment(line)\n if is_comment? line\n clean_line = line.strip\n start_offset = comment_start.length\n end_offset = clean_line.length - comment_end.length - 1\n clean_line[start_offset..end_offset].strip\n end\n end",
"title": ""
},
{
"docid": "2c028c4d3cafd408e6e8c286e6c4c04b",
"score": "0.56747085",
"text": "def process(line)\n line.gsub!(/^#.*/, '') # remove comments\n return if line.match?(/^\\s*$/) # skip blank lines\n color = Color.new line\n color.to_html\nend",
"title": ""
},
{
"docid": "6a419534d20cb58ac47afc15bd3e3947",
"score": "0.5671778",
"text": "def comment(string)\n case string.strip # strip leading and trailing whitespaces\n when /^body=\"start\"/ # match starting comment\n @interesting = true\n when /^body=\"end\"/\n @interesting = false # match closing comment\n end\n end",
"title": ""
}
] |
d796f988a7185c6534f2a8ef85d504bd
|
destroy Delete and item from the play list DELETE http method
|
[
{
"docid": "49a18add7e42ccf118f918ecb4a16bd3",
"score": "0.0",
"text": "def destroy()\n\tdeleteId = $cgi['id']\n\tdeleteItem = nil\n\tfileName = nil\n\t$playlistItems.each { |item|\n\t\tif deleteId == item['id']\n\t\t\tdeleteItem = item\n\t\t\tfileName = item['file']\n\t\tend\n\t}\n\t# look for duplicate entries for this file\n\tmultiEntryFlag = false\n\t$playlistItems.each { |item|\n\t\tif deleteId != item['id'] and fileName and fileName == item['file']\n\t\t\tmultiEntryFlag = true\n\t\tend\n\t}\n\tif deleteItem\n\t\t$playlistItems.delete(deleteItem)\n\t\twriteDescriptionFile()\n\t\tif fileName and not multiEntryFlag\n\t\t\tFile.delete(\"#{$localContentDir}/#{fileName}\")\n\t\tend\n\t\t$successMsg = \"Item deleted\"\n\t\tsignalNewContent()\n\telse\n\t\t$errors << {\"error\"=>\"Delete item not found\"}\n\tend\nend",
"title": ""
}
] |
[
{
"docid": "9df5493612b7cad981e008bd4513cd2b",
"score": "0.7664058",
"text": "def destroy\n @api_item.destroy\n end",
"title": ""
},
{
"docid": "9df5493612b7cad981e008bd4513cd2b",
"score": "0.7664058",
"text": "def destroy\n @api_item.destroy\n end",
"title": ""
},
{
"docid": "0a8913a6d9583484d16b4da37b1a5316",
"score": "0.76533526",
"text": "def destroy\n @play_list_item.destroy\n respond_to do |format|\n format.html { redirect_to play_list_items_url, notice: \"Play list item was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bb1bbf46ce51c592fb2c9f05e26a44ef",
"score": "0.7645121",
"text": "def destroy\n if @item.destroy\n head :no_content, status: 200\n else\n render json: @item.errors, status: 405\n end\n end",
"title": ""
},
{
"docid": "d2da3fb19e3ad67321e6b918c13d3ddd",
"score": "0.7596595",
"text": "def destroy\n @item.destroy\n render :json => { status: :deleted, head: :no_content }\n end",
"title": ""
},
{
"docid": "9e68abaadc1a9b2b433e606e8123cf1f",
"score": "0.7576404",
"text": "def destroy\n @item.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "cbc313e46a065a81944dd996955ecd7d",
"score": "0.7554463",
"text": "def destroy\n @list = @item.list\n @item.destroy\n respond_to do |format|\n format.html { redirect_to list_url(@list) }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3decd3947d861fd482011f1cee40321d",
"score": "0.75200087",
"text": "def destroy\n __debug_route\n @list = destroy_records\n #manifest_item_authorize!(@list) # TODO: authorize :destroy\n post_response(:ok, @list, redirect: :back)\n rescue => error\n post_response(error, redirect: :back)\n end",
"title": ""
},
{
"docid": "1754491406d5a18e76c7e760a6594787",
"score": "0.7504398",
"text": "def delete\n __debug_route\n @list = delete_records[:list]\n #manifest_item_authorize!(@list) # TODO: authorize :delete\n rescue => error\n failure_status(error)\n end",
"title": ""
},
{
"docid": "dc7978b571fa1af94fbce826dcf38dc1",
"score": "0.7484928",
"text": "def destroy; delete end",
"title": ""
},
{
"docid": "c5f70f36bf2ffc6623d74c0d57755fb4",
"score": "0.7482396",
"text": "def destroy\n @item.destroy\n head :no_content\n end",
"title": ""
},
{
"docid": "936487583a29f6b5545e5a21f239c9a4",
"score": "0.74570376",
"text": "def destroy\n\t\tItem.find(params[:id]).destroy\n\tend",
"title": ""
},
{
"docid": "20ec5155d440e780c2935a0b2d013896",
"score": "0.7454377",
"text": "def destroy\n @item_api = ItemApi.find(params[:id])\n @item_api.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_apis_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "13b2fe05646380fe061a481aadea6103",
"score": "0.7454164",
"text": "def destroy\n @list = @item.list\n @item.destroy\n respond_to do |format|\n format.html { redirect_to @list, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a82ffe6e0bea3bb1cc29c2685cc0f5ee",
"score": "0.7441644",
"text": "def destroy\n @item.destroy\n render json: { status: 'success' }\n end",
"title": ""
},
{
"docid": "714504497b5b4fdbe39b81ce307f9b0a",
"score": "0.7433349",
"text": "def destroy\n @itemmodo.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "c00d01eae3bf724b88b308af01f8c1cd",
"score": "0.7421782",
"text": "def destroy\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n begin\n team = Team.find(params[:id])\n Item.destroy(team.item_id)\n rescue => evar\n Log.add_error(request, evar)\n end\n\n list\n flash[:notice] = t('msg.delete_success')\n render(:action => 'list')\n end",
"title": ""
},
{
"docid": "115fdea22c3593a8f7119a33be878947",
"score": "0.7416635",
"text": "def destroy\n respond_with todo_item.destroy\n end",
"title": ""
},
{
"docid": "a8d232021c384f33fa74721d620f9bb5",
"score": "0.7398432",
"text": "def destroy\n @result = all_items.destroy(params[:id])\n\n respond_to do |format|\n format.html { redirect_to todo_items_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ff29bf17d111276241ffaf66c576a320",
"score": "0.7387954",
"text": "def destroy\n respond_with ListType.destroy(params[:id])\n end",
"title": ""
},
{
"docid": "741daa8786e84aae71e9ac36160cd559",
"score": "0.7381958",
"text": "def destroy\r\n\r\n end",
"title": ""
},
{
"docid": "686c7393034b9c247d493b2f3a802a23",
"score": "0.7381412",
"text": "def destroy\n @list_item = ListItem.find(params[:id])\n @list_item.destroy\n\n respond_to do |format|\n format.html { redirect_to list_items_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "375353c618e7c9aef57d0bffcd7078e9",
"score": "0.73804945",
"text": "def destroy\n #\n end",
"title": ""
},
{
"docid": "8a05a0578b61899a09b09998c39c473a",
"score": "0.7366099",
"text": "def destroy\n\t\t\t\t@api_v1_todoitem.destroy\n\n\t\t\t\thead :no_content\n\t\t\tend",
"title": ""
},
{
"docid": "9410f5d5c06a5d4acee3b61e4f080658",
"score": "0.733883",
"text": "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"title": ""
},
{
"docid": "9410f5d5c06a5d4acee3b61e4f080658",
"score": "0.733883",
"text": "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"title": ""
},
{
"docid": "9410f5d5c06a5d4acee3b61e4f080658",
"score": "0.733883",
"text": "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"title": ""
},
{
"docid": "b753081be979702541dfa59de43713b2",
"score": "0.73349935",
"text": "def destroy\n delete\n end",
"title": ""
},
{
"docid": "b753081be979702541dfa59de43713b2",
"score": "0.73349935",
"text": "def destroy\n delete\n end",
"title": ""
},
{
"docid": "8de0ba51a9a71423daa105dfe10576da",
"score": "0.73328936",
"text": "def destroy\n @play_list.destroy\n respond_to do |format|\n format.html { redirect_to play_lists_url, notice: \"Play list was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3a57ed25660da03614f5a0736435b46e",
"score": "0.7331851",
"text": "def destroy\n # sorry but not delete is not allow\n #@item = Item.find(params[:id])\n #@item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "606ca6421f51328db405314ea9ab0010",
"score": "0.7331707",
"text": "def destroy\n @uniform_item.destroy\n respond_to do |format|\n format.html { redirect_to uniform_items_url, notice: (t 'uniform_items.title')+(t 'actions.removed') }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e288a1f70916996705cfafe58799bd04",
"score": "0.73264015",
"text": "def destroy\n @playlist_item = PlaylistItem.find(params[:id])\n @playlist_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(playlist_items_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "e288a1f70916996705cfafe58799bd04",
"score": "0.73264015",
"text": "def destroy\n @playlist_item = PlaylistItem.find(params[:id])\n @playlist_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(playlist_items_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "f99da9202811e44c052889ca79131104",
"score": "0.7325033",
"text": "def destroy\n @api_task_item.destroy\n respond_to do |format|\n format.html { redirect_to api_task_items_url, notice: 'Task item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a3dce76fc11a4b610e30b41cbbbcc645",
"score": "0.7324214",
"text": "def destroy\n @todoitem.destroy\n head :no_content\n end",
"title": ""
},
{
"docid": "f8b5356c12f9777c7a2b6c3a77fe187f",
"score": "0.7321176",
"text": "def destroy\n @item = Item.find(params[:id])\n questao = @item.questao\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to questao }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "0392fe8269b59254b02118608b643361",
"score": "0.7317636",
"text": "def destroy\r\n end",
"title": ""
},
{
"docid": "3633e737644dae5f5d8d49f3248f7a12",
"score": "0.7314497",
"text": "def delete\n api(\"Delete\")\n end",
"title": ""
},
{
"docid": "6b3a0ed44bf2d25f2333b857b9e9dee0",
"score": "0.7313791",
"text": "def destroy\n @item_listum.destroy\n respond_to do |format|\n format.html { redirect_to item_lista_url, notice: 'Item listum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ea2b19f0a26603b0fada98be3deea6fe",
"score": "0.73112166",
"text": "def destroy\n @list_item = ListItem.find(params[:id])\n @list_item.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "9aa5b10b044730fe32dd947cf7cc2119",
"score": "0.73077536",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "9aa5b10b044730fe32dd947cf7cc2119",
"score": "0.73077536",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "9e150b5f4663a096202b8d517c8fec57",
"score": "0.7305048",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "9e150b5f4663a096202b8d517c8fec57",
"score": "0.7305048",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "9e150b5f4663a096202b8d517c8fec57",
"score": "0.7305048",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "9e150b5f4663a096202b8d517c8fec57",
"score": "0.7305048",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "9e150b5f4663a096202b8d517c8fec57",
"score": "0.7305048",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "9e150b5f4663a096202b8d517c8fec57",
"score": "0.7305048",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "9e150b5f4663a096202b8d517c8fec57",
"score": "0.7305048",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "9e150b5f4663a096202b8d517c8fec57",
"score": "0.7305048",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "9e150b5f4663a096202b8d517c8fec57",
"score": "0.7305048",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "9e150b5f4663a096202b8d517c8fec57",
"score": "0.7305048",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "9e150b5f4663a096202b8d517c8fec57",
"score": "0.7305048",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "1ffdb45a0a1857775198160131d2df5a",
"score": "0.7296159",
"text": "def destroy\n # .....\n end",
"title": ""
},
{
"docid": "af356b5f4f50bc6bc24580850ff9adfe",
"score": "0.7295026",
"text": "def destroy\n # TODO\n end",
"title": ""
},
{
"docid": "5bb5e4414b42364dccb5ef507fce6151",
"score": "0.7287469",
"text": "def delete\n destroy\n end",
"title": ""
},
{
"docid": "85731848a0e037564c3713a67c422435",
"score": "0.727987",
"text": "def delete\n #TODO\n end",
"title": ""
},
{
"docid": "6bb3a558b061c5cc40b1cd6dc1938a35",
"score": "0.7279238",
"text": "def destroy\n\n end",
"title": ""
},
{
"docid": "6bb3a558b061c5cc40b1cd6dc1938a35",
"score": "0.7279238",
"text": "def destroy\n\n end",
"title": ""
},
{
"docid": "6bb3a558b061c5cc40b1cd6dc1938a35",
"score": "0.7279238",
"text": "def destroy\n\n end",
"title": ""
},
{
"docid": "6bb3a558b061c5cc40b1cd6dc1938a35",
"score": "0.7279238",
"text": "def destroy\n\n end",
"title": ""
},
{
"docid": "ffb33b8880a0ad7a9676092d8ec160f5",
"score": "0.7278631",
"text": "def destroy\n\t\[email protected]\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "2ee4f130e4e10d2e5c0f04e227b5d1b8",
"score": "0.7273779",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "e8958cfafe1ba11c7c0ef5824ca11e8d",
"score": "0.72731155",
"text": "def destroy\n delete\n end",
"title": ""
},
{
"docid": "e8958cfafe1ba11c7c0ef5824ca11e8d",
"score": "0.72731155",
"text": "def destroy\n delete\n end",
"title": ""
},
{
"docid": "c2b06c8934a1264699cd5a0e366f4cd9",
"score": "0.72731066",
"text": "def destroy\n # :id here represents the name so we don't have to change the routes\n @item = Item.find_by_name(params[:id])\n p params\n logger.debug @item.inspect\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content, status: 200 }\n end\n end",
"title": ""
},
{
"docid": "9f515a69c720d75de6d58c8e7f416daa",
"score": "0.7270988",
"text": "def destroy\n @list_item = ListItem.find(params[:id])\n @list_item.destroy\n\n respond_to do |format|\n format.html { redirect_to list_items_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d5c1e571eda81757d0870235cc8d4691",
"score": "0.72709405",
"text": "def destroy\n @tw_list_item.destroy\n respond_to do |format|\n format.html { redirect_to @tw_list_item.tw_list, notice: 'The Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "045d637d57ef73d144cab34aa71a6ec0",
"score": "0.7267489",
"text": "def delete(item)\n end",
"title": ""
},
{
"docid": "1ccb335151bf8cba7124219e7ee6313d",
"score": "0.7264326",
"text": "def destroy\n @list_item = @list.list_items.find(params[:id])\n @list_item.destroy\n\n respond_to do |format|\n format.html { redirect_to list_items_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "066a5f51418e1c045338aac9b9bb8642",
"score": "0.7263411",
"text": "def destroy\n authorize! :destroy, @play\n @play.destroy\n respond_to do |format|\n format.html { redirect_to plays_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f2792c743056ff4bf85b4a17119a5ade",
"score": "0.7248312",
"text": "def destroy\n @list.destroy\n render json: @list, status: ok\n end",
"title": ""
},
{
"docid": "70c88c76517f4ed9e07a27ff6ffdd26d",
"score": "0.72479606",
"text": "def destroy\n @song_item.destroy\n respond_to do |format|\n format.html { redirect_to song_items_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5e9ae35b49b24c060862f602035d193c",
"score": "0.7247491",
"text": "def destroy\n @list_item.destroy\n\n render json: { notice: 'List Item was successfully removed.' }\n end",
"title": ""
},
{
"docid": "9a230a9b96dfb294487f5046bf37549e",
"score": "0.72471195",
"text": "def destroy\n @service = Fl::Framework::Service::List.new(current_user, params, self)\n @list = @service.get_and_check(Fl::Framework::Access::Permission::Delete::NAME)\n if @list && @service.success?\n title = @list.title\n fingerprint = @list.fingerprint\n if @list.destroy\n respond_to do |format|\n format.json do\n status_response({\n status: Fl::Framework::Service::OK,\n message: tx('fl.framework.list.controller.destroy.deleted',\n fingerprint: fingerprint, title: title)\n })\n end\n end\n end\n else\n respond_to do |format|\n format.json do\n error_response(generate_error_info(@service, @list))\n end\n end\n end\n end",
"title": ""
},
{
"docid": "0e803af277abdf1bb6f998217c0f947c",
"score": "0.7239046",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "0e803af277abdf1bb6f998217c0f947c",
"score": "0.7239046",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "0e803af277abdf1bb6f998217c0f947c",
"score": "0.7239046",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "0e803af277abdf1bb6f998217c0f947c",
"score": "0.7239046",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "0e803af277abdf1bb6f998217c0f947c",
"score": "0.7239046",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "0e803af277abdf1bb6f998217c0f947c",
"score": "0.7239046",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "0e803af277abdf1bb6f998217c0f947c",
"score": "0.7239046",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "0e803af277abdf1bb6f998217c0f947c",
"score": "0.7239046",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "0e803af277abdf1bb6f998217c0f947c",
"score": "0.7239046",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "0e803af277abdf1bb6f998217c0f947c",
"score": "0.7239046",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "0e803af277abdf1bb6f998217c0f947c",
"score": "0.7239046",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "0e803af277abdf1bb6f998217c0f947c",
"score": "0.7239046",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "0e803af277abdf1bb6f998217c0f947c",
"score": "0.7239046",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "0e803af277abdf1bb6f998217c0f947c",
"score": "0.7239046",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "0e803af277abdf1bb6f998217c0f947c",
"score": "0.7239046",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "0e803af277abdf1bb6f998217c0f947c",
"score": "0.7239046",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "0e803af277abdf1bb6f998217c0f947c",
"score": "0.7239046",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "0e803af277abdf1bb6f998217c0f947c",
"score": "0.7239046",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "0e803af277abdf1bb6f998217c0f947c",
"score": "0.7239046",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "0e803af277abdf1bb6f998217c0f947c",
"score": "0.7239046",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "0e803af277abdf1bb6f998217c0f947c",
"score": "0.7239046",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "0e803af277abdf1bb6f998217c0f947c",
"score": "0.7239046",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "0e803af277abdf1bb6f998217c0f947c",
"score": "0.7239046",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "0e803af277abdf1bb6f998217c0f947c",
"score": "0.7239046",
"text": "def destroy\n end",
"title": ""
},
{
"docid": "0e803af277abdf1bb6f998217c0f947c",
"score": "0.7239046",
"text": "def destroy\n end",
"title": ""
}
] |
09dc0412c029bde48130a92926fcf4d7
|
Get all dedicated numbers
|
[
{
"docid": "20c26619dcbfbeec6a99fd496a81ee75",
"score": "0.6423855",
"text": "def get_dedicated_numbers\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/numbers'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n return nil if _context.response.status_code == 404\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end",
"title": ""
}
] |
[
{
"docid": "08cabcd913873c8999d5a0213ace957d",
"score": "0.6636389",
"text": "def available_numbers\n\t\tif number\n\t\t\tSet[]\n\t\telse\n\t\t\[email protected](OneThruNine) { |res, group|\n\t\t\t\tres - group.numbers\n\t\t\t}\n\t\tend\n\tend",
"title": ""
},
{
"docid": "d9f14857f74dd1a3c5d8fa6f9341e295",
"score": "0.6604888",
"text": "def getAbandantNums()\n\ta = []\n\n\tfor i in ( 1 .. 28123 )\n\t\tif ( isAbandantNum( i ) )\n\t\t\ta += [i]\n\t\tend\n\tend\n\n\treturn a\nend",
"title": ""
},
{
"docid": "c42744a1c6e8021d008a079aec3b4b74",
"score": "0.6582402",
"text": "def numbers;\n @number_lookup.keys.sort\n end",
"title": ""
},
{
"docid": "ef6ab30697801d2b76adcbace65f44a7",
"score": "0.6565805",
"text": "def list_numbers\n\t\t\tputs @collection.join(\"\\t\")\n\t\tend",
"title": ""
},
{
"docid": "bd7e539ee7db269aaeee902c19e21e60",
"score": "0.6505423",
"text": "def available_numbers\n if number\n Set[]\n else\n @groups.inject(OneThruNine) { |res, group|\n res - group.numbers\n }\n end\n end",
"title": ""
},
{
"docid": "bd26adb4995b98125b72f5e6599dc836",
"score": "0.6406664",
"text": "def getNums\n\treturn BigNums.sample(2) + SmallNums.sample(4)\nend",
"title": ""
},
{
"docid": "fa1c04eed034611801d7d1952ee4d2e8",
"score": "0.63127166",
"text": "def get_all_nos\n no_arr = []\n (0..1000).each do |i|\n sum = 0\n digits_array = i.digits\n\t(0...digits_array.length).each do |j|\n\t sum = sum + (digits_array[j]*digits_array[j]*digits_array[j])\n\tend\n\tif i == sum\n\t no_arr.push(sum)\n\tend\n end\n\tputs no_arr\n end",
"title": ""
},
{
"docid": "786ce55b3372ab15214f8f9ea4b38c5e",
"score": "0.6300145",
"text": "def get_all_numbers\n room_nums = []\n @rooms.each do |room|\n room_nums << room.room_num\n end\n return room_nums\n end",
"title": ""
},
{
"docid": "b05171ffde23e131e9793e7f8e70b835",
"score": "0.6250543",
"text": "def get_num_strings\n @num_strings\n end",
"title": ""
},
{
"docid": "95051e86e007781a3316dfcf58e94d47",
"score": "0.62483424",
"text": "def numbers_map()\n [0,3,7,2,9,4,8,6,5,1]\n end",
"title": ""
},
{
"docid": "69e401429c790f5d36b0e85283092288",
"score": "0.62448",
"text": "def numbers\n @numbers ||= Numbers.new self\n end",
"title": ""
},
{
"docid": "448c3d0b97c9547e1b759afbc373fa7b",
"score": "0.6244342",
"text": "def cab_numbers()\n numbers = Array.new\n number = Struct.new(:company, :number)\n numbers.push(number.new(\"Metro Cab\", \"617-782-5500\"))\n numbers.push(number.new(\"Boston Cab Association\", \"617-536-3200\"))\n numbers.push(number.new(\"ITOA Cab Associates\", \"617-825-4000\"))\n numbers.push(number.new(\"617TaxiCab\", \"617-829-4222\"))\n return numbers\n end",
"title": ""
},
{
"docid": "69083cb8086e6bf6c56b18c773b63f3c",
"score": "0.6243613",
"text": "def numbers; end",
"title": ""
},
{
"docid": "07d052fd3c7e5ea5b3e5651124d79abd",
"score": "0.62346447",
"text": "def get_dedicated_numbers\r\n\r\n # prepare query url\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/numbers'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare and execute HttpRequest\r\n _request = @http_client.get _query_url\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # validate response against endpoint and global error codes\r\n if _context.response.status_code == 404\r\n return nil\r\n end\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n return _context.response.raw_body\r\n end",
"title": ""
},
{
"docid": "6fc2fca78a13333c6c96c3748cae9767",
"score": "0.62223095",
"text": "def numbers\n\t\tSet[*@cells.map { |c| c.number }.compact]\n\tend",
"title": ""
},
{
"docid": "e915c3863300a8dcad175f2306781760",
"score": "0.62018365",
"text": "def partes\n digitos.reverse.each_with_index.map{|n, i| 10**i * n}.reverse\n end",
"title": ""
},
{
"docid": "e915c3863300a8dcad175f2306781760",
"score": "0.62018365",
"text": "def partes\n digitos.reverse.each_with_index.map{|n, i| 10**i * n}.reverse\n end",
"title": ""
},
{
"docid": "c184035a2dac8dd387b569f43eb02fc5",
"score": "0.61910605",
"text": "def toll_free_numbers\n return @toll_free_numbers\n end",
"title": ""
},
{
"docid": "c184035a2dac8dd387b569f43eb02fc5",
"score": "0.61910605",
"text": "def toll_free_numbers\n return @toll_free_numbers\n end",
"title": ""
},
{
"docid": "2b4959c718dd657b5e0118a731d51c25",
"score": "0.610913",
"text": "def require_numbers\n data.require_numbers\n end",
"title": ""
},
{
"docid": "569fc486388967f750473f32e204f9c2",
"score": "0.60996747",
"text": "def values\n @numbers.keys\n end",
"title": ""
},
{
"docid": "9c64aa5396e59b2d73ed9f4e3b28d0eb",
"score": "0.6096268",
"text": "def numbers\n Number.find(:did_owner => id)\n end",
"title": ""
},
{
"docid": "375fef6f122343b54dc89018cc80b1a0",
"score": "0.6086197",
"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": "18392fe56afa049c2f9136ad47979a8b",
"score": "0.60758096",
"text": "def court_numbers\n courts.pluck(:number).join(',')\n end",
"title": ""
},
{
"docid": "83f88408d6daca28169e383f45c23c48",
"score": "0.6046524",
"text": "def numbers\n Set[*@cells.map { |c| c.number }.compact]\n end",
"title": ""
},
{
"docid": "7ed312822c60654f9b6dc4b59aabb57b",
"score": "0.60242957",
"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": "b6db991c74c4506cafa229e793bc3583",
"score": "0.6020623",
"text": "def numbers\n (1..19).to_a\nend",
"title": ""
},
{
"docid": "34b92b2cfc6c3537a5ddaa519a6783e9",
"score": "0.6009522",
"text": "def list_seq\n many(digit)\n end",
"title": ""
},
{
"docid": "9fc672b5c1e844acf1ab346b57642762",
"score": "0.5996667",
"text": "def numbers\n @cards.map(&:number)\n end",
"title": ""
},
{
"docid": "bd59f6a23636ede0b3147b79e752d903",
"score": "0.5985975",
"text": "def exits\n extractNums= []\n for eIndex in 0...roomAdj.length\n extractNums.append(roomAdj.to_a[eIndex].number)\n end\n return extractNums\n end",
"title": ""
},
{
"docid": "6eb1f9746206b3807330707f492ecac1",
"score": "0.5961285",
"text": "def all_nums(lat)\n\treturn [] if lat == []\n\tif number?(car(lat))\n\t\tcons(car(lat), all_nums(cdr(lat)))\n\telse\n\t\tall_nums(cdr(lat))\n\tend\nend",
"title": ""
},
{
"docid": "b12d12254a71863aa91c9cf01445f960",
"score": "0.5917244",
"text": "def large_money_numbers\n return self.scan(/(?:(?!0)\\d+|0)(?:\\.\\d+)?(多)*(亿|千万|百万|十万|万)/)\n end",
"title": ""
},
{
"docid": "3da833d81b614841b3f4fffad89f8648",
"score": "0.5898934",
"text": "def find_numbers_units\n buf = ''\n number = 0\n units = []\n numbers = []\n text = @tr_body.nil? ? @body : @tr_body\n while !text.nil? && !text.empty?\n partition = text.partition(/[-|+]?[0-9]+[.|,]?[0-9]*/)\n\n #partion[0] - poszukiwanie nazwy\n buf += partition[0]\n if partition[1].is_numeric?\n numbers << partition[1]\n\n buf += @num_rgx.gsub('x', number.to_s)\n\n result = find_unit partition[2], number\n if !result.nil?\n units << result[0]\n buf += result[1]\n partition[2] = result[2]\n end\n number += 1\n else\n buf += partition[1]\n end\n #partion[2] - poszukiwanie jednostki\n\n text = partition[2]\n end\n\n @numbers = numbers\n @units = units\n @tr_body = buf\n end",
"title": ""
},
{
"docid": "a0a483f3807f6283484501e6950b4136",
"score": "0.588883",
"text": "def numbers\n %w[1 2 3 4 5 6 7 8 9 0\n -1 -2 -3 -4 -5 -6 -7 -8 -9 -0\n 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 0th 10th\n tenth ninth eighth seventh sixth fifth fourth third second first\n ten nine eight seven six five four three two one zero]\n end",
"title": ""
},
{
"docid": "293814687bc17a37854013f05335f424",
"score": "0.5888092",
"text": "def numbers()\n return @chapters.map{ |chapter| chapter.chapter }\n end",
"title": ""
},
{
"docid": "77a5e87d0b724cbef4fbe425a2bee828",
"score": "0.58643115",
"text": "def digit_list_nicer(numso)\n numso.to_s.chars.map(&:to_i)\nend",
"title": ""
},
{
"docid": "7f77dcae0049d20a716f9c2b971bd834",
"score": "0.584402",
"text": "def phone_numbers_full\n if self[\"gd$phoneNumber\"]\n self[\"gd$phoneNumber\"].map(&method(:format_number))\n else\n []\n end\n end",
"title": ""
},
{
"docid": "1f55c13feead30093e3d62e1f5486e3a",
"score": "0.584118",
"text": "def needed_numbers\n needed = []\n coordinate_systems.each do |c|\n (0..8).each do |x|\n bits = axis_missing(x, c)\n needed << bits\n end\n end\n needed\n end",
"title": ""
},
{
"docid": "dcbe31a2cd8d540759727b79058b8ee8",
"score": "0.5840809",
"text": "def toll_numbers\n return @toll_numbers\n end",
"title": ""
},
{
"docid": "531c555ef182c1efd763b533ea13f0fd",
"score": "0.58348167",
"text": "def getnumbersmand(num1,num2,num3)\n\t\t@num1 = num1\n\t\t@num2 = num2\n\t\t@num3 = num3\n\tend",
"title": ""
},
{
"docid": "38b0e32ab6dd9fca1cd1a319c25dd72f",
"score": "0.58330786",
"text": "def standard_numbers\n { 'country_code' => 2, 'area_code' => 3,\n 'exchange_code' => 3, 'subscriber_number' => 4,\n 'zip_code' => 5 }\n end",
"title": ""
},
{
"docid": "dcc4e6c2d64acdb537df067047f7e879",
"score": "0.5824953",
"text": "def index\n @special_numbers = SpecialNumber.all\n end",
"title": ""
},
{
"docid": "d3d443ffdb7dac748b1aa3b8e6f5c4bc",
"score": "0.5822847",
"text": "def dig_list(numbers)\n numbers.to_s.chars.map(&:to_i)\nend",
"title": ""
},
{
"docid": "7e61c2f36c8a62b820a8928ca91c8de3",
"score": "0.58217144",
"text": "def generate_number\n @set = (0..9).to_a\n @a = @set.sample\n @b = (@set-[@a]).sample\n @c = (@set-[@a]-[@b]).sample\n @d = (@set-[@a]-[@b]-[@c]).sample\n @number = [@a,@b,@c,@d]\n #FOR TESTING\n #print \"#{@number}\\n\"\nend",
"title": ""
},
{
"docid": "758adfb579ddf9f1451c19f597393cc1",
"score": "0.5817441",
"text": "def digits\n @digits ||= digit.one_or_more\n end",
"title": ""
},
{
"docid": "16b19788a2ab6fbab3479c6fc194d60c",
"score": "0.580336",
"text": "def mls_numbers\n self.dig_for_array(\"listingSummary\", \"mlsNumbers\")\n end",
"title": ""
},
{
"docid": "18d35ce87ae6e8fbe926834e4b9f1f7b",
"score": "0.57917196",
"text": "def digitos\n\t\tdividendo, resto = divmod(10)\n\t\tdividendo == 0 ? [resto] : [*dividendo.digitos,resto]\n\tend",
"title": ""
},
{
"docid": "713388e1876a0ab36e8e1afdaffa4283",
"score": "0.5784505",
"text": "def get_all_phone_no (users = {})\n all_phone_numbers = []\n users.each do | u | all_phone_numbers << u[:mobile_no] end\n all_phone_numbers.uniq!\n all_phone_numbers.compact!\n end",
"title": ""
},
{
"docid": "edd1ade3dd46e40832bc7897ec420bf4",
"score": "0.5778943",
"text": "def findAccidentNumbers(remainder)\n\tnumbers = Array.new\n\tnumbersStringArray = remainder.split(/(\\s|| )/)\n\tfor numbersString in numbersStringArray\n\t\tif numbersString.scan(/\\d/).size > 0\n\t\t\tnumbers.push(numbersString)\n\t\tend\n\tend\n\treturn numbers\nend",
"title": ""
},
{
"docid": "f07ef5900ee7594f8b84bb6595b7f582",
"score": "0.57786673",
"text": "def digits\n chars = uppers + lowers + numerals + %w[- .]\n arr = []\n chars.each do |c1|\n chars.each do |c2|\n arr << c1 + c2\n end\n end\n arr\n end",
"title": ""
},
{
"docid": "4315517e5cc9e92daf6eeee26ea74df3",
"score": "0.5778371",
"text": "def index\n @static_numbers = StaticNumber.all\n end",
"title": ""
},
{
"docid": "d19b48e471928ec6b4f8b5090ed6d764",
"score": "0.5768878",
"text": "def magic_numbers(n)\n # declare an array 'result' with one element of value 7\n # traverse through a range ranging from 8 up, 7 being the first m/num\n #\n result = [7]\n i = 16\n while result.length < n\n result << i if helper(i)\n i += 1\n end\n\n result\nend",
"title": ""
},
{
"docid": "02891dfd7f931cad6902816fc98acfb1",
"score": "0.5766809",
"text": "def require_numbers\n data[:require_numbers]\n end",
"title": ""
},
{
"docid": "94fcfa76257eb108e4bcb5c5d10fe2d0",
"score": "0.5746601",
"text": "def purchased_numbers\n client.account.incoming_phone_numbers.list.map(&:phone_number)\n end",
"title": ""
},
{
"docid": "f900425905c4b240e39a07e4da7e4515",
"score": "0.5737284",
"text": "def general_nums(number)\n number.reverse[1..-1]\n end",
"title": ""
},
{
"docid": "a43629277b637713e468eb7b21cb13fc",
"score": "0.5731722",
"text": "def phone_numbers()\n @phone_numbers\n end",
"title": ""
},
{
"docid": "10d55bbe0895c494bfe4f4d8a1bad2e9",
"score": "0.5715177",
"text": "def extra_numbers\n return [] unless extra\n [change_code_number_for(extra)] + extra.numbers + extra.extra_numbers\n end",
"title": ""
},
{
"docid": "70fed4c685fb7737c0bd5690319c50e8",
"score": "0.5711029",
"text": "def account_numbers_from(reservations)\n reservations.pluck(:membership_number).map { |n| \"##{n}\" }\n end",
"title": ""
},
{
"docid": "6209a9620cf99fc1d8122bcc7dd96919",
"score": "0.5706813",
"text": "def read\n @digits.reflect.join\n end",
"title": ""
},
{
"docid": "1441d3b926a716f743a252b93d82aa83",
"score": "0.5695689",
"text": "def find_course_numbers\n department = params[:department]\n courses = Course.find_all_by_department_long(department)\n @numbers = []\n courses.each do |course|\n @numbers << course.number unless course.number == \"\" or @numbers.include?(course.number)\n end\n respond_to do |format|\n format.json { render :json => @numbers }\n end\n end",
"title": ""
},
{
"docid": "bf7dd50dd224ae43ce7c0e2ae85a76ef",
"score": "0.5685981",
"text": "def digit_list(number)\r\n number.to_s.chars.map(&:to_i)\r\nend",
"title": ""
},
{
"docid": "ba34283328613d9c252e857830622c75",
"score": "0.56857497",
"text": "def contact_contact_extra_numbers\n ContactExtraNumber.all\n end",
"title": ""
},
{
"docid": "75e80fc29359d7c453a71466f1747b42",
"score": "0.5685662",
"text": "def forwarding_numbers\n phone_numbers.select{ |n| n.forward == true }.map(&:number)\n end",
"title": ""
},
{
"docid": "75e80fc29359d7c453a71466f1747b42",
"score": "0.5685662",
"text": "def forwarding_numbers\n phone_numbers.select{ |n| n.forward == true }.map(&:number)\n end",
"title": ""
},
{
"docid": "20e83f652cc74abad7d9db7549d02899",
"score": "0.56728554",
"text": "def digit_list(num)\n num_strings = num.to_s.split(\"\")\n\n results = num_strings.map do |number|\n number.to_i\n end\n results\nend",
"title": ""
},
{
"docid": "529ba000be56dae83031c8ec07dea496",
"score": "0.5667144",
"text": "def numbers\n characters.map do |char|\n values[char]\n end\n end",
"title": ""
},
{
"docid": "c06bea18cee606a3fca3485d255459a1",
"score": "0.5661314",
"text": "def digit\n @digits.sample\n end",
"title": ""
},
{
"docid": "afe01ae1292cc06e182da653a649338e",
"score": "0.5658023",
"text": "def get_ints\r\n array = self.split(/\\D/)\r\n array.collect! {|item| item.to_i}\r\n return array\r\n end",
"title": ""
},
{
"docid": "86ae031c1dec5c392a48f121ea1c635e",
"score": "0.5658009",
"text": "def all_abundant_nums\n Marshal.load(File.read('23.gen.data'))\nend",
"title": ""
},
{
"docid": "36dd92f3fb3c7c1cde3c30cf33157b0c",
"score": "0.564459",
"text": "def hosted_numbers; end",
"title": ""
},
{
"docid": "bb408526ade235dc509123107139d7d7",
"score": "0.56423223",
"text": "def controller\n\tnum = []\n\tstrnum = (2**1000).to_s.split(//)\n\t\n\tstrnum.each do |number|\n\t\tnum << number.to_i\n\tend\n\n\t@result = num.inject(:+)\n\treturn @result \nend",
"title": ""
},
{
"docid": "59b6db2634ef1d773eb469ffd98f4c81",
"score": "0.56269276",
"text": "def source_numbers\n @string.scan(/-?\\d+\\b/).map(&:to_i).sort\n end",
"title": ""
},
{
"docid": "3043f6939c5825bc1cb3248ae68817ad",
"score": "0.56266445",
"text": "def number_combinations\n (0..4).map { |i| [number.to_s[0..i + 2], number.to_s[i + 3..-1]] }\n end",
"title": ""
},
{
"docid": "4cdd87c8b30bd63574bd1f529994d128",
"score": "0.56249964",
"text": "def math\n @numbers = (1..46).to_a.sample(6)\n end",
"title": ""
},
{
"docid": "02e16b41950b313ba58c26e52cb31315",
"score": "0.56161815",
"text": "def random_numbers( opts = {} )\n # Then set some defaults, just in case\n upper = opts[:to] || 9\n lower = opts[:from] || 0\n only = opts[:only] || :both\n\n # And finally calculate the number\n n = []\n (self - 1).times do\n i = (lower..upper).to_a.sort_by { rand }.first\n n << i.to_s\n end\n # add the last digit according to :only\n n << end_number_choices(only).select {|x| (lower <= x) && (x <= upper) }.sort_by { rand }.first.to_s\n n.join(\"\")\n end",
"title": ""
},
{
"docid": "cfa1300d7fec06f15d06fc6ca3358f2b",
"score": "0.56126976",
"text": "def get_points\n if self.number == 1\n return 11\n elsif [11,12,13].include?(self.number)\n return 10\n else\n return self.number\n end\n end",
"title": ""
},
{
"docid": "da3a698db589efb42d8299266aad77b3",
"score": "0.5612125",
"text": "def digit_list(numbers)\n numbers.to_s.chars.map {|num| num.to_i}\nend",
"title": ""
},
{
"docid": "546de8b4308a22854a3672df17334f29",
"score": "0.56078225",
"text": "def digit_list(num)\n num.to_s.chars.map! { |num| num.to_i }\nend",
"title": ""
},
{
"docid": "4dc35b31e27d60d00c7776ec014745c1",
"score": "0.55897176",
"text": "def card_number_values\n @cards.collect{|card| card.number_value}.flatten.sort\n end",
"title": ""
},
{
"docid": "274b75f85ebfcb001bf9bc05c1d96bac",
"score": "0.55851847",
"text": "def get_available_units \n @units.select { |unit| unit.available? }.map { |unit| unit.number }\n \n end",
"title": ""
},
{
"docid": "3957be38943448bb5763078836ef6e1e",
"score": "0.5581383",
"text": "def digit_list(nums)\n # Convert number to a string and then split into an array of numeric characters\n nums.to_s.chars.map(&:to_i)\nend",
"title": ""
},
{
"docid": "9bfdb2264757385339b93b5898c99d2d",
"score": "0.55807364",
"text": "def digit_list(numbers)\n numbers.to_s.each_char.map(&:to_i)\nend",
"title": ""
},
{
"docid": "86170ce6547b6bcfd544561d57bfb1a1",
"score": "0.5578064",
"text": "def get_gpo_item_nums(rft)\n # In a technically illegal but used by OCLC info:gpo uri\n ids = get_identifier(:info, \"gpo\", rft, :multiple => true)\n # Remove the uri part. \n return ids.collect {|id| id.sub(/^info:gpo\\//, '') }\n end",
"title": ""
},
{
"docid": "38670a938e23f4fb7302ac322c452dbc",
"score": "0.55771506",
"text": "def number_families(num_digits)\r\n #As an optimization, we can exclude masks that have the last digit being replaced, because it'll never hit 8 primes\r\n #since most of those will be even numbers.\r\n subgroups = power_set(0...num_digits-1)\r\n families = []\r\n subgroups.each do |fixed_mask|\r\n families += construct_families(num_digits, fixed_mask)\r\n end\r\n families\r\nend",
"title": ""
},
{
"docid": "09d88bca4007c4b913eecd8376441f0f",
"score": "0.55683327",
"text": "def brute_force\n\t\ttime do\n\t\t\tsum = @nums.inject(&:+)\n\t\t\tputs \"sum: #{sum}\"\n\t\t\tnum = sum\n\t\t\tdigs = []\n\t\t\twhile num > 9\n\t\t\t\tnum, last_digit = num.divmod(10)\n\t\t\t\tdigs << last_digit\n\t\t\tend\n\t\t\tdigs << num\n\t\t\tputs \"The first 10 digits are #{digs.reverse[0..9].join}.\"\n\t\tend\n\tend",
"title": ""
},
{
"docid": "a8104686bea3edbeb7ccc5dbfcd0b123",
"score": "0.5564539",
"text": "def call_numbers(*)\n values(:lc_call_number_a).map { |v| v.sub(/^LC:/, '').squish }.uniq\n end",
"title": ""
},
{
"docid": "bd4519a17c302725602b5b13b133678c",
"score": "0.5561668",
"text": "def phone_numbers\n self[\"gd$phoneNumber\"] ? self[\"gd$phoneNumber\"].map { |e| e['$t'] } : []\n end",
"title": ""
},
{
"docid": "bd4519a17c302725602b5b13b133678c",
"score": "0.5561668",
"text": "def phone_numbers\n self[\"gd$phoneNumber\"] ? self[\"gd$phoneNumber\"].map { |e| e['$t'] } : []\n end",
"title": ""
},
{
"docid": "bd4519a17c302725602b5b13b133678c",
"score": "0.5561668",
"text": "def phone_numbers\n self[\"gd$phoneNumber\"] ? self[\"gd$phoneNumber\"].map { |e| e['$t'] } : []\n end",
"title": ""
},
{
"docid": "cd57cbec2c2db26d582835444f318060",
"score": "0.5560912",
"text": "def available_toll_free_numbers options = {}\n raise ArgumentError, \"Unknown option passed: #{options.keys - OPTIONS}\" if (options.keys - OPTIONS).size > 0\n\n LazyArray.new do |page, size|\n numbers, _headers = short_http.get 'availableNumbers/tollFree', options.merge(page: page, size: size)\n\n numbers.map do |number|\n Types::PhoneNumber.new number\n end\n end\n end",
"title": ""
},
{
"docid": "b6223344956f2181ce6b539ade06be31",
"score": "0.55499035",
"text": "def std_nums_from_illiad(requests)\n oclcs = oclc_nums_from_illiad(requests)\n isxn = isbn_issn_from_illiad(requests)\n results = {}\n oclcs.each do |trans_num, oclc|\n results[trans_num] ||= {}\n results[trans_num][:oclc] = oclc\n end\n isxn.each do |trans_num, vals|\n results[trans_num] ||= {}\n results[trans_num][:isbn] = vals[:isbn]\n results[trans_num][:issn] = vals[:issn]\n end\n results\nend",
"title": ""
},
{
"docid": "5b98dc6f932b8b1dbc9fea32c6b5e10f",
"score": "0.5540626",
"text": "def numbers_with_digit(x, d)\n\tresult = []\n\t(1..x). each do |num|\n\t\tresult << num if num.to_s.include?(d.to_s)\n\tend\n\tp result\n\tif result.size == 0\n\t\t[0, 0, 0]\n\telse\n\t\tp [result.size, result.inject(:+), result.inject(:*)]\n\tend\n\nend",
"title": ""
},
{
"docid": "69ca1805b0fd0b9376684a366376449a",
"score": "0.5530007",
"text": "def digit_list(num)\n num_str = num.to_s\n num_chars = num_str.chars\n num_chars.map! { |char| char.to_i}\nend",
"title": ""
},
{
"docid": "022ec89ff36d0beea26b134b263b3250",
"score": "0.55290776",
"text": "def digitool_ids\n return @xml_document.xpath(\"//mods:identifier[translate(@type, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')=\\\"DIGITOOL\\\"]\", 'mods' => MODS_NAMESPACE).children.map { |xt| xt.to_s.strip }.uniq\n rescue => e\n return []\n end",
"title": ""
},
{
"docid": "e0167b32b8083ae607cc048516fdf30d",
"score": "0.55287844",
"text": "def digit_list(digits)\n array = digits.to_s.chars\n array.map! { |num| num.to_i }\nend",
"title": ""
},
{
"docid": "177c99ded3d36856aebe1d71bcdc8d98",
"score": "0.5525269",
"text": "def digit_list(number)\n number.to_s.chars.map! { |char| char.to_i }\nend",
"title": ""
},
{
"docid": "f23edcbd8a14df3eedd76be5207cd8f1",
"score": "0.55180365",
"text": "def generateNumbers()\r\n\t\t\t0.upto(623) do |i|\r\n\t\t\t\ty = (@mt[i] & 0x80000000) + (@mt[(i + 1) % 624] & 0x7FFFFFFF)\r\n\t\t\t\t@mt[i] = @mt[(i + 397) % 624] ^ (y >> 1)\r\n\t\t\t\tif (y & 1 == 1)\r\n\t\t\t\t\t@mt[i] = @mt[i] ^ 2567483615\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend",
"title": ""
},
{
"docid": "d7cc554996d90622df6346e8c81a8619",
"score": "0.55157375",
"text": "def digit_list(number)\n number.to_s.chars.map { |e| e.to_i }\nend",
"title": ""
},
{
"docid": "abdb881ee9bcc3134f35399295e95c0b",
"score": "0.5514885",
"text": "def digit_list(number)\n number.to_s.chars.map(&:to_i)\nend",
"title": ""
},
{
"docid": "abdb881ee9bcc3134f35399295e95c0b",
"score": "0.5514885",
"text": "def digit_list(number)\n number.to_s.chars.map(&:to_i)\nend",
"title": ""
}
] |
c287431f3f8b854de0cb1a5976667df2
|
GET /breeds/1 GET /breeds/1.json
|
[
{
"docid": "a27e85726c3eb1f957540bd1441215ea",
"score": "0.0",
"text": "def show\n @feed_backs = @breed.feed_backs\n @average_rate = FeedBack.where(breed_id: @breed.id).average(:rate)\n\n if params[:view] == \"all\"\n @feed_backs = @breed.feed_backs.order(created_at: :desc)\n elsif params[:view] == \"three\"\n @feed_backs = @breed.feed_backs.order(created_at: :desc).limit(3)\n else\n if @feed_backs.count > 3\n @feed_backs = @breed.feed_backs.order(created_at: :desc).limit(3)\n else\n @feed_backs = @breed.feed_backs.order(created_at: :desc)\n end\n end\n end",
"title": ""
}
] |
[
{
"docid": "da0294067c8342a3ebbcf8cbc40996ea",
"score": "0.68855876",
"text": "def breeds(animal_type)\n response = perform_get(\"/breed.list\", { :animal => animal_type })\n Breeds.new(response).breeds\n end",
"title": ""
},
{
"docid": "b3f5d17ae3d715c6b7a674c4c32d95e8",
"score": "0.6823456",
"text": "def show\n @animal_breeder = AnimalBreeder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @animal_breeder }\n end\n end",
"title": ""
},
{
"docid": "6a5d2a0c3c6fdf2f79286aa211da882c",
"score": "0.6733921",
"text": "def breeds(animal)\r\n breeds = connect('/breed.list', :animal => animal)\r\n breeds_list = Breeds.new(breeds['petfinder']['breeds']['breed'])\r\n end",
"title": ""
},
{
"docid": "51696a10bd0501d9dd0d79bbd5176cf8",
"score": "0.663561",
"text": "def index\n @breeds = Breed.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @breeds }\n end\n end",
"title": ""
},
{
"docid": "5f70c5975b23dd47b4e0a7db04a34f7a",
"score": "0.65996724",
"text": "def search_breed\n name = params[:name]\n render :json => Breed.find_breed_by_substr(name)\n end",
"title": ""
},
{
"docid": "19a8c06841a4e671d674d0c09c74a0a9",
"score": "0.655174",
"text": "def breaches(domain=\"\")\n get_resource('https://haveibeenpwned.com/api/v3/breaches',{:domain => \"\"})\nend",
"title": ""
},
{
"docid": "9729ee0bcaa7888c2d80ed61b0e8830e",
"score": "0.6549854",
"text": "def show\n @bread = Bread.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bread }\n end\n end",
"title": ""
},
{
"docid": "e27729d4ea768b422214fdf952e2065f",
"score": "0.64414316",
"text": "def get_brandings\n request :get,\n '/v3/brandings.json'\n end",
"title": ""
},
{
"docid": "8f297ef8736a90afa2e03b99f3321830",
"score": "0.6393802",
"text": "def show\n render json: Comment.where(\"breed_id=?\",params[:id])\n end",
"title": ""
},
{
"docid": "8ffbdea2538bb0e836564ac066a30178",
"score": "0.6368106",
"text": "def index\n @breeders = Breeder.all\n end",
"title": ""
},
{
"docid": "f615baa9d3344fa239c5610d9092803a",
"score": "0.6363703",
"text": "def show\n @blurb = Blurb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blurb }\n end\n end",
"title": ""
},
{
"docid": "58a37e11343b2116239a1c07c15c0f1f",
"score": "0.63434565",
"text": "def beer(id)\n options = { :bid => id }\n get('/beer_info', options)\n end",
"title": ""
},
{
"docid": "f8c2d8284e854cc7b2f94cf62d2851f2",
"score": "0.6331898",
"text": "def list_dogs\n breed = Breed.find(params[:id])\n render json: breed.dogs.all\n end",
"title": ""
},
{
"docid": "91ce8d2a870fcc40e6fe65b06ddf4403",
"score": "0.6320276",
"text": "def show\n @brigade = Brigade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brigade }\n end\n end",
"title": ""
},
{
"docid": "690df90c9f18de66503c61d17a607d4a",
"score": "0.62992436",
"text": "def show\n @bounty = Bounty.find(params[:id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bounty }\n end\n end",
"title": ""
},
{
"docid": "ae0dfdd558c14a65a487c20b617c7b01",
"score": "0.62942487",
"text": "def show\n @breed = Breed.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @breed }\n end\n end",
"title": ""
},
{
"docid": "d0ac63f6e3efa726d85f4c33acb3a118",
"score": "0.628892",
"text": "def show\n @bounty = Bounty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bounty }\n end\n end",
"title": ""
},
{
"docid": "d0ac63f6e3efa726d85f4c33acb3a118",
"score": "0.628892",
"text": "def show\n @bounty = Bounty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bounty }\n end\n end",
"title": ""
},
{
"docid": "868bf1d44a22b8e664b73400e7b6b825",
"score": "0.6284586",
"text": "def show\n @belief = Belief.find(params[:id])\n #@belief = Belief.first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @belief }\n end\n end",
"title": ""
},
{
"docid": "d6da5392054f4a2c0571d4cb5a7eb0f7",
"score": "0.62733763",
"text": "def show\n render json: @bike_color\n end",
"title": ""
},
{
"docid": "74d329936f4ece5ce5f37ea00d3bad1f",
"score": "0.6260401",
"text": "def list_breeds\n find_all_breeds_by_size(selected_size).map.with_index do |breed, index|\n puts Rainbow(\"#{index + 1}. #{breed.breed_name}\").cyan\n breed.breed_name\n end\n end",
"title": ""
},
{
"docid": "bbc0ec69a0220f7803b06f6a70e33e15",
"score": "0.62488955",
"text": "def show\n @brewer = Brewer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brewer }\n end\n end",
"title": ""
},
{
"docid": "398a00aa1652488cbfe8bdf8fbc2a89d",
"score": "0.62413317",
"text": "def show\n @angel = Angel.find(params[:id])\n @blogs = @angel.blogs\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @angel }\n end\n end",
"title": ""
},
{
"docid": "c6a6775a4dc701d718293d45e5ebc255",
"score": "0.6235703",
"text": "def show\n @blogspot = Blogspot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blogspot }\n end\n end",
"title": ""
},
{
"docid": "266810108e8ea423ad589e457ad116da",
"score": "0.62329566",
"text": "def show\n brand = Brand.find(params[:id])\n render json: {brand: brand, beers:brand.beers}\n end",
"title": ""
},
{
"docid": "c917b45aa1f87ec70286c7cc83e47442",
"score": "0.6223507",
"text": "def index\n @blurbs = Blurb.all.sort_by{|b| b.name}\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blurbs }\n end\n end",
"title": ""
},
{
"docid": "893c4223bc6610fe1948b841caebe668",
"score": "0.62108725",
"text": "def shows\n Birdman::Requester.get(\"people/#{id}/shows\")\n end",
"title": ""
},
{
"docid": "35abe61bfd224be00c833b79588a6bd3",
"score": "0.62103397",
"text": "def show\n @gamble = Gamble.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @gamble }\n end\n end",
"title": ""
},
{
"docid": "8473532f8e6643d5e21c5ca62f593a32",
"score": "0.6199388",
"text": "def show\n @blogger = Blogger.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blogger }\n end\n end",
"title": ""
},
{
"docid": "564a1d1a3cce599c5ebea1c65a09d35b",
"score": "0.6163987",
"text": "def show\n render json: @bike\n end",
"title": ""
},
{
"docid": "a03cae52846ce579e17ab0981c48d165",
"score": "0.6162758",
"text": "def index\n @bids = Bid.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bids }\n end\n end",
"title": ""
},
{
"docid": "50b2f6a697e7198f074fc5185a6d9627",
"score": "0.61593413",
"text": "def new\n @animal_breeder = AnimalBreeder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @animal_breeder }\n end\n end",
"title": ""
},
{
"docid": "688b3a3cabd7ad3cb6487eed273a3745",
"score": "0.6154734",
"text": "def show\n @bounty = Bounty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bounty }\n end\n end",
"title": ""
},
{
"docid": "4e78dc3a17211514969682c82575cf39",
"score": "0.61545897",
"text": "def show\n @beer = Beer.find(params[:id])\n render json: @beer\n end",
"title": ""
},
{
"docid": "4abc2d090a66c8c411bcfa465590f09a",
"score": "0.6153084",
"text": "def blog(id)\n get(\"/blogs/#{Integer(id)}\")\n rescue ShufflerFM::NotFound\n nil\n end",
"title": ""
},
{
"docid": "3c94f035351ba0012045b09143d9a85d",
"score": "0.6146139",
"text": "def show\n @brewery = Brewery.find(params[:id])\n\t@ratings = @brewery.ratings\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brewery }\n end\n end",
"title": ""
},
{
"docid": "4f8f10935ec94cc8ee8d7e8e4b41a44d",
"score": "0.6145588",
"text": "def view_bids\n @bids = Bid.find_all_by_item_id(params[:id])\n\n respond_to do |format|\n format.html # view_bids.html.erb\n format.json { render json: @bids }\n end\n end",
"title": ""
},
{
"docid": "34c2e79bdbc22715107332b1244fc75e",
"score": "0.6143834",
"text": "def show\n @bid = Bid.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bid }\n end\n end",
"title": ""
},
{
"docid": "34c2e79bdbc22715107332b1244fc75e",
"score": "0.6143834",
"text": "def show\n @bid = Bid.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bid }\n end\n end",
"title": ""
},
{
"docid": "6840a91315b853892d6d3494b830db69",
"score": "0.61383665",
"text": "def show\n @dibb = Dibb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dibb }\n end\n end",
"title": ""
},
{
"docid": "2deb084147db7de68a2c2830e25672a7",
"score": "0.6132837",
"text": "def show\n #@breed = Breed.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @breed }\n end\n end",
"title": ""
},
{
"docid": "c1d408e90ce204f3651b8dbea131b150",
"score": "0.61246896",
"text": "def show\n @blert = Blert.find(params[:id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blert }\n end\n end",
"title": ""
},
{
"docid": "68f210d83bfbdd518ec23c9ec4040cdd",
"score": "0.6115031",
"text": "def show\n @bid = Bid.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bid }\n end\n end",
"title": ""
},
{
"docid": "68f210d83bfbdd518ec23c9ec4040cdd",
"score": "0.6115031",
"text": "def show\n @bid = Bid.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bid }\n end\n end",
"title": ""
},
{
"docid": "8f957f5640ceff47bb88abfdd26d1f2c",
"score": "0.6111524",
"text": "def show\n @brewery = Brewery.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brewery }\n end\n end",
"title": ""
},
{
"docid": "37bcb6ddb42899a063db238384e22a0f",
"score": "0.6105753",
"text": "def show\n @burger = Burger.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @burger }\n end\n end",
"title": ""
},
{
"docid": "465f37f5b533029a8fcc2160f1290a3f",
"score": "0.60882807",
"text": "def index\n @dinosaur_breeds = DinosaurBreed.all\n end",
"title": ""
},
{
"docid": "f5933ae7a1bb50e82c435f3b08c3210a",
"score": "0.60866815",
"text": "def show\n @bird = Bird.find(params[:id])\n\n render json: @bird, status: :ok\n end",
"title": ""
},
{
"docid": "47f7fa03a57868fccae1acfdaa08c8c6",
"score": "0.6085439",
"text": "def show\n @bike = Bike.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bike }\n end\n end",
"title": ""
},
{
"docid": "47f7fa03a57868fccae1acfdaa08c8c6",
"score": "0.6085439",
"text": "def show\n @bike = Bike.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bike }\n end\n end",
"title": ""
},
{
"docid": "47f7fa03a57868fccae1acfdaa08c8c6",
"score": "0.6085439",
"text": "def show\n @bike = Bike.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bike }\n end\n end",
"title": ""
},
{
"docid": "9fdd2c736c0a6f297562b3da595ee8f5",
"score": "0.60769725",
"text": "def show\n @buzzword = Buzzword.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @buzzword }\n end\n end",
"title": ""
},
{
"docid": "e5b81dc7ff92dc7abf4a826ed50dc9c5",
"score": "0.6060579",
"text": "def set_breed\n @breed = Breed.find(params[:id])\n end",
"title": ""
},
{
"docid": "0afd85a7ffc0aaaabedf5cd374b221ef",
"score": "0.60590947",
"text": "def index\n @beaches = Beach.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @beaches }\n end\n end",
"title": ""
},
{
"docid": "a3a230da5bc052ab1d352e62f1c7ab9a",
"score": "0.60511845",
"text": "def movies\n Birdman::Requester.get(\"people/#{id}/movies\")\n end",
"title": ""
},
{
"docid": "8cfa54268caad12170cde2d11d43ab5b",
"score": "0.60476786",
"text": "def index\n @birds = Bird.all_visible\n render json: {birds: @birds.as_json}, status: :ok\n end",
"title": ""
},
{
"docid": "8d18e5a3081b324a916dbccf6bf9eeb4",
"score": "0.60452193",
"text": "def show\n @blue = Blue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blue }\n end\n end",
"title": ""
},
{
"docid": "42924e83aecb8565f504408842da5e1f",
"score": "0.60440356",
"text": "def show\n @beach = Beach.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beach }\n end\n end",
"title": ""
},
{
"docid": "e733eeee5ac4c24900f76706d7d580e2",
"score": "0.6033917",
"text": "def show\n @bleat = Bleat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bleat }\n end\n end",
"title": ""
},
{
"docid": "7da1bb9eaa4ada491cf158dcbe5fa0d6",
"score": "0.60332507",
"text": "def show\n @bell = Bell.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bell }\n end\n end",
"title": ""
},
{
"docid": "c32ae01d73b571e36290b1c261c0878b",
"score": "0.60259545",
"text": "def index\n @breastfeeds = Breastfeed.all\n end",
"title": ""
},
{
"docid": "6ebf1bbbb1bd6fbc95bcc22a06071c3b",
"score": "0.6023686",
"text": "def index\n\t\t@user = User.find_by(id: session[:user_id])\n\t\t@breeds = Breed.all\n\tend",
"title": ""
},
{
"docid": "90399933e8cbecc1cb5e683b0f50b410",
"score": "0.6013336",
"text": "def show\n @allbum = Allbum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @allbum }\n end\n end",
"title": ""
},
{
"docid": "e5f6051d071c59704850603c01057c4e",
"score": "0.60051864",
"text": "def set_breed\n @breed = Breed.find(params[:id])\n end",
"title": ""
},
{
"docid": "e5f6051d071c59704850603c01057c4e",
"score": "0.60051864",
"text": "def set_breed\n @breed = Breed.find(params[:id])\n end",
"title": ""
},
{
"docid": "e5f6051d071c59704850603c01057c4e",
"score": "0.60051864",
"text": "def set_breed\n @breed = Breed.find(params[:id])\n end",
"title": ""
},
{
"docid": "2e4b52159e172f37901559f85d8f8ac1",
"score": "0.60049343",
"text": "def show\n @breeding_pair = BreedingPair.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @breeding_pair }\n end\n end",
"title": ""
},
{
"docid": "c3a91056390ea3d5f5ceb5ddce7608d1",
"score": "0.6004",
"text": "def index\n @breasts = Breast.all\n end",
"title": ""
},
{
"docid": "8e19b0768db23a08b28fb238f736bd48",
"score": "0.5991876",
"text": "def show\n @bottle = Bottle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bottle }\n end\n end",
"title": ""
},
{
"docid": "237ec4ca58f27f30bb6918f84178480d",
"score": "0.59905356",
"text": "def show_birds\n test = get_params\n category = params[:category]\n birds = Bird.get_birds_in_category(category)\n birds = birds.map do |bird|\n {common_name: bird.common_name, species_name: bird.species_name, img_url: bird.img_url, id: bird.id, birdcall: bird.birdcall}\n end\n render :json => birds\n end",
"title": ""
},
{
"docid": "5f80c11ebb97762a8c7b8aba1760d9e9",
"score": "0.5987867",
"text": "def show\n render json: @my_bike\n end",
"title": ""
},
{
"docid": "5f80c11ebb97762a8c7b8aba1760d9e9",
"score": "0.5987867",
"text": "def show\n render json: @my_bike\n end",
"title": ""
},
{
"docid": "0a115af455722a2985df903ef63c3fce",
"score": "0.5987315",
"text": "def show\n @bingo = Bingo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bingo }\n end\n end",
"title": ""
},
{
"docid": "8644224580602d1c67f3a4625dadd029",
"score": "0.59803396",
"text": "def show\n @billee = Billee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @billee }\n end\n end",
"title": ""
},
{
"docid": "1357de8bb7849cfc8dfc7258a752fc3c",
"score": "0.5977091",
"text": "def request\n HTTParty.get('http://api.brewerydb.com/v2/beer/' + @beer_id + '?withBreweries=Y&key=' + ENV['API_KEY'] + '&format=json')\n end",
"title": ""
},
{
"docid": "1357de8bb7849cfc8dfc7258a752fc3c",
"score": "0.5977091",
"text": "def request\n HTTParty.get('http://api.brewerydb.com/v2/beer/' + @beer_id + '?withBreweries=Y&key=' + ENV['API_KEY'] + '&format=json')\n end",
"title": ""
},
{
"docid": "6fa8c8f42ba519639f039af9dba042a6",
"score": "0.597042",
"text": "def show\n @blog = Blog.find(params[:id])\n render json: @blog\n end",
"title": ""
},
{
"docid": "bd0759246bd3134e1f349d99eb2a13ea",
"score": "0.5965138",
"text": "def show\n @clubber = Clubber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clubber }\n end\n end",
"title": ""
},
{
"docid": "1ba7ac4d5283f45e70f1fd9a88983923",
"score": "0.59623337",
"text": "def beers\n @brewery = Brewery.from_param params[:id]\n @beers = @brewery.beers\n\n respond_to do |format|\n format.json { render_for_api :brewery, :json => @beers }\n format.xml { render_for_api :brewery, :xml => @beers }\n end\n end",
"title": ""
},
{
"docid": "484eeec15e07fb021c93b983f3692116",
"score": "0.5961779",
"text": "def index\n @birds = Bird.all\n respond_to do |format|\n format.json { render json: get_birds_response(@birds), status: :ok } # Method available in birds_helper.rb\n end\n end",
"title": ""
},
{
"docid": "dfcaf2f2927a6152a044d95418cb89e8",
"score": "0.59584194",
"text": "def show\n @beast = Beast.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beast }\n end\n end",
"title": ""
},
{
"docid": "f2e6b97f79ec872e176002221665f256",
"score": "0.5953665",
"text": "def show\n @brt = Brt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brt }\n end\n end",
"title": ""
},
{
"docid": "e2f026226c247c84bb64b2c9ebccfe32",
"score": "0.5948875",
"text": "def show\n @baoming = Baoming.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @baoming }\n end\n end",
"title": ""
},
{
"docid": "aa957bc247d6f614a49f5ed726af17fb",
"score": "0.594263",
"text": "def show\n @artist = Artist.find(params[:id])\n artist = Echonest::Artist.new(ENV['ECHONEST_API_KEY'], URI.escape(@artist.name))\n @bios = {}\n begin\n bios = artist.biographies\n @bios[:text] = bios[0].text\n @bios = @bios.merge(:url => bios[0].url )\n @blogs = artist.blogs\n rescue Exception => e\n @bios = nil\n @blogs = nil\n end\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @artist }\n end\n end",
"title": ""
},
{
"docid": "32439e920d5c924ea41c1731c5bced46",
"score": "0.59345293",
"text": "def show\n @beer = Beer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beer }\n end\n end",
"title": ""
},
{
"docid": "32439e920d5c924ea41c1731c5bced46",
"score": "0.59345293",
"text": "def show\n @beer = Beer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beer }\n end\n end",
"title": ""
},
{
"docid": "078c807209dc2926658c3834c21a4c22",
"score": "0.593392",
"text": "def show\n @beet = Beet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beet }\n end\n end",
"title": ""
},
{
"docid": "309c2019db2d4e2dfd7579f55e52ad16",
"score": "0.5928251",
"text": "def index\n @blogs = Blog.all\n render json: @blogs\n end",
"title": ""
},
{
"docid": "d0eaa474ada1c501c1855213c73f0380",
"score": "0.5927607",
"text": "def breed_standard_url(dog)\n breeds = HTTParty.get('https://opendata.socrata.com/api/views/2es9-pgpu/rows.xml?accessType=DOWNLOAD')\n breeds[\"response\"][\"row\"][\"row\"].find {|x| x['breed'] == dog+' ' }[\"web_link\"][\"url\"]\nend",
"title": ""
},
{
"docid": "f7f8d2c8859a8e08d00f8c345c8c4234",
"score": "0.59236735",
"text": "def index\n @baosong_bs = BaosongB.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @baosong_bs }\n end\n end",
"title": ""
},
{
"docid": "fd954bfdbc06cfef1948993bc823db92",
"score": "0.5921745",
"text": "def show\n @bead = Bead.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bead }\n end\n end",
"title": ""
},
{
"docid": "d1300cd72a5791eba201b3331b261e88",
"score": "0.5920901",
"text": "def show\n @bbs_body = BbsBody.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bbs_body }\n end\n end",
"title": ""
},
{
"docid": "4f19274dd55f00fdd68352241e261061",
"score": "0.5917224",
"text": "def show\n @tumblr = Tumblr.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tumblr }\n end\n end",
"title": ""
},
{
"docid": "be115a8c6fdd2644d07da0557f6a9e05",
"score": "0.59116733",
"text": "def index\n @beddings = Bedding.all\n end",
"title": ""
},
{
"docid": "9bb5d5ba63583463cb290363913f2dce",
"score": "0.5910999",
"text": "def show\n @bilder = Bilder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bilder }\n end\n end",
"title": ""
},
{
"docid": "1443dc5d4061ca4f662434d90769e26d",
"score": "0.5907501",
"text": "def show\n @beer = Beer.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beer }\n end\n end",
"title": ""
},
{
"docid": "e53faa80d9855021f3852cb124bb4a5f",
"score": "0.59035426",
"text": "def index\n @blerts = Blert.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @blerts }\n end\n end",
"title": ""
},
{
"docid": "f03290c5decbe3ce929284140845d386",
"score": "0.590156",
"text": "def show \n @bachelorettes = Bachelorette.find(params[:id]) \n render json: @bachelorettes\n end",
"title": ""
},
{
"docid": "5fbfee520ff24c3ae34e181a233e98b4",
"score": "0.58901966",
"text": "def show\n budget = Budget.find(params[:id])\n render :json => budget\n end",
"title": ""
},
{
"docid": "f26490697a3a3ac1745ddceb5f14f233",
"score": "0.58899355",
"text": "def beers_list\n \t@url = 'https://api.punkapi.com/v2/beers' \t\t\n \tresponse = RestClient.get beer_url\n \tjson_response = JSON.parse response.body\n\n \tcreate_list = ::Beers::Create.call(\n \t\tuser: @current_user,\n \t\tbeers_data: json_response\n \t)\n \t\n \trender json: create_list.beers, adapter: :json_api, each_serializer: BeerSerializer\n end",
"title": ""
},
{
"docid": "cad636dc7cd092774ce9a5d3f65ce1ac",
"score": "0.588745",
"text": "def show\n @biller = Biller.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @biller }\n end\n end",
"title": ""
}
] |
d550f5ac07dfbb70faa67a77ed9a3121
|
True only if the reciprocal is a one_to_one association.
|
[
{
"docid": "5c4b3e8c8b96271f3aaa00388c225f67",
"score": "0.76532215",
"text": "def set_reciprocal_to_self?\n reciprocal\n reciprocal_type == :one_to_one\n end",
"title": ""
}
] |
[
{
"docid": "20187728e862bf778e5daf632a421ac7",
"score": "0.7350777",
"text": "def has_one?\n true\n end",
"title": ""
},
{
"docid": "0766753e2384ed9af8dbae15fe57ff06",
"score": "0.73433095",
"text": "def one?\n [Referenced::HasOne, Embedded::EmbedsOne].any? { |a| self.is_a?(a) }\n end",
"title": ""
},
{
"docid": "5d3ebfb99dd48631f0f70ed4ade91404",
"score": "0.7113228",
"text": "def has_one_valid?(relation)\n relation = klass.reflect_on_association(relation)\n\n return true if relation[:relation] ==\n ::Mongoid::Relations::Referenced::One\n\n invalid_relation(\n ::Mongoid::Relations::Referenced::One, relation[:relation]\n )\n end",
"title": ""
},
{
"docid": "bb4419d5afdc5032517b7dd942be2959",
"score": "0.68173975",
"text": "def has_one?\n @macro == :has_one\n end",
"title": ""
},
{
"docid": "7c580177b0e77d1a57a1ab1796f54ca6",
"score": "0.67426914",
"text": "def referenced_one?\n metadata && metadata.macro == :references_one\n end",
"title": ""
},
{
"docid": "042aae94ddd46a1c6507f04d5244630a",
"score": "0.66882855",
"text": "def reciprocal_association?(assoc_reflect)\n possible_reciprocal_types.include?(assoc_reflect[:type]) &&\n (begin; assoc_reflect.associated_class; rescue NameError; end) == self[:model] &&\n assoc_reflect[:conditions].nil? &&\n assoc_reflect[:block].nil?\n end",
"title": ""
},
{
"docid": "0a4058286ae3906284f0751f85ff66aa",
"score": "0.65974677",
"text": "def we_can_set_the_inverse_on_this?(record)\n if @reflection.has_inverse?\n inverse_association = @reflection.polymorphic_inverse_of(record.class)\n inverse_association && inverse_association.macro == :has_one\n else\n false\n end\n end",
"title": ""
},
{
"docid": "ff7dfa3e85d58ece14090dde8fb81dc0",
"score": "0.654556",
"text": "def we_can_set_the_inverse_on_this?(record)\n if @reflection.has_inverse?\n inverse_association = @reflection.polymorphic_inverse_of(record.class)\n inverse_association && inverse_association.macro == :has_one\n else\n false\n end\n end",
"title": ""
},
{
"docid": "98309b45f29eff83f66cd528d1e9193c",
"score": "0.6475179",
"text": "def embeds_one?(field)\n relation_of(field) == if Mongoid::Compatibility::Version.mongoid7_or_newer?\n Mongoid::Association::Embedded::EmbedsOne::Proxy\n else\n Mongoid::Relations::Embedded::One\n end\n end",
"title": ""
},
{
"docid": "32d2646fb317bec1cd9c2fbd43c04035",
"score": "0.6460302",
"text": "def at_least_one? association\n errors.add(:base, \"must add at least one #{association}\") if association.blank?\n end",
"title": ""
},
{
"docid": "cb6fdaf51c845d03c333a571536b716e",
"score": "0.64178175",
"text": "def one?\n true\n end",
"title": ""
},
{
"docid": "18e7566a29194170d6de889662e2b834",
"score": "0.64126945",
"text": "def reciprocal_association?(assoc_reflect)\n super && self[:keys] == assoc_reflect[:keys] && primary_key == assoc_reflect.primary_key\n end",
"title": ""
},
{
"docid": "af594c3c343be57c19186fd0e36d2cfd",
"score": "0.6406377",
"text": "def reciprocal_type\n :many_to_one\n end",
"title": ""
},
{
"docid": "23e36173951c56880f1805e8cecccb05",
"score": "0.63955075",
"text": "def reciprocal_type\n :many_to_one\n end",
"title": ""
},
{
"docid": "d47d40fc1d48ed6999bc2dd92365654d",
"score": "0.6391098",
"text": "def multiple_associations?\n associations.any? { |col,assocs| assocs.length > 1 }\n end",
"title": ""
},
{
"docid": "cf97a208a765de5ce78d5cf24c78b44b",
"score": "0.6378012",
"text": "def one?\n result.equal?(:one)\n end",
"title": ""
},
{
"docid": "2c0e57da30f58ba92e983cc720f40c64",
"score": "0.6362837",
"text": "def has_one(*args)\n require \"og/relation/has_one\"\n relations! << Og::HasOne.new(args, :owner_class => self)\n end",
"title": ""
},
{
"docid": "ef4a2d6dc7fba700818218f9f8460599",
"score": "0.6352667",
"text": "def we_can_set_the_inverse_on_this?(record)\n @reflection.has_inverse? && @reflection.inverse_of.macro == :has_one\n end",
"title": ""
},
{
"docid": "980287bd0e08bafb7bc34da50a3c6284",
"score": "0.6346946",
"text": "def has_one?; false; end",
"title": ""
},
{
"docid": "980287bd0e08bafb7bc34da50a3c6284",
"score": "0.6346946",
"text": "def has_one?; false; end",
"title": ""
},
{
"docid": "9c420b557a2eda4d9483cdca5a8ee08d",
"score": "0.63283014",
"text": "def has_any_model_relationship?\n !model_relationship.eql?(NONE)\n end",
"title": ""
},
{
"docid": "dfb281b9e632f049bb0de8be4b7877f8",
"score": "0.6322671",
"text": "def reciprocal_array?\n !set_reciprocal_to_self?\n end",
"title": ""
},
{
"docid": "ad893e4e897d0c8559d8496ecd286fda",
"score": "0.630696",
"text": "def check\n if unique_has_one_association?\n check_unique_has_one\n else\n check_remaining\n end\n end",
"title": ""
},
{
"docid": "cc741928634d2486f6be078ebcaccef2",
"score": "0.62862796",
"text": "def set_reciprocal_to_self?\n true\n end",
"title": ""
},
{
"docid": "2996a46eb682dabfa443ba23d33036f7",
"score": "0.628369",
"text": "def has_one(*attrs)\n associate(Associations::HasOne, attrs)\n end",
"title": ""
},
{
"docid": "788bfff16463847a54eb8d06df716a26",
"score": "0.62791985",
"text": "def reciprocal_type\n :one_to_many\n end",
"title": ""
},
{
"docid": "9a03d56735bbf8c3b4b10ef887cb5362",
"score": "0.62707865",
"text": "def preconditions\n %i[\n has_one\n has_many\n ].include?(association.macro) && association.through_reflection.nil? && association.klass\n rescue StandardError\n false\n end",
"title": ""
},
{
"docid": "94b46f087fabc8fb008b7e513d090630",
"score": "0.6263703",
"text": "def belongs_to?\n not property? and not multiple?\n end",
"title": ""
},
{
"docid": "53cdb33a0298fc4f9b565e93ea3aa899",
"score": "0.62529427",
"text": "def set_reciprocal_to_self?\n true\n end",
"title": ""
},
{
"docid": "94452e6095e09e0b3c5ee2b0e3c8cb9d",
"score": "0.6209447",
"text": "def belongs_to_or_has_one?(reflection)\n if reflection.respond_to?(:macro) # < Rails 4.3\n return true if reflection.macro == :belongs_to || reflection.macro == :has_one\n else # >= Rails 5.3\n return true if reflection.instance_of?(ActiveRecord::Reflection::BelongsToReflection) ||\n reflection.instance_of?(ActiveRecord::Reflection::HasOneReflection)\n end\n end",
"title": ""
},
{
"docid": "88e52ed3c14195a9f9bb39a4e8923a50",
"score": "0.62093806",
"text": "def one?\n only_with('one?', 'Boolean')\n items.compact.one?\n end",
"title": ""
},
{
"docid": "286a900ffa76f9d3eb0ddc77501673dd",
"score": "0.6201067",
"text": "def has_one(*attrs)\n associate(:has_one, attrs)\n end",
"title": ""
},
{
"docid": "7228af35d8f272c7cabb6d88e305e805",
"score": "0.6163277",
"text": "def preconditions\n %i[\n has_one\n has_many\n ].include?(association.macro) && association.through_reflection.nil? && association.klass\n rescue NameError\n false\n end",
"title": ""
},
{
"docid": "c6d9c3facc9e3faf36ddd3dfc02163b0",
"score": "0.61485773",
"text": "def already_related?(document)\n document.persisted? &&\n document._association &&\n document.respond_to?(document._association.foreign_key) &&\n document.__send__(document._association.foreign_key) == _base._id\n end",
"title": ""
},
{
"docid": "5fb3ab3f88203a130fd3362bc555333a",
"score": "0.60890394",
"text": "def only_one_primary_by_user\n\n\t\treturn true if self.user.nil?\n\t\tnumber_of_primary_email_of_the_user = self.user.email_source_accounts.where(primary: true).count\n\t\tif number_of_primary_email_of_the_user > 0 && self.primary\n\t\t\t#errors.add(\"You can't add more than one primary email_source_account by user\")\n\t\t\treturn false\n\t\telse\n\t\t\treturn true\n\t\tend\n\tend",
"title": ""
},
{
"docid": "9341d2d0174f2c54fb25cab133b26934",
"score": "0.602921",
"text": "def set_reciprocal_to_self?\n false\n end",
"title": ""
},
{
"docid": "981a8ef2a5ce79d19713da94cb3f0334",
"score": "0.6025291",
"text": "def has_associations?\n (!self.pulves.empty? ||\n !self.labours.empty? || \n !self.factures.empty? || \n !self.ventes.empty?)\n end",
"title": ""
},
{
"docid": "bbecb4906dbcb584d65994dabf35a808",
"score": "0.60054314",
"text": "def set_reciprocal_to_self?\n false\n end",
"title": ""
},
{
"docid": "debd6c97900041860d89eea67c5c91d7",
"score": "0.59647334",
"text": "def first?\n self.rel == \"first\"\n end",
"title": ""
},
{
"docid": "e514f39ca8a5bd0bd80c42f9e1b22115",
"score": "0.5941065",
"text": "def belongs_to?\n true\n end",
"title": ""
},
{
"docid": "79ba8f88893064f14a5b58ccfb9d0f90",
"score": "0.59394175",
"text": "def relates_to?(obj)\n self.class.reference_columns_for(obj.class).any? {|col|\n self[col] == obj.id\n }\n end",
"title": ""
},
{
"docid": "960a754f8543f4bc0595355d274de2de",
"score": "0.59387106",
"text": "def association?(object, associations); end",
"title": ""
},
{
"docid": "5efb259fac72b8f28cb6b746a72356ee",
"score": "0.59383786",
"text": "def with_relationships?\n self.fields.any? { |field| field.is_relationship? }\n end",
"title": ""
},
{
"docid": "0aae5b2434c6dcf2cc09ff03be373b68",
"score": "0.59337366",
"text": "def has_one(relation, options = {})\n has :one, relation, options\n end",
"title": ""
},
{
"docid": "dc89dbca153bace95237a28644f941f3",
"score": "0.5918616",
"text": "def cloneable?(ref)\n ref[:type] == :one_to_many || ref[:type] == :one_to_one\n end",
"title": ""
},
{
"docid": "821ab7dbb03d827afcb8b380e9a07061",
"score": "0.59091645",
"text": "def possible_reciprocal_types\n [:one_to_many, :one_to_one]\n end",
"title": ""
},
{
"docid": "905e0517aa1606e4df31aa75e03efab7",
"score": "0.58657205",
"text": "def associated? orthogroup_id, phenotype_id\n self[phenotype_id, orthogroup_id] == 1\n end",
"title": ""
},
{
"docid": "65ff94c97927055e098ff63a3a310e57",
"score": "0.58530337",
"text": "def reciprocal_array?\n true\n end",
"title": ""
},
{
"docid": "a13eb0a9e74eacc3a0e8a7084af55673",
"score": "0.5850628",
"text": "def reciprocal_array?\n true\n end",
"title": ""
},
{
"docid": "bd24abef70de57f00692e6e8bfe29e73",
"score": "0.5844941",
"text": "def is_relationship?\n %w(belongs_to has_many many_to_many).include?(self.type.to_s)\n end",
"title": ""
},
{
"docid": "6d5ee17244e383d71e5fcaa9f19b2f1b",
"score": "0.5831183",
"text": "def has_one(*associations)\n options = associations.extract_options!\n self.associations += associations.map { |a| Associations::HasOneConfig.new(a, options) }\n define_association_methods(associations)\n end",
"title": ""
},
{
"docid": "f0ee182f61ba22805ffbcc0d9a361c00",
"score": "0.58178693",
"text": "def has_one(rel_type)\n\n module_eval(%Q{def #{rel_type}=(value)\n r = Relations::HasN.new(self,'#{rel_type.to_s}')\n r << value\n end}, __FILE__, __LINE__)\n \n module_eval(%Q{def #{rel_type}\n r = Relations::HasN.new(self,'#{rel_type.to_s}')\n r.to_a[0]\n end}, __FILE__, __LINE__)\n relations_info[rel_type] = Relations::RelationInfo.new\n end",
"title": ""
},
{
"docid": "2a4d784d055e6140fe5b8edf8be02051",
"score": "0.57888234",
"text": "def associated?\n @associated\n end",
"title": ""
},
{
"docid": "dc515755a6637502ef12d687fa71e046",
"score": "0.5767807",
"text": "def cache_supported_on_inverse_model?\n inverse_of && inverse_of.belongs_to?\n end",
"title": ""
},
{
"docid": "75c2a6dcf357cde8ef9a671d095de2f5",
"score": "0.57588834",
"text": "def related?\n self.rel == \"related\"\n end",
"title": ""
},
{
"docid": "7bfc68bec44b80f3d50559bfb8f9f4c3",
"score": "0.57494175",
"text": "def reciprocal_array?\n false\n end",
"title": ""
},
{
"docid": "c425ddb942c27f88c897d003be19a61e",
"score": "0.5745934",
"text": "def reciprocal_array?\n false\n end",
"title": ""
},
{
"docid": "7411d4a97491e381786dec81b75be09e",
"score": "0.57415354",
"text": "def is_foreign_key?\n association.present?\n end",
"title": ""
},
{
"docid": "de36514a14c5ebc9a64b0eb06784c841",
"score": "0.57392836",
"text": "def belongs_to?(user)\n return nil if user.nil?\n\n owner == user\n end",
"title": ""
},
{
"docid": "dddb0533bf2b05f78b360c232c3a4824",
"score": "0.5734995",
"text": "def round_associate?\n return false unless associations?\n\n @round_associate ||= @associations.key?(:round)\n end",
"title": ""
},
{
"docid": "1b1528c6ccee46f72a3968f69861060b",
"score": "0.5732896",
"text": "def reciprocal\n return self[:reciprocal] if include?(:reciprocal)\n r_type = reciprocal_type\n key = self[:key]\n associated_class.all_association_reflections.each do |assoc_reflect|\n if assoc_reflect[:type] == r_type && assoc_reflect[:key] == key\n return self[:reciprocal] = assoc_reflect[:name]\n end\n end\n self[:reciprocal] = nil\n end",
"title": ""
},
{
"docid": "a10da0c69df5e933b69e3d502a78a5b8",
"score": "0.57236916",
"text": "def one_candidate?\n @candidates.count == 1\n end",
"title": ""
},
{
"docid": "ef798d695a2abfbc08b665ff771965b3",
"score": "0.5712015",
"text": "def composite?\n relation.is_a?(Relation::Composite)\n end",
"title": ""
},
{
"docid": "9d031ea970234be77f96a649325adeeb",
"score": "0.5708511",
"text": "def null_record?\n self == self.class.null_record\n end",
"title": ""
},
{
"docid": "9d031ea970234be77f96a649325adeeb",
"score": "0.5708511",
"text": "def null_record?\n self == self.class.null_record\n end",
"title": ""
},
{
"docid": "b34acdcf243c486584cb5cc9ff1618bf",
"score": "0.5687359",
"text": "def has_one(association_name)\n add_association(:has_one, association_name.to_s.titleize, association_name)\n end",
"title": ""
},
{
"docid": "67a0a1afaad371c524908015056404b4",
"score": "0.5686326",
"text": "def ambiguous_reciprocal_type?\n true\n end",
"title": ""
},
{
"docid": "dcc91a3d520b50cc628c06802e350025",
"score": "0.5661085",
"text": "def belongs_to?\n\n !!belongs_to_config\n\n end",
"title": ""
},
{
"docid": "15748881501730b35c1ab1f213299b8d",
"score": "0.56608236",
"text": "def in_relationship?(user)\n return true if UserProject.where(user: user, project: self).first\n end",
"title": ""
},
{
"docid": "9e3f1b21090acf2d703ebd1ab43181c4",
"score": "0.5648021",
"text": "def has_one_child\n if self.left_child.nil? && !self.right_child.nil?\n self.right_child\n elsif !self.left_child.nil? && self.right_child.nil?\n self.left_child\n else\n nil\n end\n end",
"title": ""
},
{
"docid": "4a4ed5a284bfa20e43e3766549b27fc4",
"score": "0.563079",
"text": "def one_relationship(name)\n end",
"title": ""
},
{
"docid": "89f1ef3d5594599e7c9fdd2b5b11fb7c",
"score": "0.5609683",
"text": "def only_one_primary_key\n if primary && self.class.where(primary: true).count >= 1\n errors.add(:primary, \"must be false if another primary already exists\")\n end\n end",
"title": ""
},
{
"docid": "3557cc21d8cc324274cb116ed223aa06",
"score": "0.5601769",
"text": "def relational?\n ancestors.include?(Relational)\n end",
"title": ""
},
{
"docid": "e29318e33222a08fda8728afbf9b64a9",
"score": "0.5593994",
"text": "def ambiguous_reciprocal_type?\n false\n end",
"title": ""
},
{
"docid": "97b8e978f39919f51a6b416b1164f184",
"score": "0.55936116",
"text": "def preserve_has_one_associations_to(new_version)\n # Preserve simple has_one reflections\n self.class.reflections.select { |_, reflection|\n reflection.macro == :has_one\n }.each do |key, reflection|\n if !reflection.foreign_key.kind_of?(Array)\n new_version.send(\"#{key}=\", self.send(key))\n end\n end\n end",
"title": ""
},
{
"docid": "5d6afeb6d0a0fed57b6acce38cd3e1a0",
"score": "0.55879694",
"text": "def singular?\n size == 1 && first[1] == 1\n end",
"title": ""
},
{
"docid": "fef427a8230dd41b05022a8af9749e36",
"score": "0.5585134",
"text": "def inside_association?\n # TODO: see if we can memoize\n self.respond_to?(:proxy_owner)\n end",
"title": ""
},
{
"docid": "05e98cbe02515f37a618d8fe1092da78",
"score": "0.55833346",
"text": "def belongs_to?(user)\n return false unless user.instance_of? User\n return self.owner == user\n end",
"title": ""
},
{
"docid": "9161ee5516c61ed6130c24f64f7584c3",
"score": "0.5582937",
"text": "def associations?\n @_associations && @_associations.size > 0\n end",
"title": ""
},
{
"docid": "8d16706aeac12b3b642e76d3330b246c",
"score": "0.55821574",
"text": "def reciprocal\n cached_fetch(:reciprocal) do\n possible_recips = []\n\n associated_class.all_association_reflections.each do |assoc_reflect|\n if reciprocal_association?(assoc_reflect)\n possible_recips << assoc_reflect\n end\n end\n\n if possible_recips.length == 1\n cached_set(:reciprocal_type, possible_recips.first[:type]) if ambiguous_reciprocal_type?\n possible_recips.first[:name]\n end\n end\n end",
"title": ""
},
{
"docid": "9000e9c9dd1be5eab447e0c984f32dd5",
"score": "0.5581352",
"text": "def is_unique\n return true if fact_type.is_a?(LinkFactType) or # Handle objectification roles\n fact_type.all_role.size == 1 # and unary roles\n\n uniqueness_constraint ? true : false\n end",
"title": ""
},
{
"docid": "897169607ba9e714fd905c9796223f07",
"score": "0.557283",
"text": "def has_no_restrict_dependent?\n self.class.reflect_on_all_associations.all? do |assoc|\n ( ([:restrict_with_error, :restrict_with_exception].exclude? assoc.options[:dependent]) ||\n (assoc.macro == :has_one && self.send(assoc.name).nil?) ||\n (assoc.macro == :has_many && self.send(assoc.name).empty?) )\n end\n end",
"title": ""
},
{
"docid": "618f2cb478cc97571b4c1c4ba7861c67",
"score": "0.556784",
"text": "def is_referente?\n return (Convention.all(:conditions => {:user_id => self.id}).count > 0)\n end",
"title": ""
},
{
"docid": "663923cdcd44d5ed16eb9dcbb604991a",
"score": "0.55673134",
"text": "def foreign_key?\n true\n end",
"title": ""
},
{
"docid": "b9df77fc5d4fadd85f3ad8032bbc7a69",
"score": "0.5566055",
"text": "def is_real?\n self.class.count(:conditions=>['id = ?',self.id]) == 1\n end",
"title": ""
},
{
"docid": "c81da31b67e6b648a31081d16f007e5b",
"score": "0.5566028",
"text": "def many_to_one_relationships\n relationships unless @relationships # needs to be initialized!\n @relationships.values.collect do |rels| rels.values end.flatten.select do |relationship| relationship.child_model == self end\n end",
"title": ""
},
{
"docid": "e112012ee69975f9f406a4a8e170fc9f",
"score": "0.55551606",
"text": "def actuale? opt = \"\"\n relation = opt.to_s.tableize\n\n actuale = false\n model.dependent_relations.each do |dependent_relation|\n tmp = self.send dependent_relation\n if relation == dependent_relation\n actuale ||= tmp.all.size > 1\n else\n actuale ||= tmp.exists?\n end\n end\n actuale\n end",
"title": ""
},
{
"docid": "c3eaebc35f1bcc425b7cba75410a3590",
"score": "0.5549341",
"text": "def relation(relation)\n true\n end",
"title": ""
},
{
"docid": "0b0a3f7bf2944b0e4b43b5c3c5270f3c",
"score": "0.55452067",
"text": "def single_record?\n id.present?\n end",
"title": ""
},
{
"docid": "e590cc595b54c011e97e1ad56b0aec99",
"score": "0.55393016",
"text": "def one_to_one(outcome_to_clause)\n outcome_to_clause.each do |_outcome, clause|\n next if outcome_to_one_array?(clause)\n\n return false if RuleEvaluator.tokenize(clause: clause).size > 1\n end\n\n true\n end",
"title": ""
},
{
"docid": "e7bd3334885237103936e7b0e821475a",
"score": "0.55365205",
"text": "def unary?\n # N.B. A role with a forward reference looks unary until it is resolved.\n @fact_type.all_role.size == 1\n end",
"title": ""
},
{
"docid": "f00efbb9eeb36a436188af208ab92fda",
"score": "0.5529507",
"text": "def same?\n similarities.size == 1 && similarities.first.distance.zero? # The same\n end",
"title": ""
},
{
"docid": "fe189319bcde035968e16caa63698a0c",
"score": "0.55242896",
"text": "def has_one(direction, name, options = {}) # rubocop:disable Style/PredicateName\n name = name.to_sym\n build_association(:has_one, direction, name, options)\n\n define_has_one_methods(name)\n end",
"title": ""
},
{
"docid": "70b0934b360f20284d791866baaa250d",
"score": "0.5519896",
"text": "def atomic?\n puts \"composition is #{self}\" if SY::DEBUG\n puts \"first[0].dimension is #{first[0].dimension}\" if SY::DEBUG\n singular? && first[0].dimension.base?\n end",
"title": ""
},
{
"docid": "0a4b715fca93ef7063273e989918c2dd",
"score": "0.5517699",
"text": "def tracked_embeds_one?(relation)\n tracked_embeds_one.include?(database_field_name(relation))\n end",
"title": ""
},
{
"docid": "12195fc1edd331c1a13f5a693a4f07bb",
"score": "0.5503694",
"text": "def self_referential?\n r = false\n @rules.each do |rule|\n rule.each do |elem|\n if elem == @name\n r = true\n else\n k = @klass.defs.find_all{|i| i.name == elem}[0]\n if k && k.terminal?\n r = true\n else\n return false \n end\n end\n end\n end\n r\n end",
"title": ""
},
{
"docid": "91a257fbae6619b4081dcc6f3e9def62",
"score": "0.5502253",
"text": "def multiple? #nodoc\n @options[:association] == :has_many || @options[:association] == :has_and_belongs\n end",
"title": ""
},
{
"docid": "79f1aa8e96e9012de73e28ebb9b0f7b1",
"score": "0.54998803",
"text": "def exist?\n Neo4j::Relationship.exist?(self)\n end",
"title": ""
},
{
"docid": "e6f80cdab51c8262954b7367c62fc71d",
"score": "0.549669",
"text": "def has_one(direction, name, options = {}) # rubocop:disable Naming/PredicateName\n name = name.to_sym\n build_association(:has_one, direction, name, options)\n\n define_has_one_methods(name, options)\n end",
"title": ""
},
{
"docid": "21aef3d39d45d1ad4a901767c2639e2e",
"score": "0.5488215",
"text": "def has_one(name, scope = nil, **options)\n # args = options.except(:null_object)\n\n # Call the real belongs_to so that the association gets defined.\n super(name, scope, **options.except(:null_object))\n\n # Modify the association if need be.\n if options[:null_object]\n add_null_object_support(name, options)\n end\n end",
"title": ""
}
] |
32889738a7dd42d0ac7d88e6c05a6947
|
TODO: filter included items by display?
|
[
{
"docid": "7528791f6a992c76a37d32a908dbe5bc",
"score": "0.0",
"text": "def marshal_dump # :nodoc:\n attrs = attributes.sort.map do |attr|\n next unless attr.display?\n [ attr.name, attr.rw,\n attr.visibility, attr.singleton, attr.file_name,\n ]\n end.compact\n\n method_types = methods_by_type.map do |type, visibilities|\n visibilities = visibilities.map do |visibility, methods|\n method_names = methods.map do |method|\n next unless method.display?\n [method.name, method.file_name]\n end.compact\n\n [visibility, method_names.uniq]\n end\n\n [type, visibilities]\n end\n\n [ MARSHAL_VERSION,\n @name,\n full_name,\n @superclass,\n parse(@comment_location),\n attrs,\n constants.select { |constant| constant.display? },\n includes.map do |incl|\n next unless incl.display?\n [incl.name, parse(incl.comment), incl.file_name]\n end.compact,\n method_types,\n extends.map do |ext|\n next unless ext.display?\n [ext.name, parse(ext.comment), ext.file_name]\n end.compact,\n @sections.values,\n @in_files.map do |tl|\n tl.relative_name\n end,\n parent.full_name,\n parent.class,\n ]\n end",
"title": ""
}
] |
[
{
"docid": "fcc723fc73ab31a3fa5af7aded69ce07",
"score": "0.68828523",
"text": "def displayable_items(items)\n items.select do |item|\n display_item? item\n end.sort { |i1, i2| priority_for(i1) <=> priority_for(i2) }\n end",
"title": ""
},
{
"docid": "a7dd7e4969f54dc3656ae39d21d3500b",
"score": "0.6647232",
"text": "def show\n @include_order_items = true\n end",
"title": ""
},
{
"docid": "944924ccf965e801648e3eefff0817e2",
"score": "0.66421545",
"text": "def render_items(items)\n @list.items = case @footer.filters.selected.value\n when :active\n items.reject { |item| item[:done] }\n when :completed\n items.select { |item| item[:done] }\n else\n items\n end.sort_by { |item| item[:text] }\n end",
"title": ""
},
{
"docid": "a75e20fce1d20c181809e1bdf6bcbbbc",
"score": "0.64118963",
"text": "def show\n @line_items = @list.line_items.includes(:item)\n\n my_items = current_user.items.order(name: :asc)\n other_items = Item.where(\"user_id <> ? OR user_id IS NULL\", current_user.id).order(name: :asc)\n @items = my_items | other_items\n end",
"title": ""
},
{
"docid": "933b901cb94cdf179a32a3a2389c6a39",
"score": "0.6358485",
"text": "def show\n get_activity\n @items = (@my_precontent + @precontent).flatten.uniq.sort {|a,b| b.published_at.to_i <=> a.published_at.to_i}[0..19]\n end",
"title": ""
},
{
"docid": "11886c1bfa5d89c357ebb9a541c1cca8",
"score": "0.6345996",
"text": "def found_show_all\n showing_all_items?\n end",
"title": ""
},
{
"docid": "76f106c52648d96396a490e5809eeb4a",
"score": "0.61642283",
"text": "def display\n \t@items= Item.sorted\n end",
"title": ""
},
{
"docid": "d1b29dbaf19b12a7330c593ef60bc89e",
"score": "0.6115754",
"text": "def filtered_entries; end",
"title": ""
},
{
"docid": "921b5a8fe06afacffd14cafe07de7f71",
"score": "0.6034924",
"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 @recently_visited_collections = Collection.find_all_by_id(recently_visited_collections(@collection.id)) if @collection\n end",
"title": ""
},
{
"docid": "905d3ea27ffeda93895e09a11550fbbf",
"score": "0.59631634",
"text": "def show_includes\n preview_includes\n end",
"title": ""
},
{
"docid": "fa5ef2b195fdd96d071862965f050d7c",
"score": "0.58968514",
"text": "def index\n @item_not_includeds = ItemNotIncluded.all\n end",
"title": ""
},
{
"docid": "bf26aa34a79170097901f23d2c2e86d6",
"score": "0.58927095",
"text": "def section_filter citems\n filtered_citems = citems.map do |citem|\n citem.section == @section && !citem.hidden? ? citem : nil\n end\n filtered_citems.compact\n end",
"title": ""
},
{
"docid": "c40d393898ed8345a915e31dc9bf5f6d",
"score": "0.588846",
"text": "def show\n @field_values = CategoryFieldValue.joins(:category_field).where(item_id: @item.id, category_fields: { category_id: @item.category_id }).all.select{ |fv| !fv.category_field.nil? }\n\n @available_subitems = @item.subitems_for_category \n\n end",
"title": ""
},
{
"docid": "541ec213f7468a9a0fc1582975d52e6f",
"score": "0.5850597",
"text": "def show_qualified\n pp ordered_by_qualifications\nend",
"title": ""
},
{
"docid": "25e46fad8aac09d353625eabf280de5d",
"score": "0.58471864",
"text": "def get_items_with dish\n @menu_items.select {|item| item.has? dish}\n end",
"title": ""
},
{
"docid": "c85bb694681d5ffe135d5678e71dfcf3",
"score": "0.5833848",
"text": "def _filter_display\n @apotomo_emit_raw_view = true\n render :view => '_filters'\n end",
"title": ""
},
{
"docid": "cbe40d00f76c5445a27359a410b23c4f",
"score": "0.57997024",
"text": "def includes() return @includes end",
"title": ""
},
{
"docid": "d8dad94c41d2e17d84e7ab455a15ef80",
"score": "0.57982475",
"text": "def include item\n\tend",
"title": ""
},
{
"docid": "2fa577e201e8c5b8c9ab29a4e6be5a84",
"score": "0.5777558",
"text": "def list_items_preview\n end",
"title": ""
},
{
"docid": "6f4b7295ab15b9d4419b997aa6500c77",
"score": "0.5772301",
"text": "def activity_filter(activities_object, *dont_include)\n dont_include = [dont_include] unless dont_include.is_a?(Array)\n activity_types = Activity.where(:id => activities_object.id).select(\"DISTINCT(template)\")\n #activity_types = activities_object.activities.select(\"DISTINCT(activities.template)\")\n filter_types = activity_types.find_all {|activity| !dont_include.include?(activity.template)}\n render :partial => 'activities/template_filter', :locals => { :activity_types => filter_types, :dont_include => dont_include }\n end",
"title": ""
},
{
"docid": "df11787dcc51d381626d6ffde56144da",
"score": "0.57661384",
"text": "def show_filter\n perm_links = ministry.lmi_show.map { |lmi| \"lmi_total_custom_#{lmi}\" }\n table[:perm_link].in(perm_links)\n end",
"title": ""
},
{
"docid": "872d6db6fe5acc82efdd75a3d709de39",
"score": "0.5765381",
"text": "def show\n @item_group= Vger::Resources::Suitability::ItemGroup.find(params[:id], :include => [ :items ])\n respond_to do |format|\n format.html\n end\n end",
"title": ""
},
{
"docid": "87a88fdeeba4be9d60ae726370a1f97a",
"score": "0.5723315",
"text": "def show_list\n process_show_list\n end",
"title": ""
},
{
"docid": "f637b04859f2a9da66f902aac89178f9",
"score": "0.5707356",
"text": "def show\n @category = Category.find(params[:category_id])\n @item = @category.items.find(params[:id])\n @includes = @item.ingredients.all.sort_by{ |k| k[\"name\"] }\n @ingredients = Ingredient.all.sort_by{ |k| k[\"name\"] }\n\n\n # used for includes#create\n @include = @item.includes.new\n # used for orders#create\n @order = Order.new\n end",
"title": ""
},
{
"docid": "17c3c212c8c87e40ffe15fad5b97aef4",
"score": "0.5692645",
"text": "def containments\n item.containments\n end",
"title": ""
},
{
"docid": "64513264a28a9cc37d5ff7e25723b9b3",
"score": "0.5691616",
"text": "def all_items( hidden = false )\r\n\t\t\tresults = []\r\n\t\t\[email protected] do\r\n\t\t\t\t|item|\r\n\t\t\t\tif ( item.hidden == true && hidden == true ) || ( item.hidden == false )\r\n\t\t\t\t\tresults << item.description \r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\treturn results\r\n\t\tend",
"title": ""
},
{
"docid": "3147993ac8f097b41db94ba6abfed27d",
"score": "0.568139",
"text": "def show\n dummy_item\n end",
"title": ""
},
{
"docid": "ef24e415882a4afade7f114f9e64aca5",
"score": "0.5649719",
"text": "def filter_items\n @filter_items ||= []\n end",
"title": ""
},
{
"docid": "8360302086bc84d11c4d9a119430922b",
"score": "0.56239367",
"text": "def index\n set_meta_tags title: \"#{@place.is_restaurant? ? \"Categorías\" : \"Departamentos\"} | #{@place.name}\",\n description: \"#{@place.is_restaurant? ? \"Categorías\" : \"Departamentos\"} | #{@place.name}\"\n @items = @place.items.includes(:recent_products).select { |item| item.recent_products.length > 0 }\n end",
"title": ""
},
{
"docid": "c4ea928809861cafaa8ad0bf20bbadcf",
"score": "0.5616698",
"text": "def show_all?\n return true if !@filter || [email protected]?(\"show_all\")\n return @filter[\"show_all\"]\n end",
"title": ""
},
{
"docid": "955f84b1847b15c2217ba9d5d29171e4",
"score": "0.56149304",
"text": "def show\n @items = Item.all\n end",
"title": ""
},
{
"docid": "7601efc48f7f7757de9402bccfa27ae7",
"score": "0.56042093",
"text": "def include?(item)\n end",
"title": ""
},
{
"docid": "12703ba719ad64305e5751d42d15ce5f",
"score": "0.559531",
"text": "def filter\n list.children.each do |item|\n item.toggle_class :hidden, !(item.value =~ Regexp.new(@input.value, 'i'))\n end\n end",
"title": ""
},
{
"docid": "255d18245f542f51e271dc75c2e8d3c9",
"score": "0.5572293",
"text": "def filters; end",
"title": ""
},
{
"docid": "255d18245f542f51e271dc75c2e8d3c9",
"score": "0.5572293",
"text": "def filters; end",
"title": ""
},
{
"docid": "f01adb808c21d0eb2b3f7e18fcb58800",
"score": "0.55691385",
"text": "def get_item_display(item, key)\n # raise\n # Accept a \"browse item\" structure, or a plain old SolrDocument\n item_display = if item.key? :item_display\n item[:item_display]\n else\n item[:doc][:item_display]\n end\n match = ''\n return nil if key.nil? || key.length.zero?\n [item_display].flatten.each do |item_disp|\n return item_disp if item_disp.downcase.include? key.downcase\n # raise\n # match = item_disp if item_disp =~ /#{CGI::escape(key)}/i\n # # marquis - add this match...\n # match = item_disp if item_disp =~ /#{key}/i\n end\n return match unless match == ''\n end",
"title": ""
},
{
"docid": "f98793bba11aad365cd3fbc0e9b831a7",
"score": "0.5553817",
"text": "def filter(type)\n print_items @items.select { |item| item.type.casecmp(type).zero? }\n end",
"title": ""
},
{
"docid": "2b6f4f29b973f1a9853eab0ead9a0c4a",
"score": "0.55494606",
"text": "def show\n @article = Article.find(params[:id])\n\n @related = Article.visible.where(press_release: 0).sorted.limit(5)\n @related.reject!{|x| x == @article }\n\n if I18n.locale == :en\n @related.reject!{|x| x.title_en.to_s.strip.length == 0 }\n else\n @related.reject!{|x| x.title_no.to_s.strip.length == 0 }\n end\n end",
"title": ""
},
{
"docid": "3f2f0f63e670d3a43c32e24ea7f89de9",
"score": "0.55479383",
"text": "def embeddables\n self.page_items.collect{|qi| qi.embeddable}\n end",
"title": ""
},
{
"docid": "a146bee458ef486a88d4e006bcdd25ab",
"score": "0.55475056",
"text": "def sellable_items\n all_items.select { |item| item.traddable? }\n end",
"title": ""
},
{
"docid": "afd77f4bc331044ae6ae13a35e924ce4",
"score": "0.5546775",
"text": "def show\n @show = Show.find(params[:id])\n @products = @show.products.active.uniq\n @characters = @show.characters.active\n @outfits = @show.outfits.approved.uniq\n end",
"title": ""
},
{
"docid": "41bd04094f1abcc42172f5ecc321b814",
"score": "0.5541435",
"text": "def include?(item)\n return true\n end",
"title": ""
},
{
"docid": "4da22d98002d86cefc2aab48b25a5fa2",
"score": "0.55410475",
"text": "def preview_includes\n []\n end",
"title": ""
},
{
"docid": "f8443631764c6e988e5fab3d293e9ca4",
"score": "0.5527478",
"text": "def includes\n end",
"title": ""
},
{
"docid": "f8443631764c6e988e5fab3d293e9ca4",
"score": "0.5527478",
"text": "def includes\n end",
"title": ""
},
{
"docid": "c0f81a36ea76177a236ef9fa9d6c99d6",
"score": "0.55250907",
"text": "def displayable_in_public_list?\n return true if human_readable?\n\n return true if filterable?\n end",
"title": ""
},
{
"docid": "c54854fa4581ef1f32e32372633b614f",
"score": "0.55132353",
"text": "def show\n @display_all = (params[:display] == \"all\")\n end",
"title": ""
},
{
"docid": "56091dec93e137caea115dac0b44184a",
"score": "0.5505313",
"text": "def items\n authors\n end",
"title": ""
},
{
"docid": "1e8e1dca9445e944e992149c234f8587",
"score": "0.54988253",
"text": "def index\n @working_specific_small_items = WorkingSpecificSmallItem.all\n end",
"title": ""
},
{
"docid": "6564d6d50103f130f7040ef3df1ddd82",
"score": "0.5489575",
"text": "def show\n # will have template\n @album = Album.find_by(id: params[:id])\n @category = Category.find_by(id: @album.category_id).name\n @shuffled_album = Album.all.where(category_id: @album.category_id).shuffle\n\n\n @album_items = Album.find_by(id: params[:id]).items\n\n @tops = @album_items.where(item_class:\"Tops\")\n @bottoms = @album_items.where(item_class:\"Bottoms\")\n @doodads = @album_items.where(item_class:\"Doodads\")\n end",
"title": ""
},
{
"docid": "70a569b92b2f0091ec614b89d2b35e68",
"score": "0.54893786",
"text": "def filter!\n list_items(doc).reverse.each do |li|\n next if list_items(li.parent).empty?\n\n add_css_class(li.parent, 'task-list')\n\n outer, inner =\n if p = li.xpath(ItemParaSelector)[0]\n [p, p.inner_html]\n else\n [li, li.inner_html]\n end\n if match = (inner.chomp =~ ItemPattern && $1)\n item = TaskList::Item.new(match, inner)\n # prepend because we're iterating in reverse\n task_list_items.unshift item\n\n add_css_class(li, 'task-list-item')\n outer.inner_html = render_task_list_item(item)\n end\n end\n end",
"title": ""
},
{
"docid": "0710ed91aeec7cb6e7432dd4dd3f1a05",
"score": "0.54828006",
"text": "def show\n set_meta_tags title: \"#{@item.name} | #{@place.is_restaurant? ? \"Categorías\" : \"Departamentos\"} #{@place.name}\",\n description: \"#{@item.name} | #{@place.is_restaurant? ? \"Categorías\" : \"Departamentos\"} #{@place.name}\"\n @products = @place.products.where(:item_ids.in => [@item.id]).paginate(page: params[:page], per_page: 30)\n end",
"title": ""
},
{
"docid": "470a95c7cc1c334490804d4e5c76b565",
"score": "0.5480932",
"text": "def item_results\n set_item_results_ivars\n render partial: \"items/listing\"\n end",
"title": ""
},
{
"docid": "00a33922cb3baeb2274096777c7c68a6",
"score": "0.5478409",
"text": "def items\n @entries = Item.includes(:outlet, :item_group, :item_sub_group, :item_groups_kot_print, :bill_group).where(\"location_id=? #{@outlet_query}\", params[:location_id].to_i).paginate(:page => params[:page]) if request.xhr? \n end",
"title": ""
},
{
"docid": "ac918ae3517871178c5ef5dde5d85e02",
"score": "0.54774195",
"text": "def items_list\n #return self.donor.donor_items.reject{|it| it.done?}.map{|it| \" #{it.andand.item.andand.item_code} [#{it.number_donated}] \" << (it.comments.blank? ? \"\" : \"(#{it.comments}) \")}.join(\"<b>/</b>\") if (self.pickup_or_delivery == PICKUP) && self.donor\n if (self.pickup_or_delivery == PICKUP)\n the_pickup = (self.donor_pickup ? self.donor_pickup : self.donor.andand.donor_pickups.andand.first)\n return '' unless the_pickup\n \n return \"\" unless self.daily_worksheet.andand.worksheet_date\n \n # show items we've already picked up, if the current date is newer than the date of this \"DailyDelivery\"\n # TODO: make sure this date comparison works properly\n items_to_show = ((Time.now.beginning_of_day > Time.parse(self.daily_worksheet.worksheet_date.to_s)) ? the_pickup.pickedup_items_list : the_pickup.offered_items_list)\n return items_to_show\n #return items_to_show.reject{|it| it.done?}.map{|it| \" #{it.andand.item.andand.item_code} [#{it.number_offered}] \" << (it.comments.blank? ? \"\" : \"(#{it.comments}) \")}.join(\"<b>/</b>\")\n elsif ((self.pickup_or_delivery == DELIVERY) and self.delivery)\n # was delivered_items.reject{|it| it.done?}\n return self.delivery.delivered_items.still_to_deliver.ordered_by_item_category.map{|it| \" #{it.andand.item.andand.item_code} [#{it.number_requested}] \" << (it.comments.blank? ? \"\" : \"(#{it.comments}) \")}.join(\"<b>/</b>\")\n end\n end",
"title": ""
},
{
"docid": "afb312534889b13bd631d0e12fff7409",
"score": "0.5476373",
"text": "def group_items\n @group_items ||= Product.includes(:pictures)\n .where(group: group.presence || '_ZZZZ_', active: true, hidden: false)\n .order(:option_sort, :option_title)\n end",
"title": ""
},
{
"docid": "e6a5c475ddc4acb59da91f998a724990",
"score": "0.54719496",
"text": "def show\n @item = Item.find_by_id( params[:id] )\n @items_like_mine = @item.find_items_like_mine \n end",
"title": ""
},
{
"docid": "9d1293657a57ff588297404c2a38e00b",
"score": "0.5467846",
"text": "def index\n @wanted_items = WantedItem.all\n end",
"title": ""
},
{
"docid": "54444ac92562be31c5932ea645ca4346",
"score": "0.5460857",
"text": "def filters\n end",
"title": ""
},
{
"docid": "c87d5afb92c35c99924980208ed2e9f8",
"score": "0.54505545",
"text": "def only_blogs items\n only_ items, :blog\nend",
"title": ""
},
{
"docid": "a6c5cf8a0bd910af463f8a2258f5b731",
"score": "0.5443628",
"text": "def filter\n end",
"title": ""
},
{
"docid": "713bc6e97770b2679ea2bd8047724c74",
"score": "0.54384726",
"text": "def show\n @showings = @client.showings.includes(listing: :pictures)\n @showings = @showings.order(\"listings.\" + params[:order]) if params[:order]\n @showings = @showings.where('showings.compare' => true).paginate(:page => params[:page], :per_page => 3) if (params[:view] == \"compare\")\n @showings = @showings.paginate(:page => params[:page], :per_page => 21) if (params[:view] == \"all\")\n \n @dashboard_listing_set = dashboard_listing_set(@showings, @client) unless params[:view]\n end",
"title": ""
},
{
"docid": "596ae8ea7f998f7300ccda0c634809e9",
"score": "0.5434209",
"text": "def filter\n regexp = Regexp.new(@input.value.to_s, 'i')\n list.children.each do |item|\n item.toggle_class :hidden, !(item.label =~ regexp)\n end\n end",
"title": ""
},
{
"docid": "801c3a339b7b7feebc83c9ee881c0cff",
"score": "0.5431789",
"text": "def items\n load_selection\n import_selection or render_select\n end",
"title": ""
},
{
"docid": "f79a1120eaffd5d2b945cdce83718c57",
"score": "0.54217374",
"text": "def unfiltered_content; end",
"title": ""
},
{
"docid": "f79a1120eaffd5d2b945cdce83718c57",
"score": "0.54217374",
"text": "def unfiltered_content; end",
"title": ""
},
{
"docid": "f79a1120eaffd5d2b945cdce83718c57",
"score": "0.54217374",
"text": "def unfiltered_content; end",
"title": ""
},
{
"docid": "8aa3ab025829b2d7c781e21ed3827aba",
"score": "0.5417015",
"text": "def displaceable_items\n return [] unless fund_item && fund_request\n# fund_item.siblings.\n# select { |i| fund_request.fund_editions.map(&:fund_item).include? i }\n fund_item.siblings.where { |i| i.id.in fund_request.fund_editions.scoped.select { fund_item_id } }\n end",
"title": ""
},
{
"docid": "65b8da26b179d20e2ede46de075bd0df",
"score": "0.54131776",
"text": "def items\r\n unless params[:tags].blank?\r\n if params[:type] === 'intersect'\r\n @items = Item.joins(:tags).where(tags: {id: params[:tags]}).group('items.id').having(\"count(tags.id) = #{ params[:tags].count }\").order(:name)\r\n else # 'union'\r\n @items = Item.joins(:tags).where(tags: {id: params[:tags]}).order(:name)\r\n end\r\n end\r\n end",
"title": ""
},
{
"docid": "08576049c9e70de63bcf5254aa5513c0",
"score": "0.5404869",
"text": "def filter type\n if type_allowed?(type.downcase) # Downcase the filter type and check if it's allowed (exists in lists)\n list_type = @@list_types[type.downcase.to_sym]\n @items.select { |item| item.is_a? list_type }\n # Set the title equal to the filter and output the\n # Header and items (as long as there are items to put)\n @title = \"Filtered by: \" + type.capitalize\n puts header\n puts output_for items if items\n else\n raise InvalidFilter, \"Invalid Filter: #{filter}\"\n end\n end",
"title": ""
},
{
"docid": "4205080a472dde389eea69c43df55168",
"score": "0.5400349",
"text": "def list(items, params={})\n if params[:filter].present?\n items = items.select { |i| i.imported? == (params[:filter] == \"imported\" ? true : false) }\n end\n \n items.sort_by { |p| p.sorter }.reverse.paginate(page: params[:page], per_page: resource_class.list_per_page)\n end",
"title": ""
},
{
"docid": "aa4cbd3bda0274f73f2628e9e6c7bf47",
"score": "0.5394135",
"text": "def index\n @inclusions = Product.ordered.map(&:inclusions).flatten\n end",
"title": ""
},
{
"docid": "4046f4fb75f3c918c5acca7c19838029",
"score": "0.5394135",
"text": "def show\n @item = Item.find(params[:id])\n @item_images = @item.item_images.includes(:item)\n end",
"title": ""
},
{
"docid": "77015b5eb7005d90eca5ac67431e1e8c",
"score": "0.5392695",
"text": "def includes item\n msg = \"#{self} did not include #{item}\"\n check_if self.include?(item), msg\n end",
"title": ""
},
{
"docid": "e95deffd04d0f356a962b4d190ed7136",
"score": "0.53836733",
"text": "def list\n @show.uniq - @blacklist\n end",
"title": ""
},
{
"docid": "87e03a21aaf6e89dbcd4f3b74228bc08",
"score": "0.53831995",
"text": "def index\n @items = Item.includes(:category).with_attached_cover.with_filter(params[:sort])\n @items = @items.search(params[:query]) if params[:query].present?\n @items = @items.page(params[:page]).per(24)\n\n authorize @items\n end",
"title": ""
},
{
"docid": "c6e6eda64e6f761e9624129ab08b49a1",
"score": "0.53670913",
"text": "def get_items\r\n @list\r\n end",
"title": ""
},
{
"docid": "de807398e0e171959961393cbc954191",
"score": "0.53669655",
"text": "def show\n barcodes = params[:barcodes] == \"true\"\n @categorized_items = Item.includes(:category => :limit_category)\n .preferred\n .sort_by(&:description) # sort the items\n .group_by(&:category_descriptor)\n\n respond_to do |format|\n format.html\n if barcodes\n format.docx { render :docx => \"sku_list_barcodes\", :template => \"sku_lists/sku_list_barcodes\", :formats => [:xml], :handlers => [:builder] }\n else\n format.docx { render :docx => \"sku_list\"} # renders show.docx.builder\n end\n end\n end",
"title": ""
},
{
"docid": "897d4f4b98de90306a30ba0172b62a77",
"score": "0.536302",
"text": "def show_list\n\t\t\t@my_list.show\n\t\tend",
"title": ""
},
{
"docid": "38fefcb2ac07e5d957e5d9b0d10ccecc",
"score": "0.53583807",
"text": "def view_items_in_tab\n resource_type = params[:resource_type]\n resource_ids = (params[:resource_ids] || []).split(',')\n render :update do |page|\n if !resource_type.blank?\n clazz = resource_type.constantize\n resources = clazz.find_all_by_id(resource_ids)\n if clazz.respond_to?(:authorized_partial_asset_collection)\n resources = clazz.authorized_partial_asset_collection(resources,\"view\")\n else\n resources = resources.select &:can_view?\n end\n\n page.replace_html \"#{resource_type}_list_items_container\",\n :partial => \"assets/resource_list\",\n :locals => {:collection => resources,\n :narrow_view => true,\n :authorization_for_showing_already_done => true,\n :actions_partial_disable=>false}\n page.visual_effect :toggle_blind, \"view_#{resource_type}s\", :duration => 0.05\n page.visual_effect :toggle_blind, \"view_#{resource_type}s_and_extra\", :duration => 0.05\n end\n end\n end",
"title": ""
},
{
"docid": "35e8e6019f6ff3f80df4abcf97e1ce45",
"score": "0.53449535",
"text": "def show\n @available_group_items = []\n @unavailable_group_items = []\n @group.users.includes(:items).each do |user|\n if user != current_user && user.group_membership(@group).state != \"pending\"\n @available_group_items = @available_group_items + user.items.where(:state => \"available\")\n @unavailable_group_items = @unavailable_group_items + user.items.where.not(:state => \"available\")\n end \n end\n @members = @group.memberships.where.not(:state => \"pending\")\n @pending = @group.memberships.where(:state => \"pending\")\n end",
"title": ""
},
{
"docid": "e224719a3404eaa5e48893bff69d9f5b",
"score": "0.53444344",
"text": "def fetch_all_active_items\n @items.values.select{|item| item.active}\n end",
"title": ""
},
{
"docid": "d8889393481377259b6312b63d07e944",
"score": "0.53433925",
"text": "def includes_for_sorting\n []\n end",
"title": ""
},
{
"docid": "4891a220b6b337c7776a4722ef757076",
"score": "0.5341245",
"text": "def index\n @item_collections = ItemCollection.where('is_private=false')\n if !params[:search].nil? || params[:search] == ''\n t = ItemCollection.arel_table\n @item_collections = ItemCollection.where(t[:name].matches(\"%#{params[:search]}%\").and(t[:is_private].eq(false)))\n #@item_collections = ItemCollection.where('name LIKE ? AND is_private=false', \"%#{params[:search]}%\")\n end\n end",
"title": ""
},
{
"docid": "e6669c9b5d499d90c69e6f2678b0313e",
"score": "0.5339377",
"text": "def list_items_to_sell\r\n list = \"\"\r\n items.each{ |item|\r\n if item.active == true\r\n list = list + item.name + \"\\n\"\r\n end}\r\n list\r\n end",
"title": ""
},
{
"docid": "0e5adf8e163a9bf8e089cad9848e0ef1",
"score": "0.5338959",
"text": "def show\n @items = Item.where(brand_id: params[:id]).page(params[:page]).per(20).order(\"id DESC\")\n end",
"title": ""
},
{
"docid": "781d596b05f571228b2c1271beaa498b",
"score": "0.5335673",
"text": "def show\n @items.to_s\n end",
"title": ""
},
{
"docid": "3441d66f3004b52d61767e5b1da151ab",
"score": "0.53333724",
"text": "def get_active_items\r\n self.items.select { |i| i.active? } #TODO only fixed or only auction\r\n end",
"title": ""
},
{
"docid": "a6bee04f7747691dc84bf874186301e9",
"score": "0.5333372",
"text": "def show\n\n # when is not filter(all filter blank, it should get all the items\n if params[:item_color].blank? && params[:item_brand].blank?&& params[:item_style].blank?&¶ms[:item_make].blank?\n @items_designs = ItemsDesign.where(\"item_id = ?\",params[:id]).order(:updated_at)\n else\n\n unless params[:item_color].blank?\n @items_designs = ItemsDesign.where(\"item_id = ?\",params[:id])\n .where('lower(color) = ?',params[:item_color])\n .order(:updated_at)\n end\n unless params[:item_brand].blank?\n @items_designs = ItemsDesign.where(\"item_id = ?\",params[:id])\n .where('lower(brand) = ?',params[:item_brand])\n .order(:updated_at)\n end\n unless params[:item_style].blank?\n @items_designs = ItemsDesign.where(\"item_id = ?\",params[:id])\n .where('lower(style) = ?',params[:item_style])\n .order(:updated_at)\n end\n unless params[:item_make].blank?\n @items_designs = ItemsDesign.where(\"item_id = ?\",params[:id])\n .where('lower(make) = ?',params[:item_make])\n .order(:updated_at)\n end\n\n end\n\n if @items_designs.length < 3\n @item_length = @items_designs.length\n else\n @item_length = 3\n end\n\n @items_by_type = Item.order(:id).all\n @items_designs_by_color = ItemsDesign.select(\"lower(color) as color,max(item_id) as item_id\").where(\"item_id = ?\",params[:id]).group(\"lower(color)\").order(:color)\n @items_designs_by_brand = ItemsDesign.select(\"lower(brand) as brand,max(item_id) as item_id\").where(\"item_id = ?\",params[:id]).group(\"lower(brand)\").order(:brand)\n @items_designs_by_style = ItemsDesign.select(\"lower(style) as style,max(item_id) as item_id\").where(\"item_id = ?\",params[:id]).group(\"lower(style)\").order(:style)\n @items_designs_by_make = ItemsDesign.select(\"lower(make) as make,max(item_id) as item_id\").where(\"item_id = ?\",params[:id]).group(\"lower(make)\").order(:make)\n\n\n #set_meta_tags :og =>{\n # :image => 'http://ia.media-imdb.com/rock.jpg'\n #}\n #set_meta_tags :title => 'Member Login'\n #set_meta_tags :og => {\n # :title => 'The Rock',\n # :type => 'video.movie',\n # :url => 'http://www.imdb.com/title/tt0117500/',\n # :image => 'http://ia.media-imdb.com/rock.jpg',\n # :video => {\n # :director => 'http://www.imdb.com/name/nm0000881/',\n # :writer => ['http://www.imdb.com/name/nm0918711/', 'http://www.imdb.com/name/nm0177018/']\n # }\n\n\n respond_to do |format|\n format.html # show.html.erb\n\n end\n end",
"title": ""
},
{
"docid": "38775fd9ba797eb30963b960488ad399",
"score": "0.5333053",
"text": "def get_displayable\n klass = params[:class].constantize\n \n if valid_classes.include? klass\n #TODO: Only get local items: active_character.area.items.find(params[:id])\n displayable = klass.find(params[:id]);\n render :partial => 'game/displayable_content', :locals => {:displayable => displayable}\n else\n render :text => 'Invalid Class', :status => 403\n end\n end",
"title": ""
},
{
"docid": "d902e9a4366309c0ebc7a54bd19fc2b9",
"score": "0.53310686",
"text": "def shows()\n Show.all().select() { | show | show.characters().include?(self) }\n end",
"title": ""
},
{
"docid": "104d847707408037ad6110cb23ade683",
"score": "0.5327493",
"text": "def index\n @load = Item.includes(:user, thumbnail_attachment: :blob)\n @items = []\n for item in @load\n if item.active == true\n @items << item\n end\n end\n end",
"title": ""
},
{
"docid": "f663d262c23665dfb34d4368bcc9ed36",
"score": "0.5327177",
"text": "def include_item(identifier)\n if item = lookup_item(identifier)\n item.compiled_content\n end\nend",
"title": ""
},
{
"docid": "cd7dc0d3aae5cf4df2785aaf57023212",
"score": "0.5325938",
"text": "def show\n if [email protected] && [email protected]_category && [email protected]_designer\n redirect_to category_path(@item.category_list.last, archive_item: @item.filemaker_id)\n else\n # @item_images = @item.images.show_list.order('image_type')\n @item_images = @item.images.detail_images.order('position')\n # impressionist(@item, \"item detail\")\n end\n end",
"title": ""
},
{
"docid": "7305ce6ee72553a1b59bf37feb907cd2",
"score": "0.5324524",
"text": "def on_the_big_screen\n movie_list = Movie.list_movies\n Show.all.select { |show| movie_list.include?(show.name) }\n end",
"title": ""
},
{
"docid": "f1308b7a9a5bfc70af4a986358386ec0",
"score": "0.53205806",
"text": "def index\n @items = Item.includes(:user).where(availability: TRUE)\n end",
"title": ""
},
{
"docid": "04f348ca2891b7d58702a8652946a76d",
"score": "0.53174466",
"text": "def filter_by_group(group)\n self.get_venues_for_search\n @venues_for_search.each do |venue|\n venue['attributes']['groups'].each do |groups|\n if groups[\"name\"].downcase == group.downcase\n groups[\"items\"].each do |item|\n if item[\"displayValue\"].split(\" \").first != \"No\"\n @venues_by_group << venue[\"name\"]\n end\n end\n end\n end \n end\n @venues_by_group\n end",
"title": ""
},
{
"docid": "a138f8bcee31a97b434901d1e32e98b3",
"score": "0.5307007",
"text": "def filtered_items\n @filtered_items ||= coverage_items.select do |item|\n (include_item_prefix?(item) || include_target_prefix?(item)) && !item.name.include?(\"$\")\n end\n end",
"title": ""
},
{
"docid": "ed4c92474604e10f51b3eb5d63f09cc6",
"score": "0.5304699",
"text": "def _non_summary_list(list)\n list_for_display = []\n list.each do |item|\n list_for_display += [item.to_hash]\n end\n\n list_for_display\n end",
"title": ""
},
{
"docid": "1ecf71fc831908d42628af1c15f19893",
"score": "0.52980924",
"text": "def get_items\n @items\n end",
"title": ""
},
{
"docid": "8c19714ebd6601dbed576c730ef39389",
"score": "0.5293964",
"text": "def filter(live_list)\n # re-bloat\n self.load_starters\n # slim to desired subset\n @starters = @starters.select {|starter| live_list.include?(starter.category)}\n end",
"title": ""
}
] |
8557e6ea2498ea2f5acf4aa60bc55ea0
|
DELETE /suppliers/1 DELETE /suppliers/1.json
|
[
{
"docid": "f842d90bc6b75028fdd1f95dcd77301e",
"score": "0.72896796",
"text": "def destroy\n @supplier.destroy\n respond_to do |format|\n format.html { redirect_to suppliers_url, notice: 'Supplier was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
[
{
"docid": "63d4c91feeb17aeb79253c1cedc6a2c7",
"score": "0.758882",
"text": "def destroy\n @supplier = Supplier.find(params[:id])\n @supplier.destroy\n\n respond_to do |format|\n format.html { redirect_to suppliers_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "edf755ce838df103706ad31a2b319fb3",
"score": "0.75680393",
"text": "def destroy\n @supplier = Supplier.find(params[:id])\n @supplier.destroy\n\n respond_to do |format|\n format.html { redirect_to suppliers_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "edf755ce838df103706ad31a2b319fb3",
"score": "0.75680393",
"text": "def destroy\n @supplier = Supplier.find(params[:id])\n @supplier.destroy\n\n respond_to do |format|\n format.html { redirect_to suppliers_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a123e2e8313efc3113eae52275823150",
"score": "0.7518574",
"text": "def destroy\n @supplier.destroy\n respond_to do |format|\n format.html { redirect_to suppliers_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ab15bd2666ce5da5b115e270dc428f1c",
"score": "0.7394378",
"text": "def destroy\n @supplier.destroy\n respond_to do |format|\n format.html { redirect_to(suppliers_path, notice: 'Supplier removed.')}\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "39a3cc64359b649ea3abcd9b54b2c3a3",
"score": "0.7381279",
"text": "def destroy\n supplier = Supplier.find(params[:id])\n supplier.destroy\n render json: {message: \"Supplier successfully destroyed!\"}\n end",
"title": ""
},
{
"docid": "5574e1e456a1991d0c2eaf0fc55e0dca",
"score": "0.7379296",
"text": "def supplier_delete\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Entered in supplier Delete\"\n begin\n \tid = params[\"format\"] \n user = RestClient.delete $api_service+'/suppliers/'+id\n rescue => e\n Rails.logger.custom_log.error { \"#{e} supplier_controller supplier_delete method\" }\n end\n redirect_to action: \"index\"\n end",
"title": ""
},
{
"docid": "1822514cc55c3d7bf492815946bebc8b",
"score": "0.73235923",
"text": "def destroy\n @supply = Supply.find(params[:id])\n @supply.destroy\n\n respond_to do |format|\n format.html { redirect_to supplies_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1822514cc55c3d7bf492815946bebc8b",
"score": "0.73235923",
"text": "def destroy\n @supply = Supply.find(params[:id])\n @supply.destroy\n\n respond_to do |format|\n format.html { redirect_to supplies_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f2d48403d5fb40f42a54231932cc2116",
"score": "0.73033935",
"text": "def destroy\n @supplier.destroy\n respond_to do |format|\n format.html { redirect_to suppliers_url, notice: 'Lieferant erfolgreich gelöscht.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "411328d1f770ed4a856884d1d3f62d3f",
"score": "0.72707075",
"text": "def destroy\n @water_supplier.destroy\n respond_to do |format|\n format.html { redirect_to water_suppliers_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1e92df0e62da2cb47e16eb39806a353e",
"score": "0.72312754",
"text": "def destroy\n @supplier = Supplier.find(params[:id])\n @supplier.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_suppliers_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "90ed768b029680b2f008ef32cbcea2d4",
"score": "0.7214118",
"text": "def destroy\n @supplier = Supplier.find(params[:id])\n @supplier.destroy\n\n respond_with(@supplier)\n end",
"title": ""
},
{
"docid": "4994ae0ca081b250980c31127c3c89aa",
"score": "0.7211392",
"text": "def destroy\n @tqrdc_supplier.destroy\n respond_to do |format|\n format.html { redirect_to tqrdc_suppliers_url, notice: 'Supplier was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9840b4113fa3b59c72d25221568bfe13",
"score": "0.7201071",
"text": "def destroy\n @supplier = Supplier.find(params[:id])\n @supplier.destroy\n\n respond_to do |format|\n format.html { redirect_to(suppliers_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "9840b4113fa3b59c72d25221568bfe13",
"score": "0.7199305",
"text": "def destroy\n @supplier = Supplier.find(params[:id])\n @supplier.destroy\n\n respond_to do |format|\n format.html { redirect_to(suppliers_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "9840b4113fa3b59c72d25221568bfe13",
"score": "0.7199305",
"text": "def destroy\n @supplier = Supplier.find(params[:id])\n @supplier.destroy\n\n respond_to do |format|\n format.html { redirect_to(suppliers_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "9840b4113fa3b59c72d25221568bfe13",
"score": "0.7199305",
"text": "def destroy\n @supplier = Supplier.find(params[:id])\n @supplier.destroy\n\n respond_to do |format|\n format.html { redirect_to(suppliers_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "852d0ef0879a2b5e1bf5ca958dfdba0d",
"score": "0.7147669",
"text": "def destroy\n\t\t@supplier = Supplier.find(params[:id])\n\t\[email protected]\n\n\t\trespond_to do |format|\n\t\tformat.html { redirect_to suppliers_url }\n\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"title": ""
},
{
"docid": "83229e7f3fddba6d0df584a85f218dd8",
"score": "0.71327776",
"text": "def destroy\n @supply.destroy\n respond_to do |format|\n format.html { redirect_to supplies_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bb12e7dbb5eb86e4cc4a66eb71ab1a12",
"score": "0.7127115",
"text": "def destroy\n @supplement.destroy\n respond_to do |format|\n format.html { redirect_to supplements_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bb12e7dbb5eb86e4cc4a66eb71ab1a12",
"score": "0.7127115",
"text": "def destroy\n @supplement.destroy\n respond_to do |format|\n format.html { redirect_to supplements_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7f85e11d4415a54c1f7f4a70b07d6c05",
"score": "0.7126785",
"text": "def destroy\n @zmm_item_supplier.destroy\n respond_to do |format|\n format.html { redirect_to zmm_item_suppliers_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f389343993190a2428c51044a5a07e47",
"score": "0.7125464",
"text": "def destroy\n @supplier_without_account = SupplierWithoutAccount.find(params[:id])\n @supplier_without_account.destroy\n\n respond_to do |format|\n format.html { redirect_to supplier_without_accounts_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "d8b48e0e2be918e4fcd647da331a4463",
"score": "0.7124765",
"text": "def destroy\n @catalogs_supplier.destroy\n respond_to do |format|\n format.html { redirect_to catalogs_suppliers_url, notice: 'Supplier was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "02900d03c128dcaaf61b4f3bcd52f4be",
"score": "0.710332",
"text": "def destroy\n @catalogs_supplier = Catalogs::Supplier.find(params[:id])\n @catalogs_supplier.destroy\n\n respond_to do |format|\n format.html { redirect_to(catalogs_suppliers_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "7677976cf8fc4ba291b3d60b0890fd28",
"score": "0.70883507",
"text": "def destroy\n @supplement = Supplement.find(params[:id])\n @supplement.destroy\n\n respond_to do |format|\n format.html { redirect_to supplements_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d24d5e17631d886e10aea1c885fc9722",
"score": "0.7079202",
"text": "def destroy\n @supplier = current_user.suppliers.find(params[:id])\n @supplier.destroy\n\n respond_to do |format|\n format.html { redirect_to(suppliers_url, :notice => 'Supplier was successfully deleted.') }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "5cf97eacb5397c3c4ac01b3b799bbecd",
"score": "0.7061911",
"text": "def destroy\n #@supplier.destroy\n @supplier.update(deleting_status: 'true')\n respond_to do |format|\n format.html { redirect_to suppliers_url, notice: 'Supplier was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "424172912cfcb162a97912420b692a42",
"score": "0.7058231",
"text": "def destroy\n \t@supplier = Supplier.find(params[:id])\n @supplier.destroy\n respond_to do |format|\n format.html { redirect_to profile_url, notice: 'Supplier was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "d694d233c82f3f0eb20e7bbd8ace59d6",
"score": "0.7055542",
"text": "def destroy\n @supplier.destroy\n respond_to do |format|\n format.html { redirect_to suppliers_url, notice: t(\"activerecord.models.supplier\") + t(\"messages.successfully_destroyed\") }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c0c3a1d07b63f18fde9681f6955f5ef5",
"score": "0.70409685",
"text": "def destroy\n @supply = Supply.find(params[:id])\n @supply.destroy\n\n respond_to do |format|\n format.html { redirect_to(supplies_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "c0c3a1d07b63f18fde9681f6955f5ef5",
"score": "0.70409685",
"text": "def destroy\n @supply = Supply.find(params[:id])\n @supply.destroy\n\n respond_to do |format|\n format.html { redirect_to(supplies_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "af8f543cc7ced8ad88a773685359ed9a",
"score": "0.70353323",
"text": "def destroy\n @supplier_id = @ingredient.supplier_id\n @ingredient.destroy\n respond_to do |format|\n format.html { redirect_to ingredients_url(supplier_id: @supplier_id) }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "184af5568475d7884e699029534f072f",
"score": "0.7008821",
"text": "def destroy\n @supplier_rebate.destroy\n respond_to do |format|\n format.html { redirect_to supplier_rebates_url, notice: 'Supplier rebate was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "679cd37870d70eec74dcb9e72ca2caef",
"score": "0.7007647",
"text": "def destroy\n @supplier_product = SupplierProduct.find(params[:id])\n @supplier_product.destroy\n\n respond_to do |format|\n format.html { redirect_to supplier_products_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "85d25d74d4634bd4b66866f269dea0ca",
"score": "0.70028275",
"text": "def destroy\n if @supplier.destroy\n respond_to do |format|\n format.html { redirect_to suppliers_url }\n format.json { head :no_content }\n end\n else\n flash[:danger] = \"The deletion failed because: \" + @supplier.errors.full_messages.to_sentence\n redirect_to suppliers_url\n end \n end",
"title": ""
},
{
"docid": "b7f01cc627d8576ee65efb8d1f48d112",
"score": "0.69965404",
"text": "def destroy\n @supplier.destroy\n\n head :no_content\n end",
"title": ""
},
{
"docid": "517cdfe2f13c3d02b89426b2d56c2173",
"score": "0.6992686",
"text": "def destroy\n @supplier = ::Supplier.find(params[:id])\n @supplier.destroy\n\n respond_to do |format|\n format.html { redirect_to :action=>:index }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "5121f0192f2e3716d41ab96d56625fab",
"score": "0.69915867",
"text": "def destroy\n @supplier = Supplier.find(params[:id])\n\n respond_to do |format|\n if @supplier.destroy\n format.html { redirect_to suppliers_url,\n notice: (crud_notice('destroyed', @supplier) + \"#{undo_link(@supplier)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to suppliers_url, alert: \"#{@supplier.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @supplier.errors, status: :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "afb9f3b2ea60a4cad6e2e5cd52b83a57",
"score": "0.6966774",
"text": "def destroy\n @supplier_account = SupplierAccount.find(params[:id])\n @supplier_account.destroy\n\n respond_to do |format|\n format.html { redirect_to supplier_accounts_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "282d2189d87bdf6a9e8fe64661745317",
"score": "0.6966483",
"text": "def destroy\n @supplier_account.destroy\n respond_to do |format|\n format.html { redirect_to supplier_accounts_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4d77bc7462a6708c9f8d514284d712cf",
"score": "0.69460654",
"text": "def destroy\n @add_to_invoice_supplier.destroy\n respond_to do |format|\n format.html { redirect_to add_to_invoice_suppliers_url, notice: 'Add to invoice supplier was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "80fea11e537ca8b97afc28b48f605cee",
"score": "0.69394183",
"text": "def destroy\n @invoice_supplier.destroy\n respond_to do |format|\n format.html { redirect_to invoice_suppliers_url, notice: 'Invoice supplier was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f52bb6a37e8b85bc9d381051d34fa9e0",
"score": "0.69292283",
"text": "def destroy\n @admin_supplier_type = Admin::SupplierType.find(params[:id])\n @admin_supplier_type.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_supplier_types_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "6a7abac2503ceb7d111f15fc136f6b0b",
"score": "0.6898949",
"text": "def destroy\n @supplement.destroy\n respond_to do |format|\n format.html { redirect_to supplements_url, notice: \"Supplement was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "36892ae4bcb3d7e69348f261b10e222d",
"score": "0.6859278",
"text": "def destroy\n @supplier_ingredient.destroy\n respond_to do |format|\n format.html { redirect_to supplier_ingredients_url, notice: 'Supplier ingredient was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ade7f0d111ef016cf8cb0a49b20e17b7",
"score": "0.6834886",
"text": "def destroy\n # NOTE: scaffold でつくられるコントローラでは destroy が使われていますが、\n # 戻り値を使わないのであれば、destroy! を使う方がより適切なので変えています。\n @supplire.destroy!\n respond_to do |format|\n format.html { redirect_to supplires_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "add2757daa6dde62a073ee0cbd86711f",
"score": "0.6827027",
"text": "def destroy\n @app_supplier = AppSupplier.find(params[:id])\n @app_supplier.destroy\n\n respond_to do |format|\n format.html { redirect_to(app_suppliers_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "174b723f9e43bfa7501a9cdc389e4c1b",
"score": "0.68242",
"text": "def delete\n @response = self.class.delete(\"#{@server_uri}/resource_name/#{@opts[:id]}.json\")\n end",
"title": ""
},
{
"docid": "9f4f4857862834a07424343ed18092bf",
"score": "0.68100524",
"text": "def destroy\n @supplier_responsible.destroy\n respond_to do |format|\n format.html { redirect_to supplier_responsibles_url, notice: 'Supplier responsible was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c62784dcb664e05d791ae9496fbdbede",
"score": "0.6796277",
"text": "def destroy\n @supplier.destroy ? flash[:success] = 'El Prestador ha sido eliminado correctamente.' : flash[:error] = 'No se pudo eliminar el Prestador seleccionado.'\n respond_to do |format|\n format.html { redirect_to suppliers_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7ff39ff90b05539ec75df66fa147adbb",
"score": "0.6794993",
"text": "def destroy\n materials = Material.where(\"supplier_id = ?\", @supplier.id)\n \n if purchases.empty?\n @supplier.destroy\n else\n @supplier.update(deleted: 1)\n end\n respond_to do |format|\n format.html { redirect_to suppliers_url, notice: 'Supplier was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "31c7ce11c13cd6c07f8acbef539fa5c6",
"score": "0.67799985",
"text": "def destroy\n @supplier_setup.destroy\n respond_to do |format|\n format.html { redirect_to supplier_setups_url, notice: 'Supplier setup was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "369ca0dc2f8c73ebe455501a625e81c2",
"score": "0.67751235",
"text": "def destroy\n @supplier.destroy\n end",
"title": ""
},
{
"docid": "9a7c256c2e6b5e67a7ce8c9208234b77",
"score": "0.67470473",
"text": "def destroy\n @purchaser = Purchaser.find(params[:id])\n @purchaser.destroy\n\n respond_to do |format|\n format.html { redirect_to purchasers_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "223837d224adbca307744615484330eb",
"score": "0.67465293",
"text": "def destroy\n @supplier = Supplier.find_by_param(params[:id])\n @supplier.deleted_at = Time.now()\n\n #@supplier.variants.each do |v|\n # v.deleted_at = Time.now()\n # v.save\n #end\n\n if @supplier.save\n flash.notice = I18n.t(\"notice_messages.supplier_deleted\")\n else\n flash.notice = I18n.t(\"notice_messages.supplier_not_deleted\")\n end\n\n respond_to do |format|\n format.html { redirect_to collection_url }\n format.js { render_js_for_destroy }\n end\n end",
"title": ""
},
{
"docid": "bc1ac0271d39c3ef8146d896f942179e",
"score": "0.6731725",
"text": "def destroy\n @supplier_type.destroy\n respond_to do |format|\n format.html { redirect_to supplier_types_url, notice: 'Supplier type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "68a0896347d9a0d62c649b8735f11f5e",
"score": "0.672582",
"text": "def destroy\n @supplyorder = Supplyorder.find(params[:id])\n @supplyorder.destroy\n\n respond_to do |format|\n format.html { redirect_to supplyorders_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "75fcbd0a5cb57633166d12f298d59417",
"score": "0.67234594",
"text": "def destroy\n @expensive.destroy\n respond_to do |format|\n format.html { redirect_to expensives_url, notice: 'Expensive was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "fcd7f178e30841378a203db4c0d9b377",
"score": "0.6708932",
"text": "def destroy\n @supplier = Supplier.find(params[:id])\n @supplier.destroy\n @suppliers = Supplier.order(:name).pagination(params[:page])\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.js\n end\n end",
"title": ""
},
{
"docid": "9206c12be0e9315e9442367f39e0b53d",
"score": "0.6700471",
"text": "def destroy\n @demand.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f172a18af097f8412e9e48ae2519d2f4",
"score": "0.66937",
"text": "def destroy\n @ste_supplier_history = SteSupplierHistory.find(params[:id])\n @ste_supplier_history.destroy\n\n respond_to do |format|\n format.html { redirect_to ste_supplier_histories_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "213b141755455223e086ab7150aa308e",
"score": "0.6681778",
"text": "def destroy\n @consumer = Consumer.find(params[:consumer_id])\n \n @expenditure = Expenditure.find(params[:id])\n @expenditure.destroy\n\n respond_to do |format|\n format.html { redirect_to client_expenditures_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "888fd85ced8eeb47fc0b72507568b738",
"score": "0.6680111",
"text": "def destroy\n @supplier_order = SupplierOrder.find(params[:id])\n @supplier_order.destroy\n\n respond_to do |format|\n format.html { redirect_to supplier_orders_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "4c66749846a7ac3243ed053ce082ea9d",
"score": "0.6678669",
"text": "def destroy\n @purge = Purge.find(params[:id])\n @purge.destroy\n\n respond_to do |format|\n format.html { redirect_to purges_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "cccf076596c77e31886da299595930a0",
"score": "0.6673402",
"text": "def destroy\n @supplier_contract = SupplierContract.find(params[:id])\n @supplier_contract.destroy\n\n respond_to do |format|\n format.html { redirect_to supplier_contracts_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f8e2bf2a8cdd7cd45a18efa481c6c682",
"score": "0.6667313",
"text": "def destroy\n @supplier.destroy\n respond_to do |format|\n format.js { render_js_for_form @supplier, suppliers_path, '供应商信息删除成功!' }\n end\n end",
"title": ""
},
{
"docid": "dafce7eb1c9d1410e434348c008dc4ae",
"score": "0.665381",
"text": "def destroy\n @has_used_supply.destroy\n respond_to do |format|\n format.html { redirect_to has_used_supplies_url, notice: 'Has used supply was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "89e5f4fa5a52448899e184666b73ebf1",
"score": "0.664946",
"text": "def destroy\n @admin_contact_detail = Admin::ContactDetail.find(params[:id])\n @admin_contact_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_suppliers_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "b1a17c1ee1af05c79fe156622df44818",
"score": "0.6640519",
"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": "fa1beab7bebffd2607dedc4d0ecc548a",
"score": "0.66333157",
"text": "def destroy\n @flier = Flier.find(params[:id])\n @flier.destroy\n\n respond_to do |format|\n format.html { redirect_to fliers_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3ea8ac7ac46c08efebe8ca7e49d669ad",
"score": "0.6632525",
"text": "def destroy\n @supplieraccount.destroy\n respond_to do |format|\n format.html { redirect_to supplieraccounts_url, notice: 'Supplieraccount was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "356b57f73ddf32caed29631751e96cc2",
"score": "0.6627351",
"text": "def destroy\n @suppliermaster.destroy\n respond_to do |format|\n format.html { redirect_to suppliermasters_url, notice: 'Suppliermaster was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "9cade995d54cf7b7a881073807aedba4",
"score": "0.6623755",
"text": "def destroy\n @hotelsupply = Hotelsupply.find(params[:id])\n @hotelsupply.destroy\n\n respond_to do |format|\n format.html { redirect_to hotelsupplies_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bddd3509231497ae78942e1a718edab9",
"score": "0.66206795",
"text": "def destroy\n @supplies_return = SuppliesReturn.find(params[:id])\n @supplies_return.destroy\n\n respond_to do |format|\n format.html { redirect_to supplies_returns_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "dc9ab27abb53617196a931a22831a063",
"score": "0.6614302",
"text": "def destroy\n @supply_consumption.destroy\n respond_to do |format|\n format.html { redirect_to supply_consumptions_url, notice: 'Supply consumption was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "5e21b513ff2f52b37dc812b951dba94a",
"score": "0.6608423",
"text": "def destroy\n @supplier_dn.destroy\n respond_to do |format|\n format.html { redirect_to supplier_dns_url, notice: 'Supplier dn was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "c31f4c4037638585a3791a7cf458e4fb",
"score": "0.6586743",
"text": "def destroy\n @supplement_plan = SupplementPlan.find(params[:id])\n @supplement_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to supplement_plans_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "7ac9616f9a7353d9bd6e82f364aa4943",
"score": "0.6574627",
"text": "def delete_mobile_carrier(args = {}) \n delete(\"/mobile.json/#{args[:carrierId]}\", args)\nend",
"title": ""
},
{
"docid": "7ac9616f9a7353d9bd6e82f364aa4943",
"score": "0.6574627",
"text": "def delete_mobile_carrier(args = {}) \n delete(\"/mobile.json/#{args[:carrierId]}\", args)\nend",
"title": ""
},
{
"docid": "ce83c555471f63a540d488773ba6e83f",
"score": "0.65536684",
"text": "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to suppliers_path, notice: 'Invoice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "38ab190ba26ad0bdfd108b79b3d4e9d4",
"score": "0.65493834",
"text": "def destroy\n @stack_supplement.destroy\n respond_to do |format|\n format.html { redirect_to stack_stack_supplements_url(@stack) }\n format.json { head :no_content }\n format.js\n end\n end",
"title": ""
},
{
"docid": "6a445002e57be60a646264c1f2a22960",
"score": "0.6549299",
"text": "def destroy\n @b_supplier_contact = BSupplierContact.find(params[:id])\n @b_supplier_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to b_supplier_contacts_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "848865ffa853c4c929ba326bbd06f61e",
"score": "0.65483046",
"text": "def destroy\n @product = Product.find(params[:product_id])\n @reorder_url= reorder_product_suppliers_url(@product)\n @supplier = @product.suppliers.find(params[:id])\n respond_to do |format|\n if(@supplier.destroy)\n flash[:notice] = \"Suppliers deleted (1) from product.\"\n format.html { redirect_to product_suppliers_url(@product) }\n format.xml { head :ok }\n else\n flash[:notice] = \"Deleting supplier from product failed due to errors.\"\n format.html { redirect_to product_suppliers_url(@product) }\n format.xml { head :unprocessable_entity }\n end\n end\n end",
"title": ""
},
{
"docid": "295d89e4cc35d9ba9b2da418401bcde7",
"score": "0.6541071",
"text": "def destroy\n @fuel_supplied.destroy\n respond_to do |format|\n format.html { redirect_to fuel_supplieds_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "295d89e4cc35d9ba9b2da418401bcde7",
"score": "0.6541071",
"text": "def destroy\n @fuel_supplied.destroy\n respond_to do |format|\n format.html { redirect_to fuel_supplieds_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "bbcbba467b1abed64834e38ed315057b",
"score": "0.6529538",
"text": "def destroy\n @supplierdiscount = Supplierdiscount.find(params[:id])\n @supplierdiscount.destroy\n\n respond_to do |format|\n format.html { redirect_to(supplierdiscounts_url) }\n format.xml { head :ok }\n end\n end",
"title": ""
},
{
"docid": "8562ff54f5c3a3eab275e758634a8049",
"score": "0.65237564",
"text": "def destroy\n @applicant = Applicant.find(params[:id])\n @applicant.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_applicants_url }\n format.json { head :ok }\n end\n end",
"title": ""
},
{
"docid": "8b642e4c43110f372a9c1b8a45a46bf8",
"score": "0.6518702",
"text": "def destroy\n @demo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "ddc200bb064bffe93965b9dba5350443",
"score": "0.6517984",
"text": "def destroy\n @applicant = Applicant.find(params[:id])\n @applicant.destroy\n\n respond_to do |format|\n format.html { redirect_to applicants_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "f1482f4cc2636936371b39a79bdaa544",
"score": "0.65135795",
"text": "def destroy \n drink = Drink.find_by(id:params[:id])\n drink.destroy\n render json: drink\n end",
"title": ""
},
{
"docid": "5aa132f80345501704f7a88aec251418",
"score": "0.65134835",
"text": "def destroy\n @supply2.destroy\n respond_to do |format|\n format.html { redirect_to supply2s_url, notice: 'Supply2 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "a046c39a4e5e6e1a31be6897cccf192b",
"score": "0.6508254",
"text": "def destroy\n @supply_copy.destroy\n respond_to do |format|\n format.html { redirect_to supply_copies_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "e2f640bb56170f0fe8bbff7d9e8091bb",
"score": "0.6508134",
"text": "def destroy\n @gemstone.destroy\n respond_to do |format|\n format.html { redirect_to gemstones_url, notice: 'Gemstone was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "1cca61125402622d17ad0f1a57380d92",
"score": "0.65076464",
"text": "def delete\n supprimer = ChoixService.instance.supprimerChoix(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\n end",
"title": ""
},
{
"docid": "bf69d83082f534aac20184428d22fa9e",
"score": "0.6507331",
"text": "def destroy\n @purchaser.destroy\n respond_to do |format|\n format.html { redirect_to purchasers_url, notice: 'Purchaser was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6c0739eaa0d454df9ad8e26d9f40f49c",
"score": "0.6500424",
"text": "def destroy\n @api_supermarket.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"title": ""
}
] |
bc00c1fa28d0dd29a4567bae7d197871
|
NOTE: call this before format and open
|
[
{
"docid": "6fbad814d085cdbfe8da90fc6c16131b",
"score": "0.0",
"text": "def set_passphrase\n @pass = get_passphrase()\n end",
"title": ""
}
] |
[
{
"docid": "2b8546ebac55b2f2e16e77a2e31ae03f",
"score": "0.6522595",
"text": "def formats; end",
"title": ""
},
{
"docid": "2b8546ebac55b2f2e16e77a2e31ae03f",
"score": "0.6522595",
"text": "def formats; end",
"title": ""
},
{
"docid": "0dde32d6e7b86e9eff60e29b897f748b",
"score": "0.6431332",
"text": "def opening; end",
"title": ""
},
{
"docid": "0dde32d6e7b86e9eff60e29b897f748b",
"score": "0.6431332",
"text": "def opening; end",
"title": ""
},
{
"docid": "0dde32d6e7b86e9eff60e29b897f748b",
"score": "0.6431332",
"text": "def opening; end",
"title": ""
},
{
"docid": "51872bb691452bb4cc04343b75ace309",
"score": "0.63087237",
"text": "def _process_format(format); end",
"title": ""
},
{
"docid": "51872bb691452bb4cc04343b75ace309",
"score": "0.63087237",
"text": "def _process_format(format); end",
"title": ""
},
{
"docid": "6de7a96259985b1afe041f4b432d1ac5",
"score": "0.6228554",
"text": "def _process_format(format) # :nodoc:\n end",
"title": ""
},
{
"docid": "bf77a777425f979cea802eca29bf8316",
"score": "0.6157372",
"text": "def format; end",
"title": ""
},
{
"docid": "bf77a777425f979cea802eca29bf8316",
"score": "0.6157372",
"text": "def format; end",
"title": ""
},
{
"docid": "bf77a777425f979cea802eca29bf8316",
"score": "0.6157372",
"text": "def format; end",
"title": ""
},
{
"docid": "bf77a777425f979cea802eca29bf8316",
"score": "0.6157372",
"text": "def format; end",
"title": ""
},
{
"docid": "bf77a777425f979cea802eca29bf8316",
"score": "0.6157372",
"text": "def format; end",
"title": ""
},
{
"docid": "bf77a777425f979cea802eca29bf8316",
"score": "0.6157372",
"text": "def format; end",
"title": ""
},
{
"docid": "bf77a777425f979cea802eca29bf8316",
"score": "0.6157372",
"text": "def format; end",
"title": ""
},
{
"docid": "bf77a777425f979cea802eca29bf8316",
"score": "0.6157372",
"text": "def format; end",
"title": ""
},
{
"docid": "b951028d7d19bdd0b099bf8679808dd7",
"score": "0.5992064",
"text": "def transform(file, format:); end",
"title": ""
},
{
"docid": "57ab434486f6bf59e73358fa107d2fad",
"score": "0.5972295",
"text": "def output\n super(@file_format => @file_path)\n end",
"title": ""
},
{
"docid": "d46a20463be52121d01d7cbe4108a36e",
"score": "0.59186774",
"text": "def format_file\n archiveFormat = @archive.to_s.split('\\n')\n archiveFormat.shift()\n archiveFormat.shift()\n archiveFormat.shift()\n archiveFormat.shift()\n archiveFormat.pop()\n archiveFormat.pop()\n archiveFormat\n end",
"title": ""
},
{
"docid": "9af5d862c523881b8fa20ca49325906b",
"score": "0.5892448",
"text": "def format\n @data_chunk_reader.format\n end",
"title": ""
},
{
"docid": "9af5d862c523881b8fa20ca49325906b",
"score": "0.5892448",
"text": "def format\n @data_chunk_reader.format\n end",
"title": ""
},
{
"docid": "b226d78bc4336097802b6efe88442bbc",
"score": "0.58424777",
"text": "def formatter; end",
"title": ""
},
{
"docid": "b226d78bc4336097802b6efe88442bbc",
"score": "0.58424777",
"text": "def formatter; end",
"title": ""
},
{
"docid": "b226d78bc4336097802b6efe88442bbc",
"score": "0.58424777",
"text": "def formatter; end",
"title": ""
},
{
"docid": "ec25971e52a9b210f5795f48db0c2ef1",
"score": "0.5810388",
"text": "def format\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "4fb84927546068c69b4062f999cb07bc",
"score": "0.5768968",
"text": "def format\n @data.format == :base ? :file : @data.format\n end",
"title": ""
},
{
"docid": "1b09814a2c407722be7b7a639cdf7962",
"score": "0.57635134",
"text": "def onopen(&blk); super; end",
"title": ""
},
{
"docid": "762816e37c619efb2f038fc23fe59bbd",
"score": "0.5729128",
"text": "def format!; end",
"title": ""
},
{
"docid": "17a798e5aaf3836100b392d0d38cc8cb",
"score": "0.57095885",
"text": "def create_format_method\n end",
"title": ""
},
{
"docid": "ceb53d07d3f366fef567c8c9c565dd5d",
"score": "0.5689238",
"text": "def format\n raise '#format must be implemented in child class'\n end",
"title": ""
},
{
"docid": "480cfb7a7c4b7b27916be9f01d5dc5ca",
"score": "0.56564957",
"text": "def preformatting\n\n end",
"title": ""
},
{
"docid": "a1fa002dbbbe55c9eb2d638f8bad0bf7",
"score": "0.56327164",
"text": "def format\n @format ||= {}\n end",
"title": ""
},
{
"docid": "158471c478bc872229ea46b38c8a966a",
"score": "0.56062233",
"text": "def initialize(file_format)\n @lines = []\n @attributes = {}\n register_file_format(file_format)\n end",
"title": ""
},
{
"docid": "c21b1f627e655171e961c5731606dddb",
"score": "0.559501",
"text": "def open\n @fd.close if @fd\n @fd = File.open(@file, 'ab+')\n @fd.advise(:sequential) if @fd.respond_to? :advise\n stat = @fd.stat\n @inode = stat.ino\n write(@format.header) if stat.size == 0\n @pos = nil\n end",
"title": ""
},
{
"docid": "fe900079bfa38fcd41e732d9b6343c7e",
"score": "0.5593594",
"text": "def reader; end",
"title": ""
},
{
"docid": "cb8fd2528f48ebc0b5ccd27d081ab61d",
"score": "0.5593439",
"text": "def formatted_source_file(source_file); end",
"title": ""
},
{
"docid": "f7ef3183507c2c6cd793ee999f89e0bf",
"score": "0.5571723",
"text": "def format\n @_format\n end",
"title": ""
},
{
"docid": "cb7dbe753ffe1db5a6994a5d388dd69e",
"score": "0.5568213",
"text": "def file_format\n @descriptive_detail.file_format\n end",
"title": ""
},
{
"docid": "cbdc970c9224a83a0db850e29c0e849b",
"score": "0.5562434",
"text": "def opened\n end",
"title": ""
},
{
"docid": "f6a2840643d2260609b9bb5207d4eaf3",
"score": "0.5555495",
"text": "def formatters; end",
"title": ""
},
{
"docid": "7180898f456b063768f0e21a97ff3919",
"score": "0.5537518",
"text": "def formats_idx; end",
"title": ""
},
{
"docid": "344000c34b2afba514a41e49e5f745e8",
"score": "0.5527045",
"text": "def open\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "49df955802ac5c28d6da1ba8c25e9d8d",
"score": "0.5523362",
"text": "def file; end",
"title": ""
},
{
"docid": "49df955802ac5c28d6da1ba8c25e9d8d",
"score": "0.5523362",
"text": "def file; end",
"title": ""
},
{
"docid": "49df955802ac5c28d6da1ba8c25e9d8d",
"score": "0.5523362",
"text": "def file; end",
"title": ""
},
{
"docid": "49df955802ac5c28d6da1ba8c25e9d8d",
"score": "0.5523362",
"text": "def file; end",
"title": ""
},
{
"docid": "49df955802ac5c28d6da1ba8c25e9d8d",
"score": "0.5523362",
"text": "def file; end",
"title": ""
},
{
"docid": "49df955802ac5c28d6da1ba8c25e9d8d",
"score": "0.5523362",
"text": "def file; end",
"title": ""
},
{
"docid": "49df955802ac5c28d6da1ba8c25e9d8d",
"score": "0.5523362",
"text": "def file; end",
"title": ""
},
{
"docid": "49df955802ac5c28d6da1ba8c25e9d8d",
"score": "0.5523362",
"text": "def file; end",
"title": ""
},
{
"docid": "49df955802ac5c28d6da1ba8c25e9d8d",
"score": "0.5523362",
"text": "def file; end",
"title": ""
},
{
"docid": "49df955802ac5c28d6da1ba8c25e9d8d",
"score": "0.5523362",
"text": "def file; end",
"title": ""
},
{
"docid": "49df955802ac5c28d6da1ba8c25e9d8d",
"score": "0.5523362",
"text": "def file; end",
"title": ""
},
{
"docid": "bd33b945298d67a967ac477ce606b070",
"score": "0.5509114",
"text": "def create_from_file\n end",
"title": ""
},
{
"docid": "d7d06463f0bc4558a1eb0f4cf2ff52d0",
"score": "0.54821444",
"text": "def format(outstream)\n file = File.basename(@path, '.*')\n req_attrs = Models::Lookup::get_required_attrs(file)\n\n format_from_stream(File.open(@path), req_attrs, outstream)\n end",
"title": ""
},
{
"docid": "98eb03c93926952fcaf0d337145ba8dc",
"score": "0.54796875",
"text": "def force(new_format)\r\n @format = new_format\r\n self\r\n end",
"title": ""
},
{
"docid": "951c5ee0692ee5d010d15ec8c8b5e796",
"score": "0.54753333",
"text": "def open_for_read\n end",
"title": ""
},
{
"docid": "635cf544f0068ae6acf0b76fc67c8e85",
"score": "0.5467387",
"text": "def format\n @format\n end",
"title": ""
},
{
"docid": "b88deb2bb8a606349d6ff375b5ae640c",
"score": "0.5457816",
"text": "def _wrapper_formats; end",
"title": ""
},
{
"docid": "0f4a48b18d3fded5e228d29b6ca5722e",
"score": "0.5425514",
"text": "def format_source(source); end",
"title": ""
},
{
"docid": "45af1848ac817a3dc508b6dafb2f8b85",
"score": "0.54224175",
"text": "def writer; end",
"title": ""
},
{
"docid": "ecb2e5fe06c6044a64efcdad6c648f0a",
"score": "0.54209036",
"text": "def initialize\n open\n end",
"title": ""
},
{
"docid": "018715d1738cf9483c52d421c35cd051",
"score": "0.5412985",
"text": "def metadata_file; end",
"title": ""
},
{
"docid": "018715d1738cf9483c52d421c35cd051",
"score": "0.5412985",
"text": "def metadata_file; end",
"title": ""
},
{
"docid": "d1dd91bb039921fda91fe5cc1760de24",
"score": "0.53943473",
"text": "def rendered_format; end",
"title": ""
},
{
"docid": "d1dd91bb039921fda91fe5cc1760de24",
"score": "0.53943473",
"text": "def rendered_format; end",
"title": ""
},
{
"docid": "74099bb1b2e387b5b4cb0d04ab26c44f",
"score": "0.5386829",
"text": "def pos_fil_header\n 0\n end",
"title": ""
},
{
"docid": "f65368c3be60f1cb3f6431d622a8f2ff",
"score": "0.5382116",
"text": "def process(src)\n super\n @format = case src.parser.to_s\n when 'RDoc::Parser::PerlPOD'\n 'perl'\n when 'RDoc::Parser::C'\n 'c'\n when 'RDoc::Parser::Simple'\n 'text'\n else\n 'ruby'\n end\n\n @last_modified = src.last_modified\n @absolute_name = src.absolute_name\n @full_name = src.full_name\n end",
"title": ""
},
{
"docid": "fa0b2ce9532cb52fc94dda29364ef6fb",
"score": "0.5360662",
"text": "def Open()\n\t\t#Begin document\n\t\t@state = 1\n\tend",
"title": ""
},
{
"docid": "dd7c5c582f962272b30bbfba3d8dec3b",
"score": "0.5356691",
"text": "def file_options; end",
"title": ""
},
{
"docid": "12a005a2cae81f70e71b817cb646474d",
"score": "0.53512365",
"text": "def deco_file; end",
"title": ""
},
{
"docid": "a0b769d20135041a4151e867cec1ce76",
"score": "0.5350293",
"text": "def header; end",
"title": ""
},
{
"docid": "a0b769d20135041a4151e867cec1ce76",
"score": "0.5350293",
"text": "def header; end",
"title": ""
},
{
"docid": "a0b769d20135041a4151e867cec1ce76",
"score": "0.5350293",
"text": "def header; end",
"title": ""
},
{
"docid": "9971b03f2dd49c0eba50a3c84127ca9f",
"score": "0.5338607",
"text": "def read; end",
"title": ""
},
{
"docid": "9971b03f2dd49c0eba50a3c84127ca9f",
"score": "0.5338607",
"text": "def read; end",
"title": ""
},
{
"docid": "9971b03f2dd49c0eba50a3c84127ca9f",
"score": "0.5338607",
"text": "def read; end",
"title": ""
},
{
"docid": "9971b03f2dd49c0eba50a3c84127ca9f",
"score": "0.5338607",
"text": "def read; end",
"title": ""
},
{
"docid": "9971b03f2dd49c0eba50a3c84127ca9f",
"score": "0.5338607",
"text": "def read; end",
"title": ""
},
{
"docid": "9971b03f2dd49c0eba50a3c84127ca9f",
"score": "0.5338607",
"text": "def read; end",
"title": ""
},
{
"docid": "9971b03f2dd49c0eba50a3c84127ca9f",
"score": "0.5338607",
"text": "def read; end",
"title": ""
},
{
"docid": "078c34e1a662b66d6d33117e4bd48868",
"score": "0.53294545",
"text": "def write_info_object!\n self.output.merge!(\n ::Brainstem::ApiDocs::FORMATTERS[:info][format].call(version: formatted_version)\n )\n end",
"title": ""
},
{
"docid": "6ac6d7ec5c40a9ba3ba2114a1967aae4",
"score": "0.5327768",
"text": "def prepare_format_properties # :nodoc:\n # Separate format objects into XF and DXF formats.\n prepare_formats\n\n # Set the font index for the format objects.\n prepare_fonts\n\n # Set the number format index for the format objects.\n prepare_num_formats\n\n # Set the border index for the format objects.\n prepare_borders\n\n # Set the fill index for the format objects.\n prepare_fills\n end",
"title": ""
},
{
"docid": "45b8aa513b40e939cf9013e1528c3ecd",
"score": "0.53232795",
"text": "def initialize(format, options = {})\n @options = options\n @file_format = format\n end",
"title": ""
},
{
"docid": "f01e3b43e9f2474de52beb55c36cc178",
"score": "0.531731",
"text": "def encoding_line; end",
"title": ""
},
{
"docid": "c76dde506aab78148f8a88433088a5b9",
"score": "0.5314248",
"text": "def by_magic(io); end",
"title": ""
},
{
"docid": "0598d027151488d03ddb10d78a52487f",
"score": "0.53072095",
"text": "def initialize\n @formats = []\n end",
"title": ""
},
{
"docid": "9cbf1fe15b1249c005b0118a8c92d631",
"score": "0.5304242",
"text": "def format\n @format ||= self._format_default\n end",
"title": ""
},
{
"docid": "83756398727181a94f08d5b5b8968db7",
"score": "0.5290711",
"text": "def inflate\n end",
"title": ""
},
{
"docid": "4dc67879e9eed29b9f7ff83c2be6b3ba",
"score": "0.5282268",
"text": "def format\n @ole.Format\n end",
"title": ""
},
{
"docid": "4dc67879e9eed29b9f7ff83c2be6b3ba",
"score": "0.5282268",
"text": "def format\n @ole.Format\n end",
"title": ""
},
{
"docid": "3803d55143d16702692e76690db30585",
"score": "0.5278881",
"text": "def format=(extension); end",
"title": ""
},
{
"docid": "39628a1cafa7961e629c8d540616e75f",
"score": "0.52747333",
"text": "def indent()\n file = Tempfile.new(\"out\")\n infile = Tempfile.new(\"in\")\n file.write(self.to_s)\n file.flush\n bufc = \"FOO\"\n\n tmppos = @pos\n\n message(\"Auto format #{@fname}\")\n\n if [\"chdr\", \"c\", \"cpp\"].include?(get_file_type())\n\n #C/C++/Java/JavaScript/Objective-C/Protobuf code\n system(\"clang-format -style='{BasedOnStyle: LLVM, ColumnLimit: 100, SortIncludes: false}' #{file.path} > #{infile.path}\")\n bufc = IO.read(infile.path)\n elsif get_file_type() == \"Javascript\"\n cmd = \"clang-format #{file.path} > #{infile.path}'\"\n debug cmd\n system(cmd)\n bufc = IO.read(infile.path)\n elsif get_file_type() == \"ruby\"\n cmd = \"rufo #{file.path}\"\n debug cmd\n system(cmd)\n bufc = IO.read(file.path)\n else\n return\n end\n self.update_content(bufc)\n center_on_current_line #TODO: needed?\n file.close; file.unlink\n infile.close; infile.unlink\n end",
"title": ""
},
{
"docid": "935efdb913d008ca813386c55d83449b",
"score": "0.52743995",
"text": "def internal_format\n selfclass.send(:internal_format)\n end",
"title": ""
},
{
"docid": "ea5d76ecc6e843c2d86df5f62ebd410d",
"score": "0.52714944",
"text": "def header=(_arg0); end",
"title": ""
},
{
"docid": "416b634c13f8fac5629614468aad6bd0",
"score": "0.5267954",
"text": "def preferred_file_format\n ''\n end",
"title": ""
},
{
"docid": "31b8947fa216f7a09b69e61b466795b8",
"score": "0.5261227",
"text": "def read\n \n end",
"title": ""
},
{
"docid": "af46407ac437af49033ecf1ecbe3a9a3",
"score": "0.5258519",
"text": "def file_begin(file)\n end",
"title": ""
},
{
"docid": "bb354a7753f5346608ef6aae910d3a1d",
"score": "0.5256562",
"text": "def opened\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "10b2641b7e97433f30ab9c4337043e74",
"score": "0.52387965",
"text": "def export(fileName, format)\n raise \"Not implemented\"\n end",
"title": ""
},
{
"docid": "85879668b5ec46c08a4aa9e2e0c84ba8",
"score": "0.52272713",
"text": "def do_format(src, format_spec_str)\r\n spec_info = SpecInfo.new(src, \"\", self)\r\n\r\n due_process(spec_info, format_spec_str) do |format|\r\n spec_info.do_format(format)\r\n end\r\n end",
"title": ""
}
] |
9843ddfbf498aff6f72be46944cd9c4e
|
I worked on this challenge by myself. Your Solution Below
|
[
{
"docid": "bc3a1c244420891c87396daeeb7e6e7a",
"score": "0.0",
"text": "def array_concat(array_1, array_2)\n #avoiding array_1 + array_2 in order to use iteration\n result = []\n\n array_1.each do |el|\n result << el\n end\n\n array_2.each do |el|\n result << el\n end\n\n result\nend",
"title": ""
}
] |
[
{
"docid": "b9960478999684c2b536f76e22f6fc63",
"score": "0.66699874",
"text": "def solution4(input)\n end",
"title": ""
},
{
"docid": "f712d49ec6c615538b2e2aa846391fda",
"score": "0.65802413",
"text": "def challenge; end",
"title": ""
},
{
"docid": "aa89b26c8848588848ff622b5d313173",
"score": "0.65513563",
"text": "def solution\n 31875000\nend",
"title": ""
},
{
"docid": "61a5aa5387d7586d627164f40eaf623a",
"score": "0.6467789",
"text": "def solution6(input)\n end",
"title": ""
},
{
"docid": "4ad68ebce1b425c551899d5fbdae814f",
"score": "0.63802695",
"text": "def solution(arr)\n\nend",
"title": ""
},
{
"docid": "c3cb3e948c27b241ea4299b2df1fa4b3",
"score": "0.63722986",
"text": "def solution5(input)\n end",
"title": ""
},
{
"docid": "c3cb3e948c27b241ea4299b2df1fa4b3",
"score": "0.63722986",
"text": "def solution5(input)\n end",
"title": ""
},
{
"docid": "ce13cdc311c17978cf37cab76555386d",
"score": "0.63630974",
"text": "def challenge\n end",
"title": ""
},
{
"docid": "75140bd92377e07bd7367ec852f43d4d",
"score": "0.6359476",
"text": "def solution(arr) end",
"title": ""
},
{
"docid": "6979036015fac47c519d3834b2c5c971",
"score": "0.6346116",
"text": "def sort_string(string)\r\n # your code here\r\n a = string.split(\" \")\r\n b = a.sort{|x,y| x.length <=> y.length}\r\n b[0]<<' '<<b[1]<<' '<<b[2]\r\nend\r\n\r\n\r\n# Select random elements from an array\r\n\r\ndef random_select(array, n)\r\n # your code here\r\n len = array.size\r\n result = []\r\n n.times do \r\n result = result << array[rand(len)] \r\n end\r\n return result\r\nend\r\n\r\n\r\n# Find the length of strings in an array\r\n\r\ndef length_finder(input_array)\r\n out_arr = []\r\n input_array.each do |i|\r\n out_arr = out_arr << i.length\r\n end\r\n return out_arr\r\nend\r\n\r\n\r\n# Hiring Programmers - Boolean Expressions in Ruby\r\n\r\nis_an_experienced_programmer = (\r\n (candidate.years_of_experience >= 2 || candidate.github_points >= 500) && candidate.languages_worked_with.include?(\"Ruby\") && candidate.age >= 15 && !candidate.applied_recently?\r\n )\r\n \r\n \r\n# Palindromes \r\n\r\ndef palindrome?(sentence)\r\n # Write your code here\r\n sentence = sentence.downcase.gsub(' ','')\r\n reverse = ''\r\n i = 1\r\n sentence.length.times do\r\n reverse = reverse << sentence[-i]\r\n i = i.next\r\n end\r\n return reverse == sentence\r\nend\r\n\r\n\r\n# Compute sum of cubes for given range\r\n\r\ndef sum_of_cubes(a, b)\r\n # Write your code here\r\n i = a\r\n result = i**3\r\n loop do\r\n if i == b \r\n break\r\n else\r\n i = i + 1\r\n result = result + i**3\r\n end\r\n end\r\n return result\r\nend\r\n \r\n \r\n# Find non-duplicate values in an Array\r\n\r\ndef non_duplicated_values(values)\r\n # Write your code here\r\n out_arr = values\r\n values.each do |x|\r\n n = values.select {|y| y == x}\r\n if n.length > 1\r\n out_arr.delete_if {|y| y == x}\r\n end\r\n end\r\n return out_arr\r\nend\r\n\r\n\r\n# Check if all elements in an array are Fixnum\r\n\r\ndef array_of_fixnums?(array)\r\n # Write your code here\r\n n = 0\r\n n = array.select {|x| x.is_a?(String) }\r\n if n.length == 0\r\n return true\r\n else \r\n return false\r\n end \r\nend\r\n\r\n\r\n# Kaprekar's Number\r\n\r\ndef kaprekar?(k)\r\n k2 = k**2\r\n n = \"#{k}\".length\r\n num_digits_k2 = \"#{k2}\".length\r\n right_n = k2 % (10**n)\r\n left = k2 / (10**n)\r\n k == (right_n + left)\r\nend\r\n\r\n\r\n# Number shuffle\r\n\r\ndef number_shuffle(number)\r\n # your code here\r\n len = \"#{number}\".length\r\n arr = []\r\n i = 0\r\n num = 1\r\n len.times do \r\n x = number % 10**(i+1)\r\n arr[i] = x / (10**i)\r\n i = i + 1\r\n num = num * i\r\n end\r\n result = []\r\n loop do \r\n if result.length == num\r\n break\r\n else\r\n x = arr.shuffle\r\n y = 0\r\n i = 10**(arr.length-1)\r\n x.each do |k|\r\n y = y + (k * i)\r\n i = i / 10\r\n end\r\n result.push(y)\r\n result = result.uniq\r\n end\r\n end\r\n return result.sort\r\nend\r\n\r\n\r\n# Time to run code\r\n\r\ndef exec_time(proc)\r\n # your code here\r\n h = Time.now\r\n puts proc.call\r\n n = Time.now\r\n return n - h \r\nend\t\r\n\r\n\r\n# Your sum\r\n\r\nclass MyArray\r\n attr_reader :array\r\n\r\n def initialize(array)\r\n @array = array\r\n end\r\n\r\n def sum(initial_value = 0)\r\n if block_given?\r\n res = initial_value\r\n array.each do |i|\r\n res = res + yield(i)\r\n end\r\n return res\r\n else\r\n res = initial_value\r\n array.each do |i|\r\n res = res + i\r\n end\r\n return res\r\n end\r\n end\r\nend\r\n\r\n\r\n# Orders and costs\r\n\r\nclass Restaurant\r\n def initialize(menu)\r\n @menu = menu\r\n end\r\n\r\n def cost(*orders)\r\n # your code here\r\n total = 0\r\n orders.each do |ord|\r\n ord.each do |i, q|\r\n p = @menu[i]\r\n c = p * q\r\n total = total + c\r\n end\r\n end\r\n return total\r\n end\r\nend\r\n\r\n\r\n# Enough Contrast?\r\n\r\nclass Color\r\n attr_reader :r, :g, :b\r\n def initialize(r, g, b)\r\n @r = r\r\n @g = g\r\n @b = b\r\n end\r\n\r\n def brightness_index\r\n # your code here\r\n return ( 299 * r + 587 * g + 114 * b) / 1000\r\n end\r\n\r\n def brightness_difference(another_color)\r\n #your code here\r\n return (brightness_index - another_color.brightness_index).abs\r\n end\r\n\r\n def hue_difference(another_color)\r\n #your code here\r\n return ((r - another_color::r).abs + (g - another_color::g).abs + (b - another_color::b).abs)\r\n end\r\n\r\n def enough_contrast?(another_color)\r\n # your code here\r\n if brightness_difference(another_color) > 125 && hue_difference(another_color) > 500 \r\n true\r\n else\r\n false\r\n end\r\n end\r\nend\r\n\r\n\r\n",
"title": ""
},
{
"docid": "95c5d00f6fd8f5d6f4b7368744a1a4b6",
"score": "0.63352275",
"text": "def solution2(input)\n end",
"title": ""
},
{
"docid": "95c5d00f6fd8f5d6f4b7368744a1a4b6",
"score": "0.63352275",
"text": "def solution2(input)\n end",
"title": ""
},
{
"docid": "0e4cda0adbc8b5aecd2938d89a067613",
"score": "0.632988",
"text": "def solution(s)\n\nend",
"title": ""
},
{
"docid": "c3a6c4ddb76579e45e3cbe80fba426be",
"score": "0.62856966",
"text": "def solution(a)\r\n # write your code in Ruby 2.2\r\n\r\n l=a.count-1\r\n arr=[]\r\n \r\n \r\n loop do\r\n arr[a[l]-1] = a[l]\r\n \r\n l-=1\r\n break if l<0\r\n end\r\n \r\n if arr.count == a.count\r\n return 1\r\n else\r\n return 0\r\n end\r\n \r\n \r\nend",
"title": ""
},
{
"docid": "0b7a616cc7822be314b767ef2b841fa3",
"score": "0.62496275",
"text": "def solution3(input)\n end",
"title": ""
},
{
"docid": "4a21fd90da81a02895a7e32078bf0946",
"score": "0.6226581",
"text": "def solution(a)\r\n # write your code in Ruby 2.2\r\n \r\n i=0;\r\n l=a.count\r\n arr=[]\r\n p=0\r\n loop do\r\n arr[a[i]-1] = a[i]\r\n i+=1\r\n \r\n if(i==l)\r\n k=1;\r\n \r\n for j in arr\r\n if(k!=j)\r\n p=k\r\n break\r\n end\r\n k+=1\r\n end\r\n \r\n break\r\n end\r\n end\r\n \r\n \r\n p\r\nend",
"title": ""
},
{
"docid": "578a4c2088c4d8ec64fbe2465745ad9e",
"score": "0.6209405",
"text": "def solution(a)\r\n # write your code in Ruby 2.2\r\n #0 -east\r\n #1 - west\r\n \r\n\r\n\r\n arr=[]\r\n n=0\r\n a.each_with_index{|el,i|\r\n \r\n if(el==0)\r\n j=i\r\n loop do\r\n if (a[j] == 1)\r\n n+=1\r\n end\r\n \r\n j+=1 \r\n break if j==a.count \r\n end\r\n \r\n end\r\n \r\n }\r\n \r\n n\r\nend",
"title": ""
},
{
"docid": "4f7342b3592ec209d29fa49774767bb7",
"score": "0.6207806",
"text": "def solve\n d = %w(1 2 3 4 5 6 7 8 9).permutation.map {|i| i.join}.select {|i| i >= '918273645'}.reverse\n \n d.each do |i|\n 1.upto( 4 ) do |j|\n s = i[0, j]\n n = s.to_i\n\n 2.upto( 5 ) do |k|\n s += (k * n).to_s\n return i.to_i if i == s # puts \"%s (1..%d x %d)\" % [i, k, n]\n\n break if !i.start_with?( s )\n end\n end\n end\n end",
"title": ""
},
{
"docid": "fcdc7a5e867d3db0a4e4c61dc4d4da37",
"score": "0.615957",
"text": "def solution(a)\n # write your code in Ruby 1.9.3\n go_east = 0\n pass = 0\n a.each do |x|\n if x == 0\n go_east += 1\n else\n pass += go_east\n if pass > 100000\n return -1\n end\n end\n end\n\n return pass\n\nend",
"title": ""
},
{
"docid": "e332393e33f7fc2992053e0a24864665",
"score": "0.6157597",
"text": "def rps_tournament_winner(input_encoded)\n lookup_list=Hash[\"rr\"=>0,\"sr\"=>1,\"pr\"=>0,\"rs\"=>0,\"ss\"=>0,\"ps\"=>1,\"rp\"=>1,\"sp\"=>0,\"pp\"=>0]\n xx=input_encoded.flatten.each_slice(2).to_a.each_slice(2).to_a\n\n #d is the variable that holds the size of the flattened input array.\n #Since each entry in input array consists of two elements: Name and strategy\n #Iterations required are the output value of exp_value (d)-1\n\n d=input_encoded.flatten.size\n iteration=exp_value(d)-1\n for round in 0..(iteration-1)\n c=Array.new(xx.size)\n for i in 0..((xx.size)-1)\n input=xx[i]\n string_check=(\"#{input[0][1]}\"+\"#{input[1][1]}\").downcase\n c[i]=input[lookup_list[string_check]]\n end\n d=c.flatten.size\n xx=c.flatten.each_slice(2).to_a.each_slice(2).to_a\n end\n puts \"#{xx}\"\nend",
"title": ""
},
{
"docid": "a3673282e059d6bf8c5ab07271621102",
"score": "0.61411536",
"text": "def algorithm(input)\n\nend",
"title": ""
},
{
"docid": "3f0b67819d2d89164741586a25635d60",
"score": "0.61301",
"text": "def return_base_candidate(base_char, base_counter, target_char_arr)\n base_candidate = []\n target_counter = 0\n target_char_arr.each do |target_char|\n verdict = base_char == target_char\n base_candidate << (base_counter - target_counter).abs if verdict\n target_counter += 1\n end\n base_candidate\nend",
"title": ""
},
{
"docid": "0ca6103b0871aec6eb1b1507a0b276fe",
"score": "0.61247694",
"text": "def solution\n end",
"title": ""
},
{
"docid": "e64ab9041d127fd863cb8cc14dea830e",
"score": "0.6082147",
"text": "def solve_challenge(input)\n sum = 0\n last_index = input.length - 1\n char1 = ''\n char2 = ''\n input.split('').each_with_index do |ch, i|\n char1 = ch\n # circle around list if index is at the end\n if i == last_index\n char2 = input[0]\n # otherwise just grab the next character\n else\n char2 = input[i+1]\n end\n # add to sum if the 2 characters match\n sum += char1.to_i if char1 == char2\n end\n sum\nend",
"title": ""
},
{
"docid": "15a47b49e9abd1e4a0e1f3149d80bbf9",
"score": "0.60772085",
"text": "def solution(s, p, q)\n # write your code in Ruby 2.2\n letters = { 'A' => 1, 'C' => 2, 'G' => 3, 'T' => 4 }\n n = s.size\n res = []\n\n p_sums = Hash.new { |k,v| k[v] = Array.new(n + 1, 0) }\n\n letters.keys.each do |letter|\n for i in 1..n do\n p_sums[letter][i] = p_sums[letter][i -1]\n p_sums[letter][i] += 1 if s[i-1] == letter\n end\n end\n # puts \"#{p_sums}\"\n\n i = 0\n for i in i..p.size-1 do\n # puts \"== #{i}\"\n letters.keys.each do |k|\n # puts \"#{k} | P: #{p[i]} Q: #{q[i]} | #{p_sums[k][p[i]]} #{p_sums[k][q[i]+1]}\"\n if p_sums[k][p[i]] != p_sums[k][q[i]+1]\n res << letters[k]\n break\n end\n end\n end\n res\n\n \nend",
"title": ""
},
{
"docid": "ebe5a0091303805783ef29b8c45ffb08",
"score": "0.607316",
"text": "def pe43()\ntotal = 0\narr = [0,1,2,3,4,5,6,7,8,9].permutation\narr.each do |e|\n\tif(e[1..3].join.to_i % 2 != 0) then next end\n\tif(e[2..4].join.to_i % 3 != 0) then next end \n\tif(e[3..5].join.to_i % 5 != 0) then next end \n\tif(e[4..6].join.to_i % 7 != 0) then next end \n\tif(e[5..7].join.to_i % 11 != 0) then next end \n\tif(e[6..8].join.to_i % 13 != 0) then next end \n\tif(e[7..9].join.to_i % 17 != 0) then next end\n\tprintf \"answer %s\\n\", e\n\ttotal += e.join.to_i\n\t#p e\n\tend\n\tprintf \"the total is %d\\n\", total\nend",
"title": ""
},
{
"docid": "f8b13ae90c3f70410bf86714d6d49eef",
"score": "0.60424477",
"text": "def solution(n)\n # write your code in Ruby 2.2\n s = n.to_s(2) \n zeroes = s.split('1') \n zeroes.pop if !n.odd? \n return 0 if zeroes.empty? \n zeroes.map { |x| x.length}.max\nend",
"title": ""
},
{
"docid": "afb7c27a8561349d77eac5d9bd751021",
"score": "0.6040608",
"text": "def solution(a)\n # write your code in Ruby 2.2\n east = 0\n pass = 0\n \n a.each do |dir|\n if dir == 0\n east += 1\n else\n pass += east\n return -1 if pass > 1000000000\n end\n end\n \n pass\nend",
"title": ""
},
{
"docid": "af5213168e0ee82b120bec44b2735af5",
"score": "0.60262865",
"text": "def solution(a)\n size = 0\n value = -1\n (0..(a.length-1)).each do |i|\n if(size == 0)\n size = 1\n value = a[i]\n else\n if(value != a[i])\n size = size - 1\n else\n size = size + 1\n end\n end\n end\n\n candidate = -1\n leader = -1\n count = 0\n leader_indices = []\n\n if(size > 0)\n candidate = value\n end\n\n (0..(a.length-1)).each do |i|\n if a[i] == candidate\n count = count + 1\n end\n leader_indices << count\n end\n\n if count > (a.length/2)\n leader = candidate\n end\n\n leaders_count = 0\n\n if(leader != -1)\n (0..(a.length-1)).each do |i|\n a_1 = a[0..i]\n a_2 = a[(i+1)..(a.length-1)]\n\n count_2 = leader_indices[i]\n\n # puts \"count_2 #{count_2} , count #{a_1.length/2}\"\n # puts \"count_2 #{count_2} , (count-count_2) #{(count-count_2)}, count #{(a_2.length/2)}\"\n\n if count_2 > (a_1.length/2) && (count-count_2) > (a_2.length/2)\n leaders_count = leaders_count + 1\n end\n\n # puts leaders_count\n # puts\n end\n end\n\n leaders_count\nend",
"title": ""
},
{
"docid": "24f189fd6b3cfc4aaa92f93d03441d85",
"score": "0.60253894",
"text": "def solution(a)\n zeroes = 0\n passes = 0\n a.each do |c|\n zeroes += 1 if c == 0\n passes += zeroes if c == 1\n return -1 if passes > 1000000000\n end\n passes\nend",
"title": ""
},
{
"docid": "285d2e49c760ed24f2673411b06f6a8c",
"score": "0.6009158",
"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": "d03588aa68750f6833edf819df1446ea",
"score": "0.60057217",
"text": "def get_challenge_answer(var1)\n string = '' + var1\n array = string.split('')\n array = array.reverse\n last_digit = array[0].to_i\n array = array.sort\n min_digit = array[0].to_i\n subvar1 = (2 * array[2].to_i) + (array[1].to_i)\n subvar2 = (2 * array[2].to_i).to_s + array[1]\n power = ((array[0].to_i * 1) + 2) ** array[1].to_i\n x = (var1.to_i * 3 + subvar1)\n y = Math.cos(Math::PI * subvar1)\n answer = x * y\n answer -= power\n answer += (min_digit - last_digit)\n answer = answer.floor.to_s + subvar2\n return answer\nend",
"title": ""
},
{
"docid": "7a007b872ce37620e3363cea2761da98",
"score": "0.5998596",
"text": "def solution(a)\n # write your code in Ruby 2.2\n sum = a.inject(0, :+)\n n = a.length\n expected = n * (n+1)/2\n diff = sum - expected\n missing = n + 1 - diff\nend",
"title": ""
},
{
"docid": "72bb3b989efb9ec765190d8962bff157",
"score": "0.5996397",
"text": "def solution(a)\n # write your code in Ruby 1.9.3\n count = Array.new(a.length,0)\n a.each do |e|\n return 0 if e > a.length\n count[e-1] += 1 \n end\n \n (1..count.length-1).each do |i|\n return 0 if count[i]!=1 || count[i] > 1\n end\n \n return 1\nend",
"title": ""
},
{
"docid": "184978b34707e2c9d190e35b6305dd56",
"score": "0.5984823",
"text": "def solution(n)\n a = n.to_s(2).split('')\n count, start, store = 0,0,0\n a.each do |i|\n start = 1 if i == '1' && count == 0\n count +=1 if i == '0' && start ==1\n if i=='1' && count > 0\n store = count if count > store\n count = 0\n end\n end\n store\nend",
"title": ""
},
{
"docid": "56e2f4c229d68e9d667cf5f5fe1d2177",
"score": "0.59794724",
"text": "def solution(a)\r\n # write your code in Ruby 2.2\r\n #a[0] = 1 [-1..1]\r\n #a[1] = 5 [-4..6]\r\n #a[2] = 2 [0..4]\r\n #a[3] = 1 [2..4]\r\n #a[4] = 4 [0..8]\r\n #a[5] = 0 [0]\r\n\r\n i=0\r\n arr=[]\r\n while(i<a.count) do\r\n \r\n arr[i] = (i-a[i].. i+a[i]).to_a\r\n i+=1 \r\n end\r\n \r\n \r\n \r\n l=arr.count\r\n i=0\r\n n=0\r\n while(i<l) do\r\n \r\n \r\n j=i+1\r\n while(j<l) do\r\n if(arr[i] != arr[j])\r\n \r\n if((arr[i] & arr[j]).empty? == false)\r\n n+=1\r\n end\r\n end\r\n j+=1\r\n end \r\n i+=1\r\n end\r\n n\r\nend",
"title": ""
},
{
"docid": "cef825fbfb3afa754f79670aa333d6ef",
"score": "0.59681356",
"text": "def solution(a)\n east = 0\n west = 0\n passing = 0\n for i in a\n case i\n when 0\n east += 1\n when 1\n west += 1\n passing += east\n end\n return -1 if passing > 1_000_000_000\n end\n passing\nend",
"title": ""
},
{
"docid": "2d1f5ffbab8c86bc000cce7ee42c2003",
"score": "0.5950456",
"text": "def solution(array)\n array.sort!\n return 0 if array.length == 1 && array.first != 1\n length = array.length\n start = 1\n length.times do |n|\n if array[start-1] != n + 1\n return 0\n end\n start += 1\n end\n return 1\nend",
"title": ""
},
{
"docid": "19bcd70b66be6f77d40897ae7a005569",
"score": "0.59338856",
"text": "def solution(a)\n east = 0\n passing = 0\n a.each { |v| \n case v\n when 0\n east += 1\n when 1\n passing += east\n return -1 if passing > 1_000_000_000\n end\n }\n passing\nend",
"title": ""
},
{
"docid": "a64e225ff27690e4334e4c789e82bae5",
"score": "0.59297806",
"text": "def solution(n)\r\n # write your code in Ruby 2.2\r\n # puts n\r\n binary = n.to_s(2)\r\n count = 0\r\n temp = 0\r\n \r\n for i in 0..(binary.size)\r\n if binary[i] == \"0\" and binary[i..-1].end_with?(\"1\")\r\n count += 1\r\n else\r\n temp = count if count > temp\r\n count = 0\r\n end\r\n end\r\n temp\r\nend",
"title": ""
},
{
"docid": "6125bfd7debc7af3d6a8a4bffb8ddc0a",
"score": "0.5912512",
"text": "def solution(n)\n # write your code in Ruby 2.2\n b = n.to_s(2)\n a = []\n incr = 0\n s = false\n b.each_char do |char|\n if char == '1'\n if s\n a.push(incr)\n incr = 0\n\n else\n s = true\n end\n else\n incr += 1\n end \n end\n a.max || 0\nend",
"title": ""
},
{
"docid": "ad39c7d5dc657f0494a8726850275ec6",
"score": "0.5902556",
"text": "def number_joy(n)\n\n@n = n\n@counter = 0\n@int_rev = 0\n\ndef integer_total \n arr = @n.to_s.split(\"\").map(&:to_i)\n arr.each do |a| @counter += a\n end \nend\n\ndef is_harshad\n@n%@counter == 0\nend \n\ndef integer_reversed\n@int_rev = @counter.to_s.reverse.to_i\nend\n\ndef joyful_number\nreturn @n == @counter*@int_rev && @n%@counter == 0\nend\n \n\ninteger_total\ninteger_reversed\nis_harshad\njoyful_number\n\nend",
"title": ""
},
{
"docid": "ae10f5e1641f5047aa611f426748fe1d",
"score": "0.5902279",
"text": "def solution(s)\n # write your code in Ruby 2.2\n len = s.length\n return 0 if len == 1\n return -1 if len % 2 == 0\n \n mid = s.length / 2\n (0...mid).each do |i|\n j = len - 1 - i\n return -1 if s[i] != s[j]\n end \n \n mid\nend",
"title": ""
},
{
"docid": "b2d1c4efb0ce3d7f6e9ed6262fcfe11a",
"score": "0.5894646",
"text": "def solve(a)\n # Complete this function\n $sum_1=0\n for i in (0..a.size/2-1)\n \t#puts \"a->#{a[i]}\"\n \t$sum_1=$sum_1+a[i]\n\n end\n #puts $sum\n $sum_2=0\n for i in (a.size/2..a.size-1)\n \t#puts \"b->#{a[i]}\"\n $sum_2=$sum_2+a[i]\n end\n #puts $sum\n $temp=$sum_1-$sum_2\n if $temp < 0\n \treturn $temp*-1\n else\n \treturn $temp\n end\n\nend",
"title": ""
},
{
"docid": "49552ab2769a4e7e83c75ae7c3fe0900",
"score": "0.58866423",
"text": "def solution(a)\n size = 0\n value = -1\n (0..(a.length-1)).each do |i|\n if(size == 0)\n size = 1\n value = a[i]\n else\n if(value != a[i])\n size = size - 1\n else\n size = size + 1\n end\n end\n end\n\n candidate = -1\n leader = -1\n count = 0\n index = -1\n\n if(size > 0)\n candidate = value\n end\n\n (0..(a.length-1)).each do |i|\n if a[i] == candidate\n count = count + 1\n index = i\n end\n end\n\n if count > (a.length/2)\n leader = candidate\n else\n index = -1\n end\n\n index\nend",
"title": ""
},
{
"docid": "6f367f283462dbe1cd9f98c60df8033e",
"score": "0.5884217",
"text": "def solution(a)\n return [] if a.empty?\n target = -zero_sum(a)\n output = a\n sum = 0\n i = 0\n while sum != target\n if (target - sum) % (-2) ** i != 0\n output << 1\n sum +=1\n else\n\n end\n end\nend",
"title": ""
},
{
"docid": "104712d8379b7721c9708b9ad8ec479e",
"score": "0.5874899",
"text": "def solution(a)\n return 0\nend",
"title": ""
},
{
"docid": "6414c693e1602d119655d47413c7c8b6",
"score": "0.5858403",
"text": "def bubunwa\n n, target = gets.chomp.split(\" \").map(&:to_i)\n value = gets.chomp.split(\" \").map(&:to_i)\n dp = Array.new(n+1){ Array.new(target+1, 0) }\n dp[0][0] = 1\n\n n.times do |i|\n (target+1).times do |j|\n dp[i+1][j] |= dp[i][j]\n dp[i+1][j] |= dp[i][j-value[i]] if j >= value[i]\n end\n end\n\n print(dp)\n dp[n][target] == 1 ? 'YES' : 'NO'\nend",
"title": ""
},
{
"docid": "5f8f7bef44de8c5fbf543c1650f70262",
"score": "0.58422846",
"text": "def problem_9(sum)\n array = []\n # Divide the number by two and then subtract one \n # to ensure there are no zeros in the triplet.\n ((sum / 2) - 1).downto(1) { |n| array << n }\n\n # Iterate through possible c values. \n array.each do |c|\n remainder = sum - c\n # Create and iterate another array to run through the \n # difference of the sum and c. \n array2 = (1..remainder).to_a\n array2.each do |a|\n b = remainder - a\n if (a**2 + b**2 == c**2)\n return puts a, b, c\n end\n end\n end\nend",
"title": ""
},
{
"docid": "41d8272b7c7b14be391f11bb61b8cafe",
"score": "0.5838351",
"text": "def solution(a)\n # write your code in Ruby 2.2\n \n counter = 0\n\ttotal = 0\n\t\n\ta.each do |car|\n\t\tcar == 0 ? counter += 1 : total += counter\n\tend\n\t\n\treturn total > 1_000_000_000 ? -1 : total\nend",
"title": ""
},
{
"docid": "4871d41491c1924c30e4fb427988073d",
"score": "0.58363074",
"text": "def solution(s)\n result = 'Funny'\n s = s.codepoints\n r = s.reverse\n\n for i in (1..s.length - 1)\n sum1 = (s[i] - s[i-1]).abs\n sum2 = (r[i]- r[i-1]).abs\n if sum1 != sum2\n result = 'Not Funny'\n break\n end\n end\n\n result\nend",
"title": ""
},
{
"docid": "01d65f828880f2b3ce5cccb589374205",
"score": "0.58324605",
"text": "def problem30\n total = 0\n (10..1000000).each{|n|\n total += n if n == n.to_s.split(\"\").inject(0){|sum,d|sum+=d.to_i**5}\n }\n total\nend",
"title": ""
},
{
"docid": "4a4eefe9eb4327fd1f51637a3d87b34e",
"score": "0.58233577",
"text": "def solution(a)\n a2 = (1..(a.size+1)).to_a\n r = a2-a\n return r.join(\"\").to_i\nend",
"title": ""
},
{
"docid": "e4bf969521382732ac79be40ffa78c87",
"score": "0.5812188",
"text": "def solution(a)\r\n ones=0\r\n temp=0\r\n ans=0\r\n for i in 0...a.size\r\n if a[i]==1\r\n ones+=1\r\n end\r\n end\r\n \r\n for i in 0...a.size\r\n if a[i]==1\r\n temp+=1\r\n else\r\n ans+=(ones-temp)\r\n end\r\n end\r\n \r\n if ans>1000000000\r\n return -1\r\n else\r\n return ans\r\n end\r\n \r\n \r\nend",
"title": ""
},
{
"docid": "fc35b048eb13fc75ee083d79e84ff6a6",
"score": "0.581162",
"text": "def thirt(n)\n # your code\n remainders = [1, 10, 9, 12, 3, 4]\n rlen = 6\n num = n\n result = 0\n result_arr = []\n loop do \n num_arr = num.to_s.split('').map { |i| i.to_i}\n while remainders.length <= num_arr.length do \n remainders << (10 ** rlen) % 13\n rlen += 1\n end\n x = 0\n y = num_arr.length - 1\n temp = []\n while x < remainders.length && y >= 0 do \n temp_num = remainders[x] * num_arr[y]\n temp << temp_num\n x += 1\n y -= 1\n end\n num = temp.reduce(:+)\n if num == result_arr[-1]\n result = num \n break\n end\n result_arr << num\n end\n result \nend",
"title": ""
},
{
"docid": "69696aa2a624b4ca18ebf88d4181f524",
"score": "0.58107316",
"text": "def solution(s, p, q)\n # write your code in Ruby 2.2\n factor = nil\n arr = []\n i = 0\n res = []\n \n for i in 0...s.length do \n case s[i]\n when 'A'\n arr << 1\n when 'C'\n arr << 2\n when 'G'\n arr << 3\n when 'T'\n arr << 4\n end\n end\n \n #puts \"#{arr.to_s} #{s} #{p.to_s} #{q.to_s}\"\n \n i = 0\n for i in 0...p.size do\n tmp = arr.slice(p[i],q[i] - p[i] + 1)\n #puts \"#{tmp}\"\n res << tmp.min\n end\n #puts \"#{res}\"\n \n res\n \nend",
"title": ""
},
{
"docid": "99fb7178f1715b614ed9876d96f0e2ba",
"score": "0.5807164",
"text": "def solution(a)\n\n count = {}\n permutation = 1\n\n a.each do |a_i|\n if(count[a_i].nil?)\n count[a_i] = 0\n end\n count[a_i] = count[a_i] + 1\n end\n\n (1..a.length).each do |i|\n if count[i].nil?\n permutation = 0\n break\n end\n end\n\n permutation\nend",
"title": ""
},
{
"docid": "4adcd8ce1f663221c3c23c720e9dae18",
"score": "0.58047974",
"text": "def solution(n)\n counter_array = Array.new(n.size+1, 0)\n n.each do |v|\n counter_array[v-1] = 1\n end\n counter_array.find_index(0) + 1\nend",
"title": ""
},
{
"docid": "4ddb265e96896424132c7b9abe9713d5",
"score": "0.5801897",
"text": "def ArithGeo_2(arr)\n#test for arithmetic sequence first\n #sum from i = 1 to n, = n(n+1) / 2 for sum of 1 .. n\n #general sum of an arithmetic sequence\n #a[1] - a[0] = delta\n #a[0] = a\n #arr.size = n\n #sum = a * n + delta( n(n-1) / 2 )\n sum = arr.sum\n arith_sum = arr[0] * arr.size + (arr[1] - arr[0]) * ((arr.size - 1) * (arr.size) / 2 )\n return \"Arithmetic\" if sum == arith_sum\n\n#test for geometric sequence next\n #sum from i = 1 to n, = { (a * (1 - r ** n) ) / (1 - r) }\n r = arr[1] / arr[0]\n a = arr[0]\n n = arr.size\n geo_sum = (a * (1 - (r ** n)) ) / (1 - r) if r != 1\n if r == 1\n return \"-1\"\n end\n return \"Geometric\" if geo_sum == sum\n\n\n return \"-1\"\nend",
"title": ""
},
{
"docid": "1c498ff5848b8ea7cad89ed3ead7eed4",
"score": "0.5794777",
"text": "def solution(a)\n max = a.length + 1\n (1 + max) * max / 2 - a.inject(0, &:+)\nend",
"title": ""
},
{
"docid": "200b676337f3c42b05ef229f1de10cfe",
"score": "0.5790962",
"text": "def solution(s)\n binary_digits = s.length\n sum = 0\n decimal = 0\n s.split(//).each do |digit|\n binary_digits -= 1\n decimal = digit.to_i*(2**binary_digits)\n sum += decimal\n end\n\n number_of_steps = 0\n\n while sum != 0 do\n if sum % 2 == 0\n (sum /= 2)\n number_of_steps += 1\n else\n sum -= 1\n number_of_steps += 1\n end\n end\n return number_of_steps\nend",
"title": ""
},
{
"docid": "d198ce6530d8641577166dd071790bfa",
"score": "0.5789498",
"text": "def hard(string)\n sum = 0\n steps = string.length / 2\n string.length.times do |i|\n j = (i + steps) % string.length\n sum += check(string[i], string[j])\n end\n sum\nend",
"title": ""
},
{
"docid": "c521b44b316f68b7464f276a8f17939d",
"score": "0.5788204",
"text": "def find_judge_imp(n, trust)\n return -1 if trust.length < n - 1\n return n if trust.empty?\n \n degree = Array.new(n+1, 0)\n trust.each do |t|\n degree[t[0]] -= 1\n degree[t[1]] += 1\n end \n \n (0..n).each do |i|\n return i if degree[i] == n-1\n end\n return -1\nend",
"title": ""
},
{
"docid": "fbbbcb3b0e2fef3847603a76fc2312d6",
"score": "0.57724655",
"text": "def day_1_part_2(sequence)\n sequence_digits = sequence.chars.map(&:to_i)\n sequence_digits_reference = sequence_digits * 2\n\n sum = 0\n\n sequence_digits.each.with_index do |digit, i|\n sum += digit if digit == sequence_digits_reference[i + sequence.length / 2]\n end\n\n sum\nend",
"title": ""
},
{
"docid": "7d39621c48b479f5655668543f90521b",
"score": "0.5769823",
"text": "def solution(x, a)\n # write your code in Ruby 2.2\n\n count = [0]*(x+1)\n sum = 0\n \n a.each_with_index do |v, i|\n if count[v] == 0\n count[v] = 1\n sum += 1\n if sum == x\n return i\n end\n end\n end\n\n return -1\nend",
"title": ""
},
{
"docid": "74564264f1686bcc41e20e21a5010b08",
"score": "0.57693917",
"text": "def solution(a)\n s = 0\n e = 1\n a.each { |v| \n s += v * e\n e *= -2\n }\n\n s = -s\n\n x = 0xAAAAAAAA\n r = (s + x) ^ x\n r = (\"%b\" % r).reverse.split(//).map { |b| b.to_i }\n r == [0] ? [] : r\nend",
"title": ""
},
{
"docid": "9d68e3c0b584ea1d0cdffedbaff6ec0f",
"score": "0.57583934",
"text": "def self_describing_numbers array\n\tfor i in 0..array.size-1 do \n\t\tvalue = array[i].to_i\n\t\tfor x in 0..array.size-1 do\n\t\t\tif i === array[x].to_i\n\t\t\t\tvalue -= 1\n\t\t\tend\n\t\tend\n\t\tif value != 0 \n\t\t\treturn 0\n\t\tend\n\tend\n\treturn 1;\nend",
"title": ""
},
{
"docid": "22a12438f1c1fc5bbca224af53e738d8",
"score": "0.57554716",
"text": "def solution(a, b)\r\n @a = a\r\n @b = b\r\n \r\n if @a.length < @b.length\r\n return @a + @b + @a\r\n \r\n elsif @b.length < @a.length\r\n return @b + @a + @b\r\n \r\n else\r\n return @a + @b\r\n end\r\nend",
"title": ""
},
{
"docid": "0ec06a74a4d696696e1aadd093ff4233",
"score": "0.5754215",
"text": "def solution\n each.map(&:to_i).join()\n end",
"title": ""
},
{
"docid": "5e98e4711f4be0fc95af187b1e62b8b4",
"score": "0.5753289",
"text": "def vigenere_find_key_probable_key_length(alphabet, ary2)\n count = 0\n i = 0\n 0.upto(50) do |r|\n temp = ary2[0...ary2.length].chars.rotate(r).join\n #puts temp\n temp.each_char do |x|\n if x == ary2[i] && alphabet[x] != 0\n count +=1\n end\n i +=1\n end\n puts \"#{r} and #{count}\"\n count = 0\n i=0\n end\nend",
"title": ""
},
{
"docid": "07a10d2fcc160a93377ffbd3e8801775",
"score": "0.5751563",
"text": "def solve(input)\n numbers = input.to_s.split(\"\").map(&:to_i)\n length = numbers.size\n first = numbers[0]\n\n total = 0\n\n step = length / 2\n numbers.each_with_index do |number, index|\n next_position = (index + step) % length\n if numbers[next_position] == number\n total += number\n end\n end\n\n total\nend",
"title": ""
},
{
"docid": "fa433772252a91aeffff2cb85466232a",
"score": "0.5745836",
"text": "def pe59s4()\n\tct = File.open(\"cipher1.txt\").read.gsub(/\\n/,\"\").split(\",\").map {|x| x.to_i}\n\tpwLength = 3\n\tpw = ('a'..'z').to_a\n\tpw = pw.product(pw,pw).map {|x| x.join}\n\twl = {} # try to use hash for performance\n\tFile.open(\"shortWordList.txt\").read.split.map {|word| wl[word] = 1}\n\tpw.each_with_index do |e, index|\n\t\tc = 0\n\t\tdecode = []\n\t\tct.each do |x|\n\t\t\tif(c == pwLength) then c = 0 end\n\t\t\td = (x ^ e[c][0].ord).chr\n\t\t\tdecode.push(d)\n\t\t\tc += 1\n\t\tend\n\t\t#p decode\t\n\t\tdecode2 = decode.join.split(' ')\n\t\t#decode2 = decode.split(' ')\n\t\tpassrate,matches= 15,0\n\t\tdecode2.each_with_index do |t, index|\n\t\t\tif(wl.has_key?(t)) then\n\t\t\t\tmatches += 1\n\t\t\t\tif(matches > passrate) then\n\t\t\t\t\tprintf \"found solution - key = %s\\nDecode = %s\\n\",e, decode2\n\t\t\t\t\tasciiTotal = 0\n\t\t\t\t\tasciiTotal = decode.map {|z| z[0].ord}.reduce(:+)\n\t\t\t\t\tprintf \"total acsii values = %d\\n\", asciiTotal\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\tend\n\t\tend\t\t\n\tend\n printf \"password not found\\n\"\nend",
"title": ""
},
{
"docid": "e7dbd8470b8249f8dd5323ce2f51d289",
"score": "0.57449085",
"text": "def featured(n)\n (n+1).upto(9_999_999_999) do |i|\n i_as_array = i.to_s.chars\n if i.odd? &&\n i % 7 == 0 &&\n i_as_array == i_as_array.uniq\n return i\n else\n next\n end\n end\n puts \"There is no possible number that fulfills those requirements\"\nend",
"title": ""
},
{
"docid": "e919dd7f275dbbc97c90ea374891336c",
"score": "0.57397836",
"text": "def featured(n)\n star_num = (n / 7) + 1\n while true\n result = star_num * 7\n if result.odd? && (result.to_s.chars.uniq == result.to_s.chars)\n return result\n else\n star_num += 1\n end\n end\nend",
"title": ""
},
{
"docid": "32a0ef79e59e9f9547a01b3fcc7312dd",
"score": "0.5739483",
"text": "def solution(a)\n acc = 0\n sum = 0\n\n a.each do |n|\n if n == 0\n acc += 1\n else\n sum += acc\n end\n\n return -1 if sum > 1000000000\n end\n\n sum\nend",
"title": ""
},
{
"docid": "b8ddeb9ad1e7543e50f26119b0b5db78",
"score": "0.573317",
"text": "def solution(s, p, q)\n # write your code in Ruby 2.2\n hash = { 'A'=> 1, 'C'=> 2, 'G'=> 3, 'T'=> 4 }\n array = []\n p.each_with_index do |e, i|\n low = 4\n cut = s[p[i]..q[i]]\n cut.each_char { |c| low = hash[c] if hash[c] < low }\n array.push(low)\n end\n array\nend",
"title": ""
},
{
"docid": "354acc44d23902170d18ef50bb27f5b1",
"score": "0.5732434",
"text": "def dynamic_programming(sorted)\n acc = { sorted.length - 1 => 1 }\n result = 1\n (2..sorted.length).each do |offset|\n (sorted.length - offset + 2...sorted.length).each do |index|\n break unless sorted[index] - sorted[sorted.length - offset] <= 3\n\n result += acc[index]\n end\n acc[sorted.length - offset] = result\n end\n result\nend",
"title": ""
},
{
"docid": "d68037289e371e5d37c017896d6d44f4",
"score": "0.5731469",
"text": "def problem_92\n hit = 0\n seen = {0 => 0, 1 => 1, 89 => 89}\n\n check = lambda do |n|\n# puts n.inspect\n index = n.join.to_i\n return 0 if index == 0\n sum = index\n until seen[sum] do\n sum = sum.to_s.each_byte.map {|b| (b-48)*(b-48)}.reduce(&:+)\n end\n# puts \"#{n} => #{seen[sum]}\"\n seen[index] = seen[sum]\n end\n\n values = lambda do |a,off|\n (a[off-1] .. 9).each do |v|\n a[off] = v\n if off == (a.length-1)\n if check.call(a) == 89\n # now many uniq permutations of 'a' are there.\n if true\n hit += a.permutations\n else\n h = {}\n a.my_permutate {|a| h[a.join] = true }\n hit += h.size\n end\n end\n else\n values.call(a,off+1)\n end\n end\n end\n\n a = Array.new(7,0)\n values.call(a,0)\n puts \"seen.length = #{seen.length}\"\n hit\nend",
"title": ""
},
{
"docid": "48f6ccd13854a541bfcb18ff7c741f02",
"score": "0.57271665",
"text": "def part1(input)\n twos = threes = 0\n\n # For each ID, bucket each char and count their instances within the ID.\n # Originally, I'd tried to sort the chars and use a regex, but getting\n # around the awkwardness of backtracking and detecting the twos that aren't\n # also threes (or more) wasn't worth the effort on this exercise.\n input.each do |id|\n counts = id.chars.group_by(&:to_s).values.map(&:size)\n\n twos += 1 if counts.include?(2)\n threes += 1 if counts.include? (3)\n end\n\n return twos * threes\nend",
"title": ""
},
{
"docid": "9b08bf7229e89a24053944eca0877096",
"score": "0.57252884",
"text": "def solution(numbers)\n results = []\n current_range = ''\n \n numbers.each_with_index do |num, idx|\n if index == 0 || (numbers[idx + 1] - num != 1 && num - numbers[idx - 1] != 1)\n results << num.to_s\n else\n \n end\n \n end\nend",
"title": ""
},
{
"docid": "051f4958111b5affc5467e0cb5821621",
"score": "0.5718415",
"text": "def solution(n)\n return 1 if n < 10\n str = n.to_s\n len = str.size\n non_zerostr = str.gsub(/0/, '')\n non_zeros = non_zerostr.size\n zeros = len - non_zeros\n unique = non_zerostr.split('').uniq.size\n\n# puts \" -- len: #{len} non-zero: #{non_zeros} zeros: #{zeros} unique: #{unique}\"\n\n perms = (1..unique).inject(:*)\n perms += (perms * zeros) if perms > 1\n perms += (perms * (non_zeros - unique))\n\n return perms\nend",
"title": ""
},
{
"docid": "d8c7e466895447678dd7cf9777fdc737",
"score": "0.57124263",
"text": "def count(n,m)\n if n == 1\n 1\n elsif m == 1\n n \n else\n alphabet = Array.new(n){ |i| bad?(i,n) }\n puts alphabet.inspect\n alphabet = Array.new(n){ |i| i}\n for x in 0...n\n result = alphabet.inject('') do |result, i|\n result << \" \" << follows?(x,i,n)\n end\n puts \"#{x+1} : #{result}\"\n end\n end\nend",
"title": ""
},
{
"docid": "4eca9f41696aadce1b24ca5fa0f6a46b",
"score": "0.57000816",
"text": "def solve input \n return 0 if input <= 1\n return 1 if input == 2\n \n total_slices = 1\n step = 1\n \n 3.upto(input) do |i|\n step += 1 if i%2 == 0\n total_slices += step\n \n end\n\n total_slices\nend",
"title": ""
},
{
"docid": "3d02a7f9120004708cd3b8e4ab6b66bc",
"score": "0.56972545",
"text": "def my_function_brute(arg)\n new_arr = []\n arg.each_with_index do |n, i|\n arg[i+1..-1].each do |o|\n new_arr.push(o - n)\n end\n end\n max_value = new_arr.max\n return \"Best Profit: #{max_value}\"\nend",
"title": ""
},
{
"docid": "6faeb6df6d597ee8c97b9f564742f2b5",
"score": "0.5697212",
"text": "def solution(x, a)\n # write your code in Ruby 2.2\n map = {}\n i = 0\n while i < a.length do\n n = a[i]\n map[n] = true\n\n break if map.length == x\n\n i += 1\n end\n\n if i < a.length\n i\n else\n -1\n end\nend",
"title": ""
},
{
"docid": "1f0955975a10a26277bd0d9fb51a00f1",
"score": "0.5695908",
"text": "def solution(s)\n t = 0\n (s.length / 3).times do |i|\n slice = s[(3 * i)..(3 * i + 2)]\n t += 1 if slice[0] != 'S'\n t += 1 if slice[1] != 'O'\n t += 1 if slice[2] != 'S'\n end\n t\nend",
"title": ""
},
{
"docid": "3c080ecd4a31cd4fb7918a7b87480031",
"score": "0.5693561",
"text": "def solution(num_steps)\n return 1 if num_steps == 0\n return 0 if num_steps < 0\n\n solution(num_steps - 3) + solution(num_steps - 2) + solution(num_steps - 1)\nend",
"title": ""
},
{
"docid": "28af4f93a91e45878228e29d0c8229c2",
"score": "0.5691231",
"text": "def solution(str)\n b = str.split(\"\")\n n = 0\n c = []\n\n p b\n\n if b.count.even?\n for i in 0..str.length/2\n c << b[i*2].to_s + b[i*2+1].to_s\n end\n else\n b << \"_\"\n b.each do |x|\n c << b[n].to_s + b[n+1].to_s\n n = n + 2\n end\n end\nc.delete(\"\")\nreturn c\nend",
"title": ""
},
{
"docid": "f5d066cfb6ad6a2cc1bceee83d10bd32",
"score": "0.56904185",
"text": "def problem8\n\t\ts = \"7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874715852386305071569329096329522744304355766896648950445244523161731856403098711121722383113622298934233803081353362766142828064444866452387493035890729629049156044077239071381051585930796086670172427121883998797908792274921901699720888093776657273330010533678812202354218097512545405947522435258490771167055601360483958644670632441572215539753697817977846174064955149290862569321978468622482839722413756570560574902614079729686524145351004748216637048440319989000889524345065854122758866688116427171479924442928230863465674813919123162824586178664583591245665294765456828489128831426076900422421902267105562632111110937054421750694165896040807198403850962455444362981230987879927244284909188845801561660979191338754992005240636899125607176060588611646710940507754100225698315520005593572972571636269561882670428252483600823257530420752963450\"\n\t\tnum = s.split(\"\")\n\t\tmax_product = 0\n\t\t(0..s.size-5).each do |i|\n\t\t\tproduct = num[i].to_i * num[i+1].to_i * num[i+2].to_i * num[i+3].to_i * num[i+4].to_i\n\t\t\tmax_product = product if max_product < product\n\t\tend\n\t\treturn max_product\n\tend",
"title": ""
},
{
"docid": "c3ca89628fafc0c1523e2463b2eb9318",
"score": "0.56879395",
"text": "def challenge_number; end",
"title": ""
},
{
"docid": "7d8609471e2657dafcc9e0f7e11882a1",
"score": "0.56879246",
"text": "def solution(a)\r\n # write your code in Ruby 2.2\r\n \r\n i=1;\r\n l=a.count \r\n min=(a[1]-a[0]).abs\r\n loop do\r\n s_first_a = a.slice(0,i).reduce(:+)\r\n s_second_a = a.slice(i, l).reduce(:+)\r\n \r\n diff = (s_first_a - s_second_a).abs\r\n \r\n if(diff<min)\r\n min=diff\r\n end\r\n \r\n i+=1\r\n break if(i==l)\r\n end\r\n \r\n min \r\n \r\nend",
"title": ""
},
{
"docid": "ad56d9270e847dfc8b110c2ec5a85a2d",
"score": "0.5682337",
"text": "def find_judge(n, trust)\r\n arr = (1..n).to_a\r\n hash = {}\r\n arr.each {|num| hash[num] = 0}\r\n trust.each do |tuple|\r\n hash.delete(tuple[0]) if hash[tuple[0]]\r\n hash[tuple[1]] += 1 if hash[tuple[1]]\r\n end\r\n hash.keys.each {|key| return key if hash[key] == n-1}\r\n return -1\r\nend",
"title": ""
},
{
"docid": "460667b4894f5e585a66dacc12123c53",
"score": "0.5679856",
"text": "def main(n)\n\n arr = (1..n.to_i).to_a\n\n len = arr.length()\n\n puts \"Input: #{len}\"\n\n arr.permutation(len).to_a.each do |suba|\n\n res = 0\n\n res2 = 0\n\n success = 0\n\n (0..len-1).each do |x|\n\n res = suba[x] % (x+1);\n\n res2 = (x+1) % suba[x];\n\n if ((res == 0) || (res2 == 0) )\n\n success += 1;\n\n end\n\n if (success == len)\n\n puts(\"\\[#{suba}\\] is cute!\");\n\n end\n\n end\n\n end\n\n puts \" \"\n\nend",
"title": ""
},
{
"docid": "6c75c688a8c9abcf195476c507e9ea45",
"score": "0.5679545",
"text": "def solution(a)\n leader, count = array_leader(a)\n return 0 unless leader\n\n n = a.size\n head_count = 0\n total_equis = 0\n a.each_with_index do |e, i|\n head_count += 1 if e == leader\n tail_count = count - head_count\n\n if (head_count > (i + 1)/2) && (tail_count > (n - 1 - i)/2)\n total_equis += 1\n end\n end\n\n total_equis\nend",
"title": ""
},
{
"docid": "d72ccae3f326a4e3222492869096fb16",
"score": "0.5678983",
"text": "def day_one_part_one(input)\n n = input.strip.split('')\n\n\n # ------- SOL 1 ------\n # puts \"n is #{n}\"\n # puts \"n.rotate(1) is #{n.rotate(1)}\"\n # puts \"n.zip(n.rotate(1)) is #{n.zip(n.rotate(1))}\"\n puts n.zip(n.rotate(1))\n .select { |x, y| x == y }\n .map(&:first)\n .map(&:to_i)\n .inject(:+)\n # ------- SOL 2 ------\n # puts \"n.each_cons(2).to_a is #{n.each_cons(2).to_a}\"\n # puts \"n.each_cons(2).to_a.select { |x, y| x == y } is #{n.each_cons(2).to_a.select { |x, y| x == y }}\"\n # puts \"n.each_cons(2).to_a.select { |x, y| x == y }.map(&:first) is #{n.each_cons(2).to_a.select { |x, y| x == y }.map(&:first)}\"\n # puts \"n.each_cons(2).to_a.select { |x, y| x == y }.map(&:first).map(&:to_i) is #{n.each_cons(2).to_a.select { |x, y| x == y }.map(&:first).map(&:to_i)}\"\n # n << n.first\n # puts n.each_cons(2).to_a\n # .select { |x, y| x == y }\n # .map(&:first)\n # .map(&:to_i)\n # .inject(:+)\n #\n # ------- SOL 3 ------\n # sum = 0\n # digits = input.strip.split('')\n # digits.each_index do |i|\n # if i == digits.size - 1\n # sum += digits.last.to_i if digits.last == digits.first\n # elsif digits[i] == digits[i + 1]\n # sum += digits[i].to_i\n # end\n # end\n # puts sum\nend",
"title": ""
},
{
"docid": "805c8cc74901b435978c0b0c45390593",
"score": "0.5675179",
"text": "def main()\n number = '73167176531330624919225119674426574742355349194934\n\t96983520312774506326239578318016984801869478851843\n\t85861560789112949495459501737958331952853208805511\n\t12540698747158523863050715693290963295227443043557\n\t66896648950445244523161731856403098711121722383113\n\t62229893423380308135336276614282806444486645238749\n\t30358907296290491560440772390713810515859307960866\n\t70172427121883998797908792274921901699720888093776\n\t65727333001053367881220235421809751254540594752243\n\t52584907711670556013604839586446706324415722155397\n\t53697817977846174064955149290862569321978468622482\n\t83972241375657056057490261407972968652414535100474\n\t82166370484403199890008895243450658541227588666881\n\t16427171479924442928230863465674813919123162824586\n\t17866458359124566529476545682848912883142607690042\n\t24219022671055626321111109370544217506941658960408\n\t07198403850962455444362981230987879927244284909188\n\t84580156166097919133875499200524063689912560717606\n\t05886116467109405077541002256983155200055935729725\n\t71636269561882670428252483600823257530420752963450'\n number = number.split('')\n result = 0\n\n (0..(number.size()-6)).each { |i|\n comp = 1\n for x in 0..4\n comp = comp * number[i+x].to_i\n end\n if comp > result\n puts 'Found new result! ===> ' + comp.to_s\n result = comp\n end\n }\n\nend",
"title": ""
},
{
"docid": "2a39b32806655d53c64ca78880cebe8a",
"score": "0.56745464",
"text": "def solution3\n large_num = 600_851_475_143\n\n i = 2\n\n loop do\n large_num /= i if large_num % i == 0\n i += 1\n break if i > large_num / 2\n end\n\n large_num\nend",
"title": ""
},
{
"docid": "1e78c5171c06d1bd31c085ddb824db39",
"score": "0.5671832",
"text": "def solve_cipher(input, shift = -3)\n\n auxArray = Array.new()\n solutionArray = Array.new()\n solution = String.new()\n\n alphabet = ('a'..'z').to_a # => Array del alfabeto para obtener la longitug.\n\n # => La idea aquí, después de probar con muchas opciones, es sacar el modulo\n # => del shift con la longitud del alfabeto. Así funcionaría con cualquier\n # => shift. Si queremos darle mil vueltas al alfabeto hacia atrás (-2600) y\n # => movernos 3 casillas (-2603), con el modulo obtendremos el numero de\n # => posiciones a mover despues de dar todas las vueltas necesarias.\n if shift < 0\n shift = shift % (alphabet.length * -1)\n else\n shift = shift % alphabet.length\n end\n\n input.each_char do |c|\n auxArray.push(c) # => introduzco los caracteres en un Array.\n end\n\n auxArray.each {|x| # => Loop para cada caracter del Array\n\n if x.match(/\\p{Upper}/) # => Mayúsculas?\n if (x.ord + shift) < 65 # => Menor que la primera letra\n solutionArray.push(\n (91 - 65 % (x.ord + shift))\n )\n elsif (x.ord + shift) > 90 # => Mayor que la última letra\n solutionArray.push(\n (64 - 90 % -(x.ord + shift))\n )\n else\n solutionArray.push(x.ord + shift)\n end\n elsif x.match(/\\p{Lower}/) # => Minúsculas?\n if (x.ord + shift) < 97\n solutionArray.push(\n (123 - 97 % (x.ord + shift))\n )\n elsif (x.ord + shift) > 122\n solutionArray.push(\n (96 - 122 % -(x.ord + shift))\n )\n else\n solutionArray.push(x.ord + shift)\n end\n else\n solutionArray.push(x.ord) # => No es una letra\n end\n\n }\n\n solutionArray.each{|x|\n solution += x.chr\n }\n\n puts solution\nend",
"title": ""
},
{
"docid": "4f7d3ee4d72e32416a96c7d321fac12e",
"score": "0.5671339",
"text": "def howmuch(m, n)\n # your code\n result_arr = []\n result = \"\"\n range_arr = (m..n).to_a\n range_arr.each do |i|\n btemp = 0\n ctemp = 0\n if (i - 2) % 7 == 0\n btemp = (i - 2) / 7\n end\n if (i - 1) % 9 == 0\n ctemp = (i - 1) / 9\n end\n if i - 7 * btemp == 2 && i - 9 * ctemp == 1\n result = [\"M: #{i}\", \"B: #{btemp}\", \"C: #{ctemp}\"]\n result_arr << result \n end\n end\n result_arr\nend",
"title": ""
},
{
"docid": "be9a30166b93ff5de03358061f640541",
"score": "0.56643695",
"text": "def find_workable(maps, previous_digits)\r\n #If there's no criteria to meet, then what we have already will work\r\n return [previous_digits] if maps.empty?\r\n\r\n #Go through the criteria\r\n matches = []\r\n maps.each do |m|\r\n (m[previous_digits.last] || []).each do |next_two_digits|\r\n matches += find_workable(maps - [m], previous_digits + [next_two_digits])#.map { |s| previous_digits + s }\r\n end\r\n end\r\n #puts \"RETURN -- #{maps.count} maps, #{previous_digits.inspect}, #{matches}\"\r\n matches\r\nend",
"title": ""
},
{
"docid": "c47af476a1c9c548b894a4c7c45b09cc",
"score": "0.5663157",
"text": "def solution(a)\n # write your code in Ruby 2.2\n return a[0] if a.length == 1\n\n for i in 0..a.length\n unpaired = a[i + 2] if a[i+2] && a[i] != a[i+2] && a[i+2] % 2 == 0\n end\n\n return unpaired\nend",
"title": ""
}
] |
7dab4d4ed5e9b8d1ef3dfc36fa680350
|
getReportID(insightID, reportName) Gets Report ID for a given report
|
[
{
"docid": "2fc6d8dafa2d021bf951c99d91471c36",
"score": "0.88231665",
"text": "def getReportID(insightID, reportName)\n if insightID.nil? || reportName.nil?\n log(\"DEBUG\", \"insight id and report name is needed to get report id\")\n return nil\n end\n\n paramHash = Hash.new\n paramHash[\"insightID\"] = insightID\n paramHash[\"filter\"] = {\"name\" => reportName} \n paramHash[\"count\"] = 1\n paramHash[\"fields\"] = \"id\" \n\n report = getInsightReports(paramHash)\n\n if report.nil? \n log(\"DEBUG\", \"Report with name \"+reportName+\" does not exist\")\n return nil\n elsif (report.kind_of?(Array)) && (report.length.to_i > 0)\n return report[0][\"id\"]\n else\n log(\"DEBUG\", \"Report with name \"+reportName+\" does not exist\")\n return nil\n end\n end",
"title": ""
}
] |
[
{
"docid": "8a5191e7a2bbbac50334683cd2ec85dd",
"score": "0.7819614",
"text": "def getReportCardID(insightID, reportID, cardName)\n if insightID.nil? || reportID.nil? || cardName.nil?\n log(\"DEBUG\", \"insight id, report id and card name is needed to get report card id\")\n return nil\n end\n\n card = nil\n paramHash = Hash.new\n paramHash[\"insightID\"] = insightID\n paramHash[\"reportID\"] = reportID\n paramHash[\"filter\"] = {\"name\" => cardName}\n paramHash[\"count\"] = 1\n paramHash[\"fields\"] = \"id\" \n\n card = getInsightReportCards(paramHash)\n\n if card.nil? \n log(\"DEBUG\", \"Report with name \"+cardName+\" does not exist\")\n return nil\n elsif (card.kind_of?(Array)) && (card.length.to_i > 0)\n return card[0][\"id\"]\n else\n log(\"DEBUG\", \"Report with name \"+cardName+\" does not exist\")\n return nil\n end\n end",
"title": ""
},
{
"docid": "e2a9dc0e198858ca51fabe9b196b894d",
"score": "0.7699266",
"text": "def createInsightReport(insightID, reportName)\n if !reportName.nil? && !reportName.empty? && !insightID.nil?\n\n reportID = nil\n reportID = getReportID(insightID, reportName)\n \n if !reportID.nil?\n return reportID\n else\n paramHash = Hash.new\n paramHash[\"context\"] = \"resources\"\n paramHash[\"contextID\"] = insightID\n paramHash[\"subContext\"] = \"insight_reports\"\n paramHash[\"data\"] = {\"name\" => reportName}\n\n log(\"DEBUG\", \"Attempting creation of report with name \" + reportName + \"...\")\n report = updateCloudmunchData(paramHash)\n\n if report[\"id\"].nil? then return nil else report[\"id\"] end\n end\n else\n log(\"DEBUG\", \"Report name and insight id is needed for creating a report\")\n return nil\n end\n end",
"title": ""
},
{
"docid": "66fb091e1b8f4032ae8ca26238a8d39f",
"score": "0.71130115",
"text": "def getKeyMetricID(insightID, reportID, keyMetricName)\n paramHash = Hash.new\n paramHash[\"insightID\"] = insightID\n paramHash[\"reportID\"] = reportID\n paramHash[\"filter\"] = {\"name\" => keyMetricName}\n paramHash[\"count\"] = 1\n paramHash[\"fields\"] = \"id\" \n\n keyMetric = getInsightReportCards(paramHash)\n if keyMetric.nil? || !keyMetric.any?\n log(\"DEBUG\", \"Report key metric with name \"+keyMetricName+\" does not exist\")\n return nil\n else\n return keyMetric[0][\"id\"]\n end\n end",
"title": ""
},
{
"docid": "cc9d88646af1bda572e335137a1b6c8a",
"score": "0.67457616",
"text": "def report(report_id)\n if r = get(\"reports/#{report_id}\")['Reports']\n Report.new(r.first['Url'], :party => self, :details => r.first)\n end\n end",
"title": ""
},
{
"docid": "7ab2ac0aabd9228a5529a4e89c60250c",
"score": "0.6716488",
"text": "def report_name\n return 'Report ID'\n end",
"title": ""
},
{
"docid": "429cd493d17e3d42156ef36c46a2e916",
"score": "0.6511333",
"text": "def createInsightReportCard(insightID, reportID, cardName)\n if !cardName.nil? && !cardName.empty? && !insightID.nil? && !reportID.nil?\n\n cardID = nil\n cardID = getReportCardID(insightID, reportID, cardName)\n \n if !cardID.nil?\n return cardID\n else\n paramHash = Hash.new\n paramHash[\"context\"] = \"resources\"\n paramHash[\"contextID\"] = insightID\n paramHash[\"subContext\"] = \"insight_reports\"\n paramHash[\"subContextID\"] = reportID\n paramHash[\"leafContext\"] = \"insight_cards\"\n paramHash[\"data\"] = {\"name\" => cardName}\n\n log(\"DEBUG\", \"Attempting creation of report card with name \" + cardName + \"...\")\n card = updateCloudmunchData(paramHash)\n\n if card[\"id\"].nil? then return nil else card[\"id\"] end\n end\n else\n log(\"DEBUG\", \"Extract name, insight id and report id is needed for creating a report card\")\n return nil\n end\n end",
"title": ""
},
{
"docid": "dc644739b88ab6c79d08e2941868e966",
"score": "0.6486382",
"text": "def find_report(report_name)\n reports_table.rows.select{ |row| row[0].text == report_name}.first\n end",
"title": ""
},
{
"docid": "1225d84852bd8437e985e5f665289ee0",
"score": "0.63946754",
"text": "def get_report_id(id) \n\t\t\tbegin\n\t\t\t\tpar = framework.db.report_parent(id)\n\t\t\trescue ::Exception\n\t\t\t\tprint_error(\"Report error #{$!.to_s}\")\n\t\t\t\treturn\n\t\t\tend\n\t\t\t\n\t\t\tprint_line(\"\\t#{par.entity} #{par.etype}: #{par.value} #{par.notes} [#{par.created}]\")\n\t\t\t\n\t\t\tframework.db.report_children(id).each do |chl|\n\t\t\t\tget_report_id(chl.id) \n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "de967ca6b107f9386c13f4e4323f9d75",
"score": "0.6359465",
"text": "def get_report(id)\n report = reports.detect { |r| r.id == id }\n raise(UsbException, \"No report with id #{id}\") if report.nil?\n return report\n end",
"title": ""
},
{
"docid": "2b48b4d4d2e2550cab671b9e3a0eae42",
"score": "0.62032574",
"text": "def report_name\n return @report_name\n end",
"title": ""
},
{
"docid": "022fca022b90c2d7a27f969cae6df0e2",
"score": "0.6169705",
"text": "def report_get_by_id(report_id, format_id)\n\t\t\treport = @reports[report_id.to_i]\n\t\t\tif not report\n\t\t\t\traise OMPError.new(\"Invalid report id.\")\n\t\t\tend\n\t\t\tformat = @formats[format_id.to_i]\n\t\t\tif not format\n\t\t\t\traise OMPError.new(\"Invalid format id.\")\n\t\t\tend\n\t\t\treq = xml_attrs(\"get_reports\", {\"report_id\"=>report[\"id\"], \"format_id\"=>format[\"id\"]})\n\n\t\t\tbegin\n\t\t\t\tstatus, status_text, resp = omp_request_xml(req)\n\t\t\t\tif status == \"404\"\n\t\t\t\t\traise OMPError.new(status_text)\n\t\t\t\tend\n\t\t\t\tcontent_type = resp.elements[\"report\"].attributes[\"content_type\"]\n\t\t\t\treport = resp.elements[\"report\"].text\n\n\t\t\t\tif report == nil\n\t\t\t\t\traise OMPError.new(\"The report is empty.\")\n\t\t\t\tend\n\n\t\t\t\t# XML reports are in XML format, everything else is base64 encoded.\n\t\t\t\tif content_type == \"text/xml\"\n\t\t\t\t\treturn resp.elements[\"report\"].text\n\t\t\t\telse\n\t\t\t\t\treturn Base64.decode64(resp.elements[\"report\"].text)\n\t\t\t\tend\n\t\t\trescue\n\t\t\t\traise OMPResponseError\n\t\t\tend\n\t\tend",
"title": ""
},
{
"docid": "6073b8198cc8c6e3c4dc4fee054a8449",
"score": "0.61651456",
"text": "def report\n if(report_id?)\n @descriptor.get_report(report_id)\n end\n return @descriptor.reports[0]\n end",
"title": ""
},
{
"docid": "f969bf17eb0dbe98ec7df644563e604d",
"score": "0.6129383",
"text": "def createInsightReportKeyMetric(insightID, reportID, keyMetricName)\n if !keyMetricName.nil? && !keyMetricName.empty? && !insightID.nil? && !reportID.nil?\n\n keyMetricID = nil\n keyMetricID = getReportKeyMetricID(insightID, reportID, keyMetricName)\n \n if !keyMetricID.nil?\n return keyMetricID\n else\n paramHash = Hash.new\n paramHash[\"context\"] = \"resources\"\n paramHash[\"contextID\"] = insightID\n paramHash[\"subContext\"] = \"insight_reports\"\n paramHash[\"subContextID\"] = reportID\n paramHash[\"leafContext\"] = \"insight_cards\"\n paramHash[\"data\"] = {\"name\" => keyMetricName}\n\n log(\"DEBUG\", \"Attempting creation of report key metric with name \" + keyMetricName + \"...\")\n keyMetric = updateCloudmunchData(paramHash)\n\n if keyMetric[\"id\"].nil? then return nil else keyMetric[\"id\"] end\n end\n else\n log(\"DEBUG\", \"Key metric name, insight id and report id is needed for creating a report key metric\")\n return nil\n end\n end",
"title": ""
},
{
"docid": "5a5aac008147ab6f441a5b106ff1cb18",
"score": "0.6079757",
"text": "def updateInsightReport(insightID, reportID, data, method = \"POST\")\n # /applications/{application_id}/insights/{insight_id}/insight_reports/{insight_report_id}\n\n if (insightID.nil? || insightID.empty?) && (reportID.nil? || reportID.empty?) && data.nil?\n log(\"DEBUG\", \"Insight id, report id and data is needed to be update an existing report\")\n return nil\n end\n paramHash = {}\n paramHash[\"context\"] = \"resources\"\n paramHash[\"contextID\"] = insightID\n paramHash[\"subContext\"] = \"insight_reports\"\n paramHash[\"subContextID\"] = reportID\n paramHash[\"data\"] = data\n return updateCloudmunchData(paramHash, method)\n end",
"title": ""
},
{
"docid": "302404faecc04ef00c0d264a31488227",
"score": "0.60759383",
"text": "def report(id)\n Report.new(get(\"reports/#{id}\"))\n end",
"title": ""
},
{
"docid": "6f6731d49f4f659147e94686235b9ac1",
"score": "0.603506",
"text": "def report_id\n raise UsbException, \"Attempt to get report_id for a packet that did not have a report_id\" unless report_id?\n return @binary_string[0,8].reverse.to_i(2)\n end",
"title": ""
},
{
"docid": "464883159a91c20412139bb9e8793aba",
"score": "0.6007211",
"text": "def getDataStoreID(insightID, dataStoreName)\n if insightID.nil? || dataStoreName.nil?\n log(\"DEBUG\", \"insight id and datastore name is needed to get datastore id\")\n return nil\n end\n\n paramHash = Hash.new\n paramHash[\"insightID\"] = insightID\n paramHash[\"filter\"] = {\"name\" => dataStoreName} \n paramHash[\"count\"] = 1\n paramHash[\"fields\"] = \"id\" \n\n dataStore = getInsightDataStores(paramHash)\n \n if dataStore.nil? \n log(\"DEBUG\", \"Data store with name \"+dataStoreName+\" does not exist\")\n return nil\n elsif (dataStore.kind_of?(Array)) && (dataStore.length.to_i > 0)\n return dataStore[0][\"id\"]\n else\n log(\"DEBUG\", \"Data store with name \"+dataStoreName+\" does not exist\")\n return nil\n end\n end",
"title": ""
},
{
"docid": "ad402555acc733749b45a8b11362bc3d",
"score": "0.5954914",
"text": "def get_report_request(report_request_id, params={})\n options = @option_defaults.merge action: 'GetReportRequestList'\n params.merge! :\"report_request_id_list.id.1\" => report_request_id\n doc = @connection.get \"/\", params, options\n request_info = doc.xpath(\"/GetReportRequestListResponse/GetReportRequestListResult/ReportRequestInfo[1]\").first\n status = request_info.xpath(\"ReportProcessingStatus\").text\n report_id = request_info.xpath(\"GeneratedReportId\").text\n (status == \"_DONE_\") ? report_id : nil\n end",
"title": ""
},
{
"docid": "5f191c2abb7bbfc67784ecf1305d463c",
"score": "0.5949704",
"text": "def getExtractID(insightID, dataStoreID, extractName)\n if insightID.nil? || dataStoreID.nil? || extractName.nil?\n log(\"DEBUG\", \"insight id, datastore id and extract name is needed to get extract id\")\n return nil\n end\n\n extract = nil\n paramHash = Hash.new\n paramHash[\"insightID\"] = insightID\n paramHash[\"dataStoreID\"] = dataStoreID\n paramHash[\"filter\"] = {\"name\" => extractName}\n paramHash[\"count\"] = 1\n paramHash[\"fields\"] = \"id\" \n\n extract = getInsightDataStoreExtracts(paramHash)\n\n if extract.nil? \n log(\"DEBUG\", \"Extract with name \"+extractName+\" does not exist\")\n return nil\n elsif (extract.kind_of?(Array)) && (extract.length.to_i > 0)\n return extract[0][\"id\"]\n else\n log(\"DEBUG\", \"Extract with name \"+extractName+\" does not exist\")\n return nil\n end\n end",
"title": ""
},
{
"docid": "c24a5d4280ca68e0a6d2716d947fe40c",
"score": "0.59382397",
"text": "def get_GeneratedReportId()\n \t return @outputs[\"GeneratedReportId\"]\n \tend",
"title": ""
},
{
"docid": "c24a5d4280ca68e0a6d2716d947fe40c",
"score": "0.59382397",
"text": "def get_GeneratedReportId()\n \t return @outputs[\"GeneratedReportId\"]\n \tend",
"title": ""
},
{
"docid": "c24a5d4280ca68e0a6d2716d947fe40c",
"score": "0.59382397",
"text": "def get_GeneratedReportId()\n \t return @outputs[\"GeneratedReportId\"]\n \tend",
"title": ""
},
{
"docid": "c24a5d4280ca68e0a6d2716d947fe40c",
"score": "0.59382397",
"text": "def get_GeneratedReportId()\n \t return @outputs[\"GeneratedReportId\"]\n \tend",
"title": ""
},
{
"docid": "c24a5d4280ca68e0a6d2716d947fe40c",
"score": "0.59380615",
"text": "def get_GeneratedReportId()\n \t return @outputs[\"GeneratedReportId\"]\n \tend",
"title": ""
},
{
"docid": "c24a5d4280ca68e0a6d2716d947fe40c",
"score": "0.59380615",
"text": "def get_GeneratedReportId()\n \t return @outputs[\"GeneratedReportId\"]\n \tend",
"title": ""
},
{
"docid": "81d4965868c87e78e2856656a3cd0465",
"score": "0.5923311",
"text": "def set_report\n @report = @project.reports.find_by_legacy_id(params[:id])\n end",
"title": ""
},
{
"docid": "91c0fef7edf782618ca389e073feac44",
"score": "0.5919495",
"text": "def set_report\n if params[:report_id]\n @report = Report.find(params[:report_id])\n else\n @report = Report.find(params[:id])\n end\n end",
"title": ""
},
{
"docid": "4e70188acfd98145667e4df70faf07bc",
"score": "0.5907632",
"text": "def setup_report(id = nil)\n id ||= params[:id]\n redirect_to :index if id.blank?\n @report = Report.find_by_id_or_resource_name(id)\n @report.current_user = current_user\n @runner = @report.runner\n end",
"title": ""
},
{
"docid": "ad9c00bc38ee839bdf7654083f5b6220",
"score": "0.59046376",
"text": "def get_report_data(report_name, report_type=\"pdf\", context={})\n self.class.get_report_data(report_name, [self.id], report_type, context) \n end",
"title": ""
},
{
"docid": "b2bdb750a4fbcb3395b1d0f2d2ed1ebc",
"score": "0.5903759",
"text": "def get_report(id)\n if is_administrator?\n return Reports.first(id: id)\n else\n report = Reports.first(id: id)\n if report\n authors = report.authors\n return report if report.owner == get_username\n if authors\n return report if authors.include?(get_username)\n end\n end\n end\nrescue Exception => log\n # ignoring this error for now\nend",
"title": ""
},
{
"docid": "be24ecad1f821f55390f2073a61870f9",
"score": "0.5852002",
"text": "def get_report_data(report_name, report_type=\"pdf\", context={})\n self.class.get_report_data(report_name, [self.id], report_type, context)\n end",
"title": ""
},
{
"docid": "be24ecad1f821f55390f2073a61870f9",
"score": "0.5852002",
"text": "def get_report_data(report_name, report_type=\"pdf\", context={})\n self.class.get_report_data(report_name, [self.id], report_type, context)\n end",
"title": ""
},
{
"docid": "2ce013045f36c46e3d5beac698bcf987",
"score": "0.5844902",
"text": "def report_info(report_id, &block)\n get('reports/' + report_id)\n end",
"title": ""
},
{
"docid": "acafe2592fafcce2fb94d7f0ae728b23",
"score": "0.5812748",
"text": "def get_report\n # load this report and create the report instance\n report = Report.find(params[:id])\n # check that the current use is authorized to view the report\n unless report.nil?\n if current_user.is_in_roles? report.role_names\n @report = report\n end\n end\n if @report.nil?\n notify_user(:alert, \"Can't find report.\")\n redirect_to '/404'\n return\n end\n end",
"title": ""
},
{
"docid": "821c7a22fe96ad39bd149df58ba11002",
"score": "0.58102316",
"text": "def report_generate(report_id)\n xml = make_xml('ReportGenerateRequest', {'report-id' => report_id})\n ReportSummary.parse_all(execute(xml))\n end",
"title": ""
},
{
"docid": "8f3305565c96b274cbceb6861ab55d14",
"score": "0.5785642",
"text": "def set_report\n @report = Report.find(params[:id]) unless params[:id].nil?\n end",
"title": ""
},
{
"docid": "701aed4388434a88be5afc337ade03ba",
"score": "0.57642055",
"text": "def set_ReportId(value)\n set_input(\"ReportId\", value)\n end",
"title": ""
},
{
"docid": "701aed4388434a88be5afc337ade03ba",
"score": "0.5764123",
"text": "def set_ReportId(value)\n set_input(\"ReportId\", value)\n end",
"title": ""
},
{
"docid": "bf6608decca26886015c75730eee431f",
"score": "0.5763638",
"text": "def report_id?\n return @descriptor.uses_report_id?\n end",
"title": ""
},
{
"docid": "a88d08568d16136bf7b1b0b27e717b2a",
"score": "0.5730783",
"text": "def get_report(id) path = \"/api/v2/reports/#{id}\"\n get(path, {}, AvaTax::VERSION) end",
"title": ""
},
{
"docid": "90d509954d679a73530d9982b83f7a3e",
"score": "0.5730662",
"text": "def get_report_from_id(xero_tenant_id, report_id, opts = {})\n data, _status_code, _headers = get_report_from_id_with_http_info(xero_tenant_id, report_id, opts)\n data\n end",
"title": ""
},
{
"docid": "aed8f262413f3039f056a0be12a7b3fb",
"score": "0.57208586",
"text": "def set_report\n @report = report.find(params[:id])\n end",
"title": ""
},
{
"docid": "b9bedb108728168917b24efedc20e620",
"score": "0.5696892",
"text": "def get_report_download_url(report_id)\n response = perform_request(:get_report_download_url, { :body => { \"#{API_VERSION}:reportID\" => report_id } })\n ReportDownloadInfo.new(response)\n end",
"title": ""
},
{
"docid": "371d4a7ce05c69cf655abeaad5e676a8",
"score": "0.5696307",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "371d4a7ce05c69cf655abeaad5e676a8",
"score": "0.5696307",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "371d4a7ce05c69cf655abeaad5e676a8",
"score": "0.5696307",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "371d4a7ce05c69cf655abeaad5e676a8",
"score": "0.5696307",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "371d4a7ce05c69cf655abeaad5e676a8",
"score": "0.5696307",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "371d4a7ce05c69cf655abeaad5e676a8",
"score": "0.5696307",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "371d4a7ce05c69cf655abeaad5e676a8",
"score": "0.5696307",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "371d4a7ce05c69cf655abeaad5e676a8",
"score": "0.5696307",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "371d4a7ce05c69cf655abeaad5e676a8",
"score": "0.5696307",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "371d4a7ce05c69cf655abeaad5e676a8",
"score": "0.5696307",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "21b86ca5a55f84256fe0b0edb6de41f0",
"score": "0.56962377",
"text": "def getReporterId\r\n\t\t\t\t\treturn @reporterId\r\n\t\t\t\tend",
"title": ""
},
{
"docid": "d1aed14970836caa88277c81cc61b383",
"score": "0.5695925",
"text": "def set_report\n @report = @organization.reports.find(params[:id])\n end",
"title": ""
},
{
"docid": "371d4a7ce05c69cf655abeaad5e676a8",
"score": "0.56940156",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "79fbfb8e560efaaa9c982d5065f51011",
"score": "0.56799835",
"text": "def set_report\n @report = params[:id].present? ? Report.find(params[:id]) : current_user.current_report\n end",
"title": ""
},
{
"docid": "dddb0484161fd248af75f040dad00c90",
"score": "0.5672827",
"text": "def set_report\r\n @report = Report.find(params[:id])\r\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
},
{
"docid": "bfce5f87de24f081bf8820e373a19b6a",
"score": "0.56641704",
"text": "def set_report\n @report = Report.find(params[:id])\n end",
"title": ""
}
] |
af630984682f1a0b5a68e6092af0d102
|
Update properties of this object
|
[
{
"docid": "b95cfd69cc7a8e2012ec547e6cb93b85",
"score": "0.0",
"text": "def update!(**args)\n @locations = args[:locations] if args.key?(:locations)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\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": "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": "37ae8a386fde14c02d7021605aa72f45",
"score": "0.67403597",
"text": "def refresh\n self.class.base_properties.each_with_index do |prop, prop_id|\n @properties[prop] = get_property(prop_id)\n end\n refresh_features\n refresh_status\n refresh_config\n self\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": "10e41ec39ba2af73495ccece21c2d8a3",
"score": "0.6709326",
"text": "def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\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": "47bbd8b88b35da987fc3775b82211e56",
"score": "0.6618882",
"text": "def update_properties!(branch_id=nil)\n properties = fetch_properties(false, branch_id)\n length = properties.length\n counter = 0\n properties.each do |property|\n counter += 1\n if Vebra.debugging?\n puts \"[Vebra]: #{counter}/#{length}: live updating property with Vebra ref: #{property.attributes[:vebra_ref]}\"\n end\n live_update!(property)\n Vebra.set_last_updated_at(Time.now) if counter == length\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": "c3b6fccdeb696de5e9dbc38a9486b742",
"score": "0.65386343",
"text": "def update_attributes(properties_hash)\n self.class.get_class_properties.each do |property|\n key = property[:name].to_sym\n if properties_hash.has_key? key\n self.setValue(properties_hash[key], forKey:key)\n end\n end\n end",
"title": ""
},
{
"docid": "bb403006cc5423d9b1820fe684a7c5a5",
"score": "0.65178275",
"text": "def update\n # TODO: implement update\n end",
"title": ""
},
{
"docid": "1ee90e4f66e82aec13076a98b288a2d1",
"score": "0.6394807",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @states = args[:states] if args.key?(:states)\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": "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": "3f85752da065340d4ca70ce879a3b23d",
"score": "0.63328",
"text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n @total_value_count = args[:total_value_count] if args.key?(:total_value_count)\n @value = args[:value] if args.key?(:value)\n @value_status = args[:value_status] if args.key?(:value_status)\n end",
"title": ""
},
{
"docid": "da63345424fc9aecef032928485bd149",
"score": "0.6319025",
"text": "def update\n \n end",
"title": ""
},
{
"docid": "5a8e82caac01cee661bc875a5b0cf723",
"score": "0.6283673",
"text": "def refresh\n set_attributes\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": "29c22ae2290ffca9b9682a5f20f48103",
"score": "0.62410724",
"text": "def update_resource object, attributes\n object.update 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": "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": "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": "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": "85a79fb5c3cc199e689344861658b09b",
"score": "0.62021106",
"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])))\n end\n end\n @dirty[property] = nil\n @attributes[:original][property] = attribute_get(property)\n end\n self.class.repository_or_fail.insert(RDF::Statement.new(@subject, RDF.type, type)) unless type.nil?\n end",
"title": ""
},
{
"docid": "5d229ea224b1dfa7ac9ce6808ca63fc4",
"score": "0.62017816",
"text": "def update(attributes = {})\n super(attributes)\n retrieve!\n self\n end",
"title": ""
},
{
"docid": "549a7eef6c18558dea47a8e8d72df295",
"score": "0.62017",
"text": "def update\n @objects.map(&:update);\n end",
"title": ""
},
{
"docid": "e1f766468b11768b786daa133483b157",
"score": "0.61730784",
"text": "def update\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "e1f766468b11768b786daa133483b157",
"score": "0.61730784",
"text": "def update\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "b76d372399abbb21b748df3ae7b06470",
"score": "0.6159277",
"text": "def live_update!(property)\n property_class = Vebra.models[:property][:class].to_s.camelize.constantize\n\n # ensure we have the full property attributes\n property.get_property if !property.attributes[:status] && property.attributes[:action] != 'deleted'\n\n # find & update or build a new property\n property_model = property_class.find_or_initialize_by_vebra_ref(property.attributes[:vebra_ref])\n\n # make sure property object is not empty\n return false if !property.attributes || !property.attributes[:property_type]\n\n # if the property has been deleted, mark it appropriately and move on\n if property.attributes[:action] == 'deleted'\n return property_model.destroy\n end\n\n # extract accessible attributes for the property\n property_accessibles = property_class.accessible_attributes.map(&:to_sym)\n property_attributes = property.attributes.inject({}) do |result, (key, value)|\n result[key] = value if property_accessibles.include?(key)\n result\n end\n\n # update the property model's attributes\n property_model.no_callbacks = true if property_model.respond_to?(:no_callbacks)\n property_model.update_attributes(property_attributes)\n\n # find & update or build a new address\n if Vebra.models[:address]\n address_class = Vebra.models[:address][:class].to_s.camelize.constantize\n address_model = property_model.send(Vebra.models[:property][:address_method])\n address_model = property_model.send(\"build_#{Vebra.models[:property][:address_method]}\") unless address_model\n\n # extract accessible attributes for the address\n address_accessibles = address_class.accessible_attributes.map(&:to_sym)\n address_attributes = property.attributes[:address].inject({}) do |result, (key, value)|\n result[key] = value if address_accessibles.include?(key)\n result\n end\n\n # update the address model's attributes\n address_model.update_attributes(address_attributes)\n end\n\n # find & update or build new rooms\n if Vebra.models[:room]\n room_class = Vebra.models[:room][:class].to_s.camelize.constantize\n\n # accessible attributes for the rooms\n room_accessibles = room_class.accessible_attributes.map(&:to_sym)\n\n # delete any rooms which are no longer present\n property_rooms = property.attributes[:rooms] || []\n property_model_rooms = property_model.send(Vebra.models[:property][:rooms_method])\n refs_to_delete = property_model_rooms.map(&:vebra_ref) - property_rooms.map { |r| r[:vebra_ref] }\n property_model_rooms.each do |room|\n room.destroy if refs_to_delete.include?(room.vebra_ref)\n end\n\n # find & update or build new rooms\n property_rooms.each do |room|\n room_model = room_class.find_by_property_id_and_vebra_ref(property_model.id, room[:vebra_ref])\n room_model = property_model_rooms.build unless room_model\n\n # extract accessible attributes for the room\n room_attributes = room.inject({}) do |result, (key, value)|\n result[key] = value if room_accessibles.include?(key)\n result\n end\n\n # update the room model's attributes\n room_model.update_attributes(room_attributes)\n end\n end\n\n # find & update or build new file attachments\n if Vebra.models[:file]\n file_class = Vebra.models[:file][:class].to_s.camelize.constantize\n\n # accessible attributes for the files\n file_accessibles = file_class.accessible_attributes.map(&:to_sym)\n\n # first normalize the collection (currently nested collections)\n property_files = property.attributes[:files].inject([]) do |result, (kind, collection)|\n collection.each do |file|\n file[:type] = kind.to_s.singularize.camelize if file_accessibles.include?(:type)\n file[\"remote_#{Vebra.models[:file][:attachment_method]}_url\".to_sym] = file.delete(:url)\n # if file[:type] is set, it means the attachment file class can be subclassed. In this\n # case we need to ensure that the subclass exists. If not, we ignore this file\n begin\n file[:type].constantize if file_accessibles.include?(:type)\n result << file\n rescue NameError => e\n # ignore - this means the subclass does not exist\n puts \"[Vebra]: #{e.message}\" if Vebra.debugging?\n end\n end\n\n result\n end\n\n # delete any files which are no longer present\n property_model_files = property_model.send(Vebra.models[:property][:files_method])\n refs_to_delete = property_model_files.map(&:vebra_ref) - property_files.map { |f| f[:vebra_ref] }\n property_model_files.each do |file|\n file.destroy if refs_to_delete.include?(file.vebra_ref)\n end\n\n # find & update or build new files\n property_files.each do |file|\n begin\n file_model = property_model_files.find_by_vebra_ref(file[:vebra_ref])\n file_model = property_model_files.build unless file_model\n\n # extract accessible attributes for the file\n file_attributes = file.inject({}) do |result, (key, value)|\n result[key] = value if file_accessibles.include?(key)\n result\n end\n\n # update the room model's attributes\n file_model.update_attributes(file_attributes)\n rescue CarrierWave::ProcessingError, OpenURI::HTTPError => e\n # just ignore the file\n puts \"[Vebra]: #{e.message}\" if Vebra.debugging?\n end\n end\n end\n\n property_model.no_callbacks = false if property_model.respond_to?(:no_callbacks)\n property_model.save\n return property_model\n end",
"title": ""
},
{
"docid": "01219537b43bd1cf8341e0f00e27d4c8",
"score": "0.6156169",
"text": "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @property_value = args[:property_value] if args.key?(:property_value)\n end",
"title": ""
},
{
"docid": "147d62c4df79ff1ca86cbd477112bf7f",
"score": "0.61445665",
"text": "def update\n end",
"title": ""
},
{
"docid": "f3dea89f306804c3f2aa813c06584d06",
"score": "0.6125433",
"text": "def update!(**args)\n @mid = args[:mid] if args.key?(:mid)\n @property_value = args[:property_value] if args.key?(:property_value)\n end",
"title": ""
},
{
"docid": "44756fd86dd095556580199f7e78936f",
"score": "0.61241156",
"text": "def modified_properties=(value)\n @modified_properties = value\n end",
"title": ""
},
{
"docid": "593de84fa9950baa68153e4fa9b6e17c",
"score": "0.6121413",
"text": "def apply_properties!(properties)\n # Non-commutitivity etc. eventually.\n end",
"title": ""
},
{
"docid": "ea25adea5b43c27e6c84f27ad88c3d9f",
"score": "0.6110477",
"text": "def set_properties(hash)\n hash.each do |key, value|\n add_or_remove_ostruct_member(key, value)\n end\n rest_reset_properties\n end",
"title": ""
},
{
"docid": "147138a710a0ff53e9288ae66341894f",
"score": "0.6105694",
"text": "def update\n\t\t\n\t\tend",
"title": ""
},
{
"docid": "7b1d2242b1a6bd8d3cad29be97783a80",
"score": "0.61016303",
"text": "def set_props(props)\n @props.merge!(props)\n end",
"title": ""
},
{
"docid": "cb2162d3a1fd3434effd12aa702f250f",
"score": "0.60845226",
"text": "def update() end",
"title": ""
},
{
"docid": "231370ed2400d22825eba2b5b69e7a67",
"score": "0.6084427",
"text": "def update!(**args)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end",
"title": ""
},
{
"docid": "86ff97cc222b987bff78c1152a1c8ee1",
"score": "0.6065455",
"text": "def assign_properties\n self.properties ||= {}\n listing_properties.each do |prop|\n self.properties[prop.key] ||= prop.value\n end\n end",
"title": ""
},
{
"docid": "0f6ea4c54f9bc18020c08410f67289cd",
"score": "0.6059506",
"text": "def change_properties(new_current_floor, new_next_floor, new_movement)\n @current_floor = new_current_floor\n @next_floor = new_next_floor\n @movement = new_movement\n end",
"title": ""
},
{
"docid": "453da6bb915596261c5b82f2d17cabf8",
"score": "0.6054869",
"text": "def update!(**args)\n @property_value = args[:property_value] if args.key?(:property_value)\n end",
"title": ""
},
{
"docid": "52a81d6eb0fed16fe2a23be3d9ebc264",
"score": "0.6051708",
"text": "def update!(**args)\n @property_name = args[:property_name] if args.key?(:property_name)\n end",
"title": ""
},
{
"docid": "52a81d6eb0fed16fe2a23be3d9ebc264",
"score": "0.6051708",
"text": "def update!(**args)\n @property_name = args[:property_name] if args.key?(:property_name)\n end",
"title": ""
},
{
"docid": "874639781ed80ae451fbdd6ebbef2218",
"score": "0.60413384",
"text": "def update(attributes)\n (@attributes ||= {}).merge! attributes\n\n (self.class.attr_initializables & attributes.keys).each do |name|\n instance_variable_set :\"@#{name}\", attributes[name]\n end\n\n self\n end",
"title": ""
},
{
"docid": "d175f5bedd91a8daf191cad42b04dc0c",
"score": "0.6030853",
"text": "def update_attributes(attrs)\n super({})\n end",
"title": ""
},
{
"docid": "b8d1a7cd8f443ee5f30b5085aadff479",
"score": "0.6022535",
"text": "def update\n @dirty = true\n end",
"title": ""
},
{
"docid": "d7d62f9c97f629ef8c88e56d3d1ce8ee",
"score": "0.6015561",
"text": "def update\n\n # Run through the mixin updates\n colourable_update\n movable_update\n\n end",
"title": ""
},
{
"docid": "71750bae7e3d6bdde2b60ec30e70949a",
"score": "0.59932375",
"text": "def set(props)\n props.each do |prop, val|\n self.send(:\"#{ prop }=\", val)\n end\n end",
"title": ""
},
{
"docid": "73fe9bc31bfeeab4d84483e2fa65cbbb",
"score": "0.59898263",
"text": "def update\n super\n end",
"title": ""
},
{
"docid": "a98ac99e6e5115383e9148202286ff9e",
"score": "0.5976479",
"text": "def update!(**args)\n @property_id = args[:property_id] if args.key?(:property_id)\n @value_status = args[:value_status] if args.key?(:value_status)\n end",
"title": ""
},
{
"docid": "fb14f35e7fab31199053a7b87ef451a4",
"score": "0.5973787",
"text": "def update!(**args)\n @object_size_bytes = args[:object_size_bytes] if args.key?(:object_size_bytes)\n @object_version = args[:object_version] if args.key?(:object_version)\n end",
"title": ""
},
{
"docid": "6441b3fa93c3dfd974c66a975adb9d9c",
"score": "0.59678394",
"text": "def movable_update\n\n # Work through the different aspects we update\n movable_location_update\n movable_size_update\n movable_angle_update\n\n end",
"title": ""
},
{
"docid": "51a59f953548d1eff10532bdffdd8df9",
"score": "0.5963291",
"text": "def properties=(value)\n @properties = value\n end",
"title": ""
},
{
"docid": "e7a3d5504fcc6e382b06845ede0d5fd8",
"score": "0.5962048",
"text": "def update(attrs)\n attrs.each_pair do |key, value|\n send(\"#{key}=\", value) if respond_to?(\"#{key}=\")\n # attributes[key] = value <- lets make use of virtual attributes too\n end\n end",
"title": ""
},
{
"docid": "c7a2880c3da02b3708afc43c48d37f2e",
"score": "0.5961157",
"text": "def update(context={})\n self.pre_cast_attributes\n m2o = @relations.reject{|k, v| !self.class.many2one_relations.has_key?(k)}\n vals = @attributes.reject {|key, value| key == 'id'}.merge(m2o.merge(m2o){|k, v| v.is_a?(Array) ? v[0] : v})\n self.class.rpc_execute('write', self.id, vals, context)\n reload_from_record!(self.class.find(self.id, :context => context))\n end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950731",
"text": "def update; end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950731",
"text": "def update; end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950731",
"text": "def update; end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950731",
"text": "def update; end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950731",
"text": "def update; end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950731",
"text": "def update; end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950731",
"text": "def update; end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950731",
"text": "def update; end",
"title": ""
},
{
"docid": "5ca2caa1a207739e77f437de35e41cf1",
"score": "0.59500545",
"text": "def update ; end",
"title": ""
},
{
"docid": "a20f534093aba7e3633ca0ac07a56d53",
"score": "0.59443134",
"text": "def update!(**args)\n @freshness_duration = args[:freshness_duration] if args.key?(:freshness_duration)\n @freshness_property = args[:freshness_property] if args.key?(:freshness_property)\n end",
"title": ""
},
{
"docid": "a20f534093aba7e3633ca0ac07a56d53",
"score": "0.59443134",
"text": "def update!(**args)\n @freshness_duration = args[:freshness_duration] if args.key?(:freshness_duration)\n @freshness_property = args[:freshness_property] if args.key?(:freshness_property)\n end",
"title": ""
},
{
"docid": "2c309c8084bf29f0b8d8674d22086956",
"score": "0.59424853",
"text": "def method_missing(method, *args)\n super if @updated\n set_up_properties_from(@client.get(@path))\n self.send method, *args\n end",
"title": ""
},
{
"docid": "2c309c8084bf29f0b8d8674d22086956",
"score": "0.59424853",
"text": "def method_missing(method, *args)\n super if @updated\n set_up_properties_from(@client.get(@path))\n self.send method, *args\n end",
"title": ""
},
{
"docid": "879f1214e030bb2d9e43a0aedb1bc3ea",
"score": "0.593523",
"text": "def update_with(attributes)\n assign_attributes(attributes)\n end",
"title": ""
},
{
"docid": "10b1cb39dbb1f67820e37bb6d2632986",
"score": "0.5926413",
"text": "def update\n # don't need to update; hash is shared\n end",
"title": ""
},
{
"docid": "51982942bd4f09be3f7adc59da4cf104",
"score": "0.5924831",
"text": "def update(attributes)\n HashProxy.with(attributes) do |proxy|\n self.class.attribute_names.each do |name|\n send(\"#{name}=\", proxy[name]) if proxy.key?(name)\n end\n end\n save\n end",
"title": ""
},
{
"docid": "f0dd489c52fa73b1c3846fa43727c29e",
"score": "0.592427",
"text": "def update!(**args)\n @object_id_prop = args[:object_id_prop] if args.key?(:object_id_prop)\n @relation = args[:relation] if args.key?(:relation)\n @subject_id = args[:subject_id] if args.key?(:subject_id)\n end",
"title": ""
},
{
"docid": "4229acd17d03e94871226b09dd3bd37d",
"score": "0.59233046",
"text": "def update!(**args)\n @boolean_property_options = args[:boolean_property_options] if args.key?(:boolean_property_options)\n @date_property_options = args[:date_property_options] if args.key?(:date_property_options)\n @display_options = args[:display_options] if args.key?(:display_options)\n @double_property_options = args[:double_property_options] if args.key?(:double_property_options)\n @enum_property_options = args[:enum_property_options] if args.key?(:enum_property_options)\n @html_property_options = args[:html_property_options] if args.key?(:html_property_options)\n @integer_property_options = args[:integer_property_options] if args.key?(:integer_property_options)\n @is_facetable = args[:is_facetable] if args.key?(:is_facetable)\n @is_repeatable = args[:is_repeatable] if args.key?(:is_repeatable)\n @is_returnable = args[:is_returnable] if args.key?(:is_returnable)\n @is_sortable = args[:is_sortable] if args.key?(:is_sortable)\n @is_suggestable = args[:is_suggestable] if args.key?(:is_suggestable)\n @is_wildcard_searchable = args[:is_wildcard_searchable] if args.key?(:is_wildcard_searchable)\n @name = args[:name] if args.key?(:name)\n @object_property_options = args[:object_property_options] if args.key?(:object_property_options)\n @text_property_options = args[:text_property_options] if args.key?(:text_property_options)\n @timestamp_property_options = args[:timestamp_property_options] if args.key?(:timestamp_property_options)\n end",
"title": ""
},
{
"docid": "4229acd17d03e94871226b09dd3bd37d",
"score": "0.59233046",
"text": "def update!(**args)\n @boolean_property_options = args[:boolean_property_options] if args.key?(:boolean_property_options)\n @date_property_options = args[:date_property_options] if args.key?(:date_property_options)\n @display_options = args[:display_options] if args.key?(:display_options)\n @double_property_options = args[:double_property_options] if args.key?(:double_property_options)\n @enum_property_options = args[:enum_property_options] if args.key?(:enum_property_options)\n @html_property_options = args[:html_property_options] if args.key?(:html_property_options)\n @integer_property_options = args[:integer_property_options] if args.key?(:integer_property_options)\n @is_facetable = args[:is_facetable] if args.key?(:is_facetable)\n @is_repeatable = args[:is_repeatable] if args.key?(:is_repeatable)\n @is_returnable = args[:is_returnable] if args.key?(:is_returnable)\n @is_sortable = args[:is_sortable] if args.key?(:is_sortable)\n @is_suggestable = args[:is_suggestable] if args.key?(:is_suggestable)\n @is_wildcard_searchable = args[:is_wildcard_searchable] if args.key?(:is_wildcard_searchable)\n @name = args[:name] if args.key?(:name)\n @object_property_options = args[:object_property_options] if args.key?(:object_property_options)\n @text_property_options = args[:text_property_options] if args.key?(:text_property_options)\n @timestamp_property_options = args[:timestamp_property_options] if args.key?(:timestamp_property_options)\n end",
"title": ""
},
{
"docid": "32ed734ad4f899f0ee9ec74a760ca1d0",
"score": "0.5921224",
"text": "def update\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "900f4c147e0916b2e9270373fb83c7e2",
"score": "0.59144294",
"text": "def update_attributes attributes\n @attributes.merge! attributes\n end",
"title": ""
},
{
"docid": "f63de190ae582620103d96f60d684114",
"score": "0.59142506",
"text": "def update!(**args)\n @async_options = args[:async_options] if args.key?(:async_options)\n @input_mappings = args[:input_mappings] if args.key?(:input_mappings)\n @name_property = args[:name_property] if args.key?(:name_property)\n @validation_options = args[:validation_options] if args.key?(:validation_options)\n end",
"title": ""
},
{
"docid": "512d9095b05a696270730ee09c640773",
"score": "0.58887535",
"text": "def update\r\n end",
"title": ""
},
{
"docid": "5b1f6d40d29f0afb908434d0a6404ac8",
"score": "0.58854496",
"text": "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @type = args[:type] if args.key?(:type)\n end",
"title": ""
},
{
"docid": "efcb8c985b9e7911a606a9149b4ab171",
"score": "0.5883008",
"text": "def update\n raise NotImplemented\n end",
"title": ""
},
{
"docid": "65f67197ac4544cbebca350d889922ee",
"score": "0.58792305",
"text": "def update_obj\n mean, sd = rating.to_glicko_rating\n @obj.rating = mean\n @obj.rating_deviation = sd\n @obj.volatility = volatility\n end",
"title": ""
},
{
"docid": "c71a8be944fb89ab77a17fd4c16f7193",
"score": "0.5876954",
"text": "def update_values\n end",
"title": ""
},
{
"docid": "c71a8be944fb89ab77a17fd4c16f7193",
"score": "0.5876954",
"text": "def update_values\n end",
"title": ""
},
{
"docid": "10e162e857be9c47150e8eccd327cad9",
"score": "0.58744955",
"text": "def update\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "389ac4585e8143f353e2535499a23085",
"score": "0.5857968",
"text": "def update!(**args)\n @answers_header_signals = args[:answers_header_signals] if args.key?(:answers_header_signals)\n @property_value = args[:property_value] if args.key?(:property_value)\n @response_meaning_application = args[:response_meaning_application] if args.key?(:response_meaning_application)\n end",
"title": ""
},
{
"docid": "c202a823016f05ee2fc4aade77320497",
"score": "0.5845542",
"text": "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @method_prop = args[:method_prop] if args.key?(:method_prop)\n @name = args[:name] if args.key?(:name)\n @state = args[:state] if args.key?(:state)\n end",
"title": ""
},
{
"docid": "dc268f568dcb7aca1d3905736d2477af",
"score": "0.5841629",
"text": "def update attributes, collection #:nodoc:\n 0\n end",
"title": ""
},
{
"docid": "9763ac25d7fdf4b4f35a971609f70b04",
"score": "0.58363605",
"text": "def update_property_groups(roll)\n @property_groups.each { |_, v| v.update_rent(roll) }\n end",
"title": ""
},
{
"docid": "541550458a4c8f94afeb6b10c0cb2293",
"score": "0.5829255",
"text": "def update!(**args)\n @source_property = args[:source_property] if args.key?(:source_property)\n end",
"title": ""
},
{
"docid": "49a282f2ce0c099a5ced60524a492b4f",
"score": "0.582919",
"text": "def update_info(update_attr_hash)\n update_attr_hash.each do |k,v| \n\t\t\tself.send(\"#{k}=\",v)\n\t\tend\n end",
"title": ""
},
{
"docid": "f6c4eafa4f48a0c81157fb03ff350901",
"score": "0.5822138",
"text": "def update_properties(path, properties)\n prop_patch = PropPatch.new(properties)\n emit('propPatch', [path, prop_patch])\n prop_patch.commit\n\n prop_patch.result\n end",
"title": ""
},
{
"docid": "524a6a969929f9af4bad05dbd9c8f935",
"score": "0.58208305",
"text": "def update\n set_deltatime\n set_last_update_at\n end",
"title": ""
}
] |
9a7a627589b49fa036b4639885024be7
|
Returns true if the node has round/square/curly brackets.
|
[
{
"docid": "27aed121be5a1cb388d560d6716c0361",
"score": "0.78960484",
"text": "def brackets?(node); end",
"title": ""
}
] |
[
{
"docid": "4000b42dff2dd805aab5db867e91d67b",
"score": "0.7207159",
"text": "def brackets?(node)\n node.loc.end\n end",
"title": ""
},
{
"docid": "561e558fa1c3f18669e3638f79bfdc54",
"score": "0.70166457",
"text": "def inside_empty_brackets?\n bracket?(prev_char) && bracket?(next_char) && inside_blank_pair?\n end",
"title": ""
},
{
"docid": "0f873899126f8456fb1d58be09571850",
"score": "0.6750604",
"text": "def balance_space?\n inside_empty_brackets?\n end",
"title": ""
},
{
"docid": "679ba7cf5ba1e91b3131515d4f72f15b",
"score": "0.66579807",
"text": "def balanced_brackets?(expr)\n return nil unless expr.is_a? Array\n brakets = 0\n expr.each do |el|\n case el\n when '('\n brakets += 1\n when ')'\n brakets -= 1\n end\n end\n brakets == 0 ? (return true) : (return false)\n end",
"title": ""
},
{
"docid": "2d3f0b219d4ff81eb7ac9f5cfb900934",
"score": "0.64070743",
"text": "def closing_brace_on_same_line?(node); end",
"title": ""
},
{
"docid": "b0d51c36b1681715feaa50ac3bb100a2",
"score": "0.6400061",
"text": "def is_bracketed(list)\n bool(list.bracketed)\n end",
"title": ""
},
{
"docid": "f7cbeae678e44badd84ae286a14a63d3",
"score": "0.63748986",
"text": "def bracketed\n false\n end",
"title": ""
},
{
"docid": "395fc40d361bc1e12849c31d26eb56cc",
"score": "0.63234097",
"text": "def opening_brace_on_same_line?(node); end",
"title": ""
},
{
"docid": "a45274f63aa291f30dc33853f1d15892",
"score": "0.61588943",
"text": "def paren?\n false\n end",
"title": ""
},
{
"docid": "a69470a113c2965ea1bf6ca9ba4f8a05",
"score": "0.61408865",
"text": "def balanced?(string)\n parens = 0\n curly = 0\n brackets = 0\n string.each_char do |char|\n parens += 1 if char == '('\n parens -= 1 if char == ')'\n curly += 1 if char == '{'\n curly -= 1 if char == '}'\n brackets += 1 if char == '['\n brackets -= 1 if char == ']'\n break if parens < 0 || curly\n end\n\n parens.zero?\nend",
"title": ""
},
{
"docid": "03337e6dffe815d9f6be3b0032c8ad0f",
"score": "0.61123526",
"text": "def grounded?(node, hashes)\n (!(node.node?)) || (hashes.member? node)\n end",
"title": ""
},
{
"docid": "4af82292c2cde699357eadcb15100069",
"score": "0.6102992",
"text": "def balanced?(string)\n parens = 0\n string.each_char do |char|\n parens += 1 if char =~ /[({\\[\\\"\\']/\n parens -= 1 if char =~ /[)}\\]\\\"\\']/\n break if parens < 0\n end\n\n parens.zero?\nend",
"title": ""
},
{
"docid": "c8fafcb8959b3c634b7d925091a14706",
"score": "0.60648984",
"text": "def new_line_needed_before_closing_brace?(node); end",
"title": ""
},
{
"docid": "10d016211d397c58e5ccc047e0083757",
"score": "0.60043544",
"text": "def balanced?(string)\n first_found = string.match(/[(|)]/).to_s\n if first_found == ')'\n return false\n end\n left = string.count('(')\n right = string.count(')')\n last_left_index = string.rindex('(')\n last_right_index = string.rindex(')')\n if last_left_index != nil && last_right_index != nil\n if last_left_index > last_right_index\n return false\n end\n end\n\n if left == right\n return true\n else\n return false\n end\nend",
"title": ""
},
{
"docid": "726754ed01323e3699bb6e70dfc532e8",
"score": "0.5991457",
"text": "def balanced?(string)\n brackets = 0\n string.chars.each do |char|\n brackets += 1 if char == '('\n brackets -= 1 if char == ')'\n break if brackets < 0\n end\n brackets == 0 ? true : false\nend",
"title": ""
},
{
"docid": "dd8ce5bb6f12354a84a6d376bf9afb8c",
"score": "0.5988973",
"text": "def is_well_formed?\n\t\t\treturn self.node_stack.length == 1\n\t\tend",
"title": ""
},
{
"docid": "e205f60bee931ff303ee026a78c57492",
"score": "0.595238",
"text": "def nested?\n @nodes.any?\n end",
"title": ""
},
{
"docid": "902fec2d80446327611724922c3fbcfb",
"score": "0.5949683",
"text": "def balanced_parentheses?(string)\n stack = []\n string.chars.each do |c|\n return false if !check_parentheses(c, \"(\", \")\", stack) || !check_parentheses(c, \"[\", \"]\", stack)\n end\n stack.empty?\nend",
"title": ""
},
{
"docid": "fcb63e0cfa9f9eb2153feff1b15a9b00",
"score": "0.594494",
"text": "def balanced(string)\n strStack = Stack.new\n opens_and_closes = {\n \"}\" => \"{\", \n \")\" => \"(\", \n \"]\" => \"[\"\n }\n string.each_char do |char|\n if ['(', '[', '{'].include?(char)\n strStack.push(char)\n else\n element = strStack.pop \n\n if opens_and_closes[char] != element\n return false\n end\n end\n end\n \n \n return strStack.empty?\nend",
"title": ""
},
{
"docid": "71e6e675a983fd0ddd04ac11cd69cfe0",
"score": "0.59423506",
"text": "def bracket?(char)\n BRACKETS.keys.include?(char) || BRACKETS.values.include?(char)\n end",
"title": ""
},
{
"docid": "8f09c76f46bfb099370ed39ab873c773",
"score": "0.59367996",
"text": "def is_valid(s)\n stack = []\n comp = { ']'=>'[', '}'=>'{', ')'=>'(' }\n close = [')', ']', '}']\n parens = s.split(//)\n (0..parens.length - 1).each { |i|\n if (close.include?(parens[i]))\n if (stack.last == comp[parens[i]])\n stack.pop()\n else\n stack.push(parens[i])\n end\n else\n stack.push(parens[i])\n end\n }\n stack.length == 0 ? true : false\nend",
"title": ""
},
{
"docid": "73bef3e2bf730ae47f4e6df4a9343203",
"score": "0.5929752",
"text": "def balanced?(text)\n parens = 0\n text.each_char do |char|\n parens += 1 if char == '('\n parens -= 1 if char == ')'\n\n break if parens == -1\n end\n\n parens.zero?\nend",
"title": ""
},
{
"docid": "81946d74be64b096dab104b96d6aa26d",
"score": "0.59185755",
"text": "def balanced?(str)\n parens = 0\n str.chars.each do |char|\n if char == \"(\" && parens >=0\n parens +=1\n end\n if char == \")\"\n parens -=1\n end\n end\n parens == 0\nend",
"title": ""
},
{
"docid": "2a76c847412073ac18c5e334cda80a33",
"score": "0.5909473",
"text": "def auto_close_bracket?(char)\n true\n end",
"title": ""
},
{
"docid": "b5826cc1328d7538f44a3eb0343abf50",
"score": "0.5906614",
"text": "def balanced_brackets(string)\n opening_brackets = \"([{\"\n closing_brackets = \")]}\"\n matching_brackets = {\")\"=> \"(\", \"]\"=> \"[\", \"}\"=> \"{\"}\n stack = []\n\n string.each_char { |char|\n if opening_brackets[char]\n stack << char\n elsif closing_brackets[char]\n if stack.length == 0\n return false\n end\n \n if stack[-1] == matching_brackets[char]\n stack.pop()\n else\n return false\n end\n end\n }\n return stack.length == 0\nend",
"title": ""
},
{
"docid": "58e0a54e5ac0bc98f4a8a9525b232379",
"score": "0.5895445",
"text": "def balanced(string)\n return false if string.length.odd?\n\n open_parens = Stack.new\n string.each_char do |paren|\n if paren == \"{\" || paren == \"[\" || paren == \"(\"\n open_parens.push(paren)\n elsif paren == \"}\"\n last = open_parens.pop\n return false if last != \"{\"\n elsif paren == \"]\"\n last = open_parens.pop\n return false if last != \"[\"\n elsif paren == \")\"\n last = open_parens.pop\n return false if last != \"(\"\n end\n end\n return true\nend",
"title": ""
},
{
"docid": "51acc1dc61cccf339c3ec03d4f921234",
"score": "0.58921504",
"text": "def nested(s)\n\tleft = 0\n\tright = 0\n\ts.each_char do |l|\n\t\t\tleft += 1 if l == \"(\"\n\t\t\tright += 1 if l == \")\"\n\tend\n\treturn true if left == right\n\treturn false\nend",
"title": ""
},
{
"docid": "31d97068e47c28ee6b0ef09ea82c2f0b",
"score": "0.5870373",
"text": "def balanced?(string)\n open_parens = string.count('(')\n closed_parens = string.count(')')\n first_open = string.index('(')\n first_closed = string.index(')')\n last_open = string.reverse.index('(')\n last_closed = string.reverse.index(')')\n\n if open_parens == closed_parens &&\n (first_open == first_closed || first_open < first_closed) &&\n (last_open == last_closed || last_open > last_closed)\n return true\n else\n return false\n end\nend",
"title": ""
},
{
"docid": "401c692395d35d2097803985950af37e",
"score": "0.5836669",
"text": "def balanced?(current_node = root)\n depth(current_node) == -1 ? false : true\n end",
"title": ""
},
{
"docid": "e54b5c636fa37b6978fd59adf9afc066",
"score": "0.5831271",
"text": "def balanced?\n left = height(@root.left_node)\n right = height(@root.right_node)\n\n if (left - right).abs <= 1\n return true\n end\n\n return false\n end",
"title": ""
},
{
"docid": "90cc8f5c5420ad11ac4c7fad9f270db0",
"score": "0.58274686",
"text": "def balanced?(string)\n paren_counter = 0\n string.chars.each do |element|\n return false if paren_counter < 0 \n paren_counter += 1 if element == '('\n paren_counter -= 1 if element == ')'\n end\n return true if paren_counter == 0\n false\nend",
"title": ""
},
{
"docid": "580b539ad7529711d9d401595ab22a7d",
"score": "0.57864136",
"text": "def notation?\n node_type == NOTATION_NODE\n end",
"title": ""
},
{
"docid": "5ac8f2ffadd9d3f37a16e1e87c2af862",
"score": "0.57673293",
"text": "def nested(s)\n return true if s.empty?\n return false if s.length.odd?\n\n if (s[0] == \"(\" && s[-1] == \")\") && nested(s[1..-2])\n return true\n else\n return false\n end\nend",
"title": ""
},
{
"docid": "1afc6e5b252867490420370a43fb58c1",
"score": "0.57636094",
"text": "def nested(s, low = 0, high = s.length - 1)\n if s.empty? || low >= high\n return true \n elsif s.length.odd?\n return false \n end \n\n return (s[low] == \"(\" && s[high] == \")\") && nested(s, low + 1, high - 1)\nend",
"title": ""
},
{
"docid": "fe86d63ac84816c1c4ce033dfeb49300",
"score": "0.57511085",
"text": "def balanced?(string)\n parens_order = []\n string.chars.each do |char|\n parens_order << char if ['(', ')'].include?(char)\n return false if parens_order.count(\")\") > parens_order.count(\"(\")\n end\n\n parens_order.count(\"(\") != parens_order.count(\")\") ? false : true\nend",
"title": ""
},
{
"docid": "16029489bf77cfa8853c2693243e6c9b",
"score": "0.57452303",
"text": "def literal?(node); end",
"title": ""
},
{
"docid": "0b86205af4718f86bc03746151439301",
"score": "0.57360834",
"text": "def balanced?(string)\n parens = 0\n curly_braces = 0\n square_brackets = 0\n single_quotes = 0\n double_quotes = 0\n\n string.each_char do |char|\n parens += 1 if char == '('\n parens -= 1 if char == ')'\n curly_braces += 1 if char == '{'\n curly_braces -= 1 if char == '}'\n square_brackets += 1 if char == '['\n square_brackets -= 1 if char == ']'\n single_quotes += 1 if char == \"'\"\n double_quotes += 1 if char == '\"'\n\n break if (parens < 0 || curly_braces < 0 || square_brackets < 0) \n end\n\n parens.zero? && curly_braces.zero? && square_brackets.zero? && single_quotes.even?\\\n && double_quotes.even?\n\nend",
"title": ""
},
{
"docid": "9d12b9e6a872c761b4ac5625052312ba",
"score": "0.57286507",
"text": "def balanced?(string)\n parens = 0\n string.each_char do |char|\n parens += 1 if char == '('\n parens -= 0 if char == ')'\n break if parens < 0\n end\n\n parens.zero?\nend",
"title": ""
},
{
"docid": "8d9f5c2eb51d2c6329d22e6522f2d721",
"score": "0.5728078",
"text": "def balanced?(string)\n parens = 0\n string.each_char do |char|\n parens += 1 if char == '('\n parens -= 1 if char == ')'\n break if parens < 0\n end\n\n parens.zero?\nend",
"title": ""
},
{
"docid": "8d9f5c2eb51d2c6329d22e6522f2d721",
"score": "0.5728078",
"text": "def balanced?(string)\n parens = 0\n string.each_char do |char|\n parens += 1 if char == '('\n parens -= 1 if char == ')'\n break if parens < 0\n end\n\n parens.zero?\nend",
"title": ""
},
{
"docid": "c8aa3233fb2c3ff020a8b932887c2c96",
"score": "0.57274026",
"text": "def balanced?(node = root)\n return true if node.nil?\n\n left_height = height(node.left)\n right_height = height(node.right)\n\n return true if (left_height - right_height).abs <= 1 && balanced?(node.left) && balanced?(node.right)\n\n false\n end",
"title": ""
},
{
"docid": "d29b431d5218560b02befe3dd4a43f5b",
"score": "0.57207155",
"text": "def nesting_operator?(key)\n NestingOperators.include?(key)\n end",
"title": ""
},
{
"docid": "3da14a8f36deef571b104e85d2181ddb",
"score": "0.57165766",
"text": "def balanced?(string)\n string.gsub!(/[^\\(\\)]/, '')\n total = 0\n string.chars.each do |paranthese|\n if paranthese == '('\n total += 1\n elsif paranthese == ')'\n total -= 1\n end\n return false if total < 0\n end\n total == 0\nend",
"title": ""
},
{
"docid": "9287c5b13c7492efdbfe24a838a25afa",
"score": "0.57045585",
"text": "def is_node?(obj)\n obj.respond_to?(:children) && obj.location.expression\n end",
"title": ""
},
{
"docid": "8eca07021e98714b90fd074d69b8abf9",
"score": "0.5680379",
"text": "def balanced?(string)\n parentheses_counter = 0\n string.chars.each do |character|\n return false if parentheses_counter > 0\n if character == '(' then parentheses_counter -= 1\n elsif character == ')' then parentheses_counter += 1\n else character\n end\n end\n parentheses_counter.zero?\nend",
"title": ""
},
{
"docid": "1d8c885c677ad3bf412c99157e5ccbaa",
"score": "0.56784624",
"text": "def balanced?(str)\n paren_num = 0\n str.each_char do |char|\n paren_num += 1 if char == '('\n paren_num -= 1 if char == ')'\n return false if paren_num < 0\n end\n paren_num == 0\nend",
"title": ""
},
{
"docid": "a9e6633c18ffb460d95b395a5c0c5b8f",
"score": "0.56665534",
"text": "def balanced?\n (height(@root.left) - height(root.right)).between?(-1, 1)\n end",
"title": ""
},
{
"docid": "919bb359ed7eaea12410778ecca47abd",
"score": "0.5663682",
"text": "def needs_paren? # :nodoc:\n is_a?(Nonterminal) && rules.length > 1\n end",
"title": ""
},
{
"docid": "1e7596cecf8ef31ac83c3c990219b21e",
"score": "0.56527114",
"text": "def empty?\n node.all('*').length.zero?\n end",
"title": ""
},
{
"docid": "ba9b1e2ba3b0ba29291da993f01fe8f1",
"score": "0.5644996",
"text": "def balanced(str)\n open_braces = [\"(\", \"[\", \"{\"]\n close_braces = [\")\", \"]\", \"}\"]\n braces = Stack.new\n i = 0\n while i < str.length\n braces.push(str[i]) if open_braces.include?(str[i]) \n\n if close_braces.include?(str[i])\n top = braces.pop\n if open_braces.index(top) != close_braces.index(str[i])\n return false\n end\n end\n i += 1\n end\n return braces.empty?\nend",
"title": ""
},
{
"docid": "d2bfd40ff0eb682230d6096303275a96",
"score": "0.563189",
"text": "def balanced(string)\n braces_stack = Stack.new\n string.each_char do |n|\n case n \n when \"(\"\n braces_stack.push(n)\n when \"{\"\n braces_stack.push(n)\n when \"[\"\n braces_stack.push(n)\n when \")\"\n return false if !stack_checker(braces_stack, \"(\")\n when \"}\"\n return false if !stack_checker(braces_stack, \"{\")\n when \"]\"\n return false if !stack_checker(braces_stack, \"[\")\n end \n end \n return braces_stack.empty? \nend",
"title": ""
},
{
"docid": "0dd4ae4572c69ce61dfdc8ac2a08d387",
"score": "0.5631287",
"text": "def balanced?\n difference_left_right = @root.left_child.depth - @root.right_child.depth\n difference_left_right.between?(-1, 1)\n end",
"title": ""
},
{
"docid": "a2d59e00a1908d92b1daf5f37157731c",
"score": "0.5622296",
"text": "def validParentheses(string)\n\t# are there any characters that aren't parantheses?\n\t# count num of open paren, adjusting for closures, if dips negative, unmatched\n\tstring = string.gsub(/[^\\)|^\\(]/, \"\")\n\tcount = 0\n\tstring.each_char do |char|\n\t\tchar == \"(\" ? (count +=1) : (count -=1)\n\t\treturn false if count < 0\n\tend \n\t# at end iteration, must have equal num of open and closed\n\tcount == 0 ? (true) : (false)\nend",
"title": ""
},
{
"docid": "3b5fa01f01a79c9aa5aed7fd63345cf4",
"score": "0.5584096",
"text": "def rightParen?(str)\n str.eql? \")\"\n end",
"title": ""
},
{
"docid": "91c63212730924d1057ef969fa57a9f4",
"score": "0.5582635",
"text": "def balanced?(string)\n open_counter = 0\n \n string.chars.each do |char|\n return false if open_counter < 0\n\n case char\n when '(' then open_counter += 1\n when ')' then open_counter -= 1\n end\n\n end\n\n open_counter == 0\nend",
"title": ""
},
{
"docid": "cbd56630b9c4f7df046ca1d885526dba",
"score": "0.55758",
"text": "def nested_brackets!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 112 )\n\n \n # - - - - main rule block - - - -\n # at line 1009:5: '[' (~ ( '[' | ']' | '\\\\\\\\' ) | '\\\\\\\\' . | NESTED_BRACKETS )* ']'\n match( 0x5b )\n # at line 1009:9: (~ ( '[' | ']' | '\\\\\\\\' ) | '\\\\\\\\' . | NESTED_BRACKETS )*\n while true # decision 67\n alt_67 = 4\n look_67_0 = @input.peek( 1 )\n\n if ( look_67_0.between?( 0x0, 0x5a ) || look_67_0.between?( 0x5e, 0xffff ) )\n alt_67 = 1\n elsif ( look_67_0 == 0x5c )\n alt_67 = 2\n elsif ( look_67_0 == 0x5b )\n alt_67 = 3\n\n end\n case alt_67\n when 1\n # at line 1009:11: ~ ( '[' | ']' | '\\\\\\\\' )\n if @input.peek( 1 ).between?( 0x0, 0x5a ) || @input.peek( 1 ).between?( 0x5e, 0xff )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n when 2\n # at line 1009:35: '\\\\\\\\' .\n match( 0x5c )\n match_any\n\n when 3\n # at line 1009:45: NESTED_BRACKETS\n nested_brackets!\n\n else\n break # out of loop for decision 67\n end\n end # loop for decision 67\n match( 0x5d )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 112 )\n\n end",
"title": ""
},
{
"docid": "ad084f46e7f64759067a29a37ddf4464",
"score": "0.55703324",
"text": "def node_on_single_line?(node)\n return if node.source_range.start_pos.line != node.source_range.end_pos.line\n\n # The Sass parser reports an incorrect source range if the trailing curly\n # brace is on the next line, e.g.\n #\n # p {\n # }\n #\n # Since we don't want to count this as a single line node, check if the\n # last character on the first line is an opening curly brace.\n engine.lines[node.line - 1].strip[-1] != '{'\n end",
"title": ""
},
{
"docid": "d08e0ffdb020637536dd8d72c305b21c",
"score": "0.5565029",
"text": "def delimited_string_literal?(node); end",
"title": ""
},
{
"docid": "6821fb01dea0f19e4cd631ce4302882f",
"score": "0.5563805",
"text": "def balanced(string)\n stack = []\n parens = { \"(\" => \")\", \"{\" => \"}\", \"[\" => \"]\" }\n\n string.each_char do |c|\n if parens[c]\n stack.push(c)\n elsif parens[stack.pop] != c\n return false\n end\n end\n stack.empty?\nend",
"title": ""
},
{
"docid": "1a5682fd60f33127993d892dd7cb9391",
"score": "0.55533504",
"text": "def _is_root_node?\n @nodes.size == 1\n end",
"title": ""
},
{
"docid": "09c874baa43855bebaf81252549f26eb",
"score": "0.5544736",
"text": "def balanced?(str)\n arr = str.chars.select { |char| char == '(' || char == ')' }\n return false if arr.first == ')' || arr.last == '('\n return true if arr.count('(') == arr.count(')')\n false\nend",
"title": ""
},
{
"docid": "489334261a4cc9fd2f0e370a51498278",
"score": "0.55299664",
"text": "def closing_brace_on_same_line?(node)\n node.loc.end.line == children(node).last.last_line\n end",
"title": ""
},
{
"docid": "56df4908e4265b5fafda8c7f2014ac67",
"score": "0.5529085",
"text": "def balanced(string)\n # hashes to track braces\n close_to_open = {'}' => '{', ')' => '(', ']' => '['}\n open_to_close = {'{' => '}', '(' => ')', '[' => ']'}\n # brace stack\n stack = Stack.new\n\n string.each_char do |c| # this automatically iterates in order i think\n if open_to_close[c]\n stack.push(c)\n elsif close_to_open[c]\n get_top = stack.pop\n return false if close_to_open[c] != get_top # must match brace\n end \n end\n\n return stack.empty?\nend",
"title": ""
},
{
"docid": "3815a4f315c8fd0e8089a3e85942c8c1",
"score": "0.55273485",
"text": "def valid_parentheses(string)\n letters = string.split(\"\")\n closed = true\n letters.each do |item|\n closed = false if item == \"(\"\n closed = true if item == \")\"\n end\n return (string.count('(') != string.count(')')) || closed != true ? false : true\nend",
"title": ""
},
{
"docid": "7155bf847277df1bb61265fd3abfc044",
"score": "0.55271477",
"text": "def bracket_matcher(string)\n @result = true\n @elements = string.split('(')\n @result = false if @elements.length == 1 || @elements.empty?\n @opening_bracket_count = @elements.length - 1\n @closing_bracket_count = 0\n @elements.each_with_index do |element, index|\n next if index == 0\n\n # finding how many times exactly closing bracket is present in each element of the array\n # closing_bracket_ocurrences = element.count(')')\n @closing_bracket_count += element.count(')')\n end\n @result = false if @opening_bracket_count != @closing_bracket_count\n @result\nend",
"title": ""
},
{
"docid": "a37c1c80fa65a02153c7de5a3745dab4",
"score": "0.5517118",
"text": "def leaf?(sexp)\n list?(sexp) && depth(sexp) == 1\nend",
"title": ""
},
{
"docid": "d33fed8b496b32be7fe570185abc1e2f",
"score": "0.55157125",
"text": "def is_closed?\n return false if nodes.size < 2\n nodes[0] == nodes[-1]\n end",
"title": ""
},
{
"docid": "2556430d079c63dc8e0f5595090937b5",
"score": "0.5507047",
"text": "def balanced?(str)\n opening = 0\n closing = 0\n str.chars.each do |char|\n opening += 1 if char == '('\n closing += 1 if char == ')'\n return false if closing > opening\n end\n closing == opening\nend",
"title": ""
},
{
"docid": "8fae851d6d65b1c4a1b9f898e461dfcc",
"score": "0.55056727",
"text": "def check_closed(string)\n str = string.gsub(/[^(\\[<{}>\\])]/,\"\")\n print str == str.reverse_brackets\nend",
"title": ""
},
{
"docid": "472442ea8c9acb94d329c50ca6049695",
"score": "0.54938155",
"text": "def opening_brace_on_same_line?(node)\n node.loc.begin.line == children(node).first.first_line\n end",
"title": ""
},
{
"docid": "5d27268ed6b0495b087f90ef3fa6d311",
"score": "0.5487624",
"text": "def nested(s)\n if s.length == 0\n return true\n else\n first_parens = (s[0] == \"(\")\n last_parens = (s[-1] == \")\")\n s[0] = ''\n s.chop!\n return first_parens && last_parens && nested(s)\n end\nend",
"title": ""
},
{
"docid": "568a3c60f9b34e712cecbfcb9dd6ae14",
"score": "0.54839057",
"text": "def supported?(node)\n !find_parser(node.inner_text).nil?\n end",
"title": ""
},
{
"docid": "403d43fadef2367ec4b40bde9b069d4f",
"score": "0.54789686",
"text": "def balanced?(string)\n parentheses = string.chars.select do |char|\n char == \"(\" || char == \")\"\n end\n \n p_first_half = parentheses[0..parentheses.size/2.0-1]\n p_sec_half = parentheses[parentheses.size/2.0.ceil..parentheses.size-1]\n if parentheses.size.odd? || parentheses[0] == \")\"\n return false\n else\n p_first_half.reverse.join(\"\").gsub(/[()]/, \"(\" => \")\", \")\" => \"(\") == p_sec_half.join(\"\")\n end \nend",
"title": ""
},
{
"docid": "4f8183537ddc30288f26d8c5a41c4cdf",
"score": "0.54784656",
"text": "def any_oranges?\n true if @oranges_in_tree.length > 0\n end",
"title": ""
},
{
"docid": "e5bf7c0935c292932ea14778c0227bb9",
"score": "0.5476456",
"text": "def is_node?(); @type == GRT_NODE; end",
"title": ""
},
{
"docid": "21db1e38ab37664401ff332936863df2",
"score": "0.54722154",
"text": "def balanced?(str)\n paranthesis_stack = []\n balanced_paranthesis = true\n str.each_char do |chr|\n if chr == '('\n paranthesis_stack << chr\n elsif chr == ')' && !paranthesis_stack.empty?\n paranthesis_stack.pop\n elsif chr == ')' && paranthesis_stack.empty?\n balanced_paranthesis = false\n break\n end\n end\n balanced_paranthesis = false unless paranthesis_stack.empty?\n \n balanced_paranthesis\nend",
"title": ""
},
{
"docid": "70f32201ba4098fed2b4c13de42745f0",
"score": "0.5470368",
"text": "def nested(s)\n return false if s.length.odd?\n return false if s =~ /[^\\[\\]\\(\\)\\{\\}]/\n\n pairs = { '{' => '}', '[' => ']', '(' => ')' }\n\n stack = []\n s.chars do |bracket|\n if expectation = pairs[bracket]\n stack << expectation\n else\n return false unless stack.pop == bracket\n end\n end\n stack.empty?\nend",
"title": ""
},
{
"docid": "1564c772839d0dfdbb3f7349e1b7de29",
"score": "0.5469584",
"text": "def regexp_with_working_captures?(node); end",
"title": ""
},
{
"docid": "1b3f47b0a776eb72360f08c488219067",
"score": "0.54682565",
"text": "def nested(s)\n return true if s == \"\"\n return false if s.length % 2 != 0\n return s[0] == \"(\" && s[-1] == \")\" && nested(s[1,s.length - 2])\nend",
"title": ""
},
{
"docid": "bfd138530e67cb954e8ea2f6347c35dc",
"score": "0.5452866",
"text": "def balanced?(str)\n stack = []\n str.chars.each do |char|\n if char == ')' && stack.empty?\n return false\n elsif char == '('\n stack << char\n elsif stack.include?('(') && char == ')'\n stack.pop\n end\n end\n stack.empty?\nend",
"title": ""
},
{
"docid": "dac40e75822780f2ae21903ca02795d8",
"score": "0.5451509",
"text": "def balanced?(str)\n return false if str.count('(') != str.count(')')\n \n idx = 0\n str.chars.each do |char|\n if char == '('\n idx += 1\n elsif char == ')'\n idx -= 1\n end\n break if idx < 0\n end\n idx == 0 ? true : false\nend",
"title": ""
},
{
"docid": "34d2c9cb03cf69048058af2932f83c6b",
"score": "0.54502434",
"text": "def is_textnode?(); @type == GRT_TEXTNODE; end",
"title": ""
},
{
"docid": "a68ea105da0959b991909a9d12ad6abe",
"score": "0.5438364",
"text": "def balanced(string)\n brace_types = {\n \")\" => \"(\",\n \"]\" => \"[\",\n \"}\" => \"{\"\n }\n\n temp = []\n\n string.chars.each do |brace|\n if brace_types[brace]\n if brace_types[brace] == temp.last \n temp.pop\n else\n return false\n end\n else\n temp << brace\n end\n end\n\n return temp.empty? ? true : false\nend",
"title": ""
},
{
"docid": "8a96b0871d9bfa0ad9a935cef0058a6d",
"score": "0.5432888",
"text": "def valid?\n inner_root.children.detect{|node| node.valid? == false} == nil # should be explicitely nil !!\n end",
"title": ""
},
{
"docid": "05eb46a717c990bdd07df15572ec19c7",
"score": "0.5429081",
"text": "def inside_blank_pair?\n closing_pair(prev_char(:skip_space => true)) == next_char(:skip_space => true)\n end",
"title": ""
},
{
"docid": "ba3a0a03160a5abaad5b2e8a644cd067",
"score": "0.5427832",
"text": "def balanced?(string)\n counter = 0\n\n string.each_char do |char|\n if counter < 0\n return false\n elsif char == \"(\"\n counter += 1\n elsif char == \")\"\n counter -= 1\n end\n end\n\n counter == 0 \n\nend",
"title": ""
},
{
"docid": "2d2284a72e578e5da47823c44628f512",
"score": "0.54275984",
"text": "def scanned_node?(node); end",
"title": ""
},
{
"docid": "59553f631ba1f5f2b743b2c61ea0d1ad",
"score": "0.5423571",
"text": "def nested(s, first_index = 0, last_index = s.length - 1)\n # raise NotImplementedError, \"Method not implemented\"\n return false if s.length.odd?\n return true if s.empty?\n\n if first_index < last_index\n if s[first_index] == \"(\" && s[last_index] == \")\"\n return nested(s, first_index + 1, last_index - 1)\n else\n return false\n end\n end\n return true\nend",
"title": ""
},
{
"docid": "48ea53c2a606d038303eb946a8f8b8f5",
"score": "0.54198843",
"text": "def balanced?(str)\n parentheses = ['(', ')']\n paren_ary = str.chars.select {|char| char if parentheses.include?(char)}\n index = 0\n loop do\n break if index == paren_ary.size\n # paren_ary.each do |char|\n p paren_ary\n if paren_ary[index] == '('\n if paren_ary.include?(')')\n paren_ary.slice!(paren_ary.index(')'))\n paren_ary.slice!(paren_ary.index('('))\n else\n return false\n end\n else\n return false\n end\n end\n paren_ary.empty? #|| paren_ary == parentheses\nend",
"title": ""
},
{
"docid": "0cb3063827bf6b41d95f48f627624590",
"score": "0.54186124",
"text": "def node?\n (self.forestify_right_position - self.forestify_left_position) > 1\n end",
"title": ""
},
{
"docid": "dd20dd897ef1e45e064e2fb1d1039725",
"score": "0.54169935",
"text": "def balanced?\n # tree is balanced if the difference between left and right depths is within 1\n (Tree.depth(root.left) - Tree.depth(root.right)).abs <= 1\n end",
"title": ""
},
{
"docid": "17e9c55753d56cfe7c8a991fc7c3e71d",
"score": "0.5412558",
"text": "def nested(s)\n return true if s.length == 0\n return false if s.length % 2 != 0\n \n if s[0] + s[-1] == \"()\"\n return nested(s[1...-1])\n else\n return false\n end\n \n \n end",
"title": ""
},
{
"docid": "d11a44fb26593cc399ef74cddb7a4a6e",
"score": "0.5410196",
"text": "def valid_tree?\n true\n end",
"title": ""
},
{
"docid": "249c0c0bc721c13d4674f36265d981ad",
"score": "0.5409219",
"text": "def balanced_paranthesis(string)\n\tcomparison_paranthesis = []\n\topening_brackets = [\"(\",\"[\",\"{\"]\n\tpairs = {\n\t\t\"(\" => \")\",\n\t\t\"[\" => \"]\",\n\t\t\"{\" => \"}\"\n\t}\n\tstring.split(\"\").each do |char|\n\t\tif opening_brackets.include? char\n\t\t\tcomparison_paranthesis.push(char)\n\t\telse\n\t\t\tstarting_paranthesis = comparison_paranthesis.pop #\"(\"\n\t\t\tif pairs[starting_paranthesis] != char # ( != }\n\t\t\t\treturn false\t\n\t\t\tend\n\t\tend\n\tend\n\treturn comparison_paranthesis.empty?\nend",
"title": ""
},
{
"docid": "16908243f44a6b6636098143b50f31a5",
"score": "0.54057646",
"text": "def nested(s)\n return true if s.empty?\n return nested(s[1..-2]) if s[0] == \"(\" && s[-1] == \")\"\n return false\nend",
"title": ""
},
{
"docid": "4d7885bb9152aa2128455e1172b2133e",
"score": "0.5402301",
"text": "def cdata_node?(node)\n ['xhtml', 'html'].include?(node.attributes['type']) && !node.cdatas.empty?\n end",
"title": ""
},
{
"docid": "2cd41f68e98bdd843dfffc69d2008dda",
"score": "0.538874",
"text": "def isBalanced? str\n\n nParentheses = 0\n smiley = 0\n frowny = 0\n\n (0...str.length).each do |i|\n \n if str[i] == \":\" && str[i+1] == \"(\" then frowny += 1 \n elsif str[i] == \":\" && str[i+1] == \")\" then smiley += 1 end\n\n if str[i] == \"(\" then nParentheses += 1\n elsif str[i] == \")\" then nParentheses -= 1 end\n\n if nParentheses < 0 \n if smiley >= nParentheses.abs\n smiley -= nParentheses.abs\n nParentheses = 0\n else\n return false\n end\n end\n end\n\n if nParentheses == 0 then return true\n elsif frowny >= nParentheses then return true\n else return false end\n \nend",
"title": ""
},
{
"docid": "9ee8f85aca3e2dbcb7b381a8394d58c2",
"score": "0.53861",
"text": "def isRightParen?(str)\n return str.eql? ')'\n end",
"title": ""
},
{
"docid": "261e7f140b26229e7166332898327ef0",
"score": "0.5383369",
"text": "def fr_parens(word)\n /\\A(\\(|\\{|\\<|\\\\|\\/)/.match(word) != nil\n end",
"title": ""
},
{
"docid": "208b5d77489493527806b71787fad9a5",
"score": "0.53806317",
"text": "def parenthesis_checker(expression)\n return nil if expression.class != String\n opening = [\"(\", \"{\", \"[\"] \n closing = [\")\", \"}\", \"]\"]\n local_stack = Stack.new()\n #traversal the expresion searching for opening and closing elements\n expression.each_char do |char|\n if opening.include?(char) #if char is opening push it to stack\n local_stack.push(char)\n elsif closing.include?(char) #if char is closing, check for 2 conditions\n #1. if stack is empty, and iteration is checking closing symbol, opening is missing\n #2. if current closing symbol is not equal to opening in stack(top), missmatch\n if local_stack.is_empty?() || !is_parenthesis_pair?(local_stack.top(), char)\n return puts \"expression has invalid parenthesis\"\n else #else pop top opening symbol from stack\n local_stack.pop()\n end\n end\n end\n puts (local_stack.is_empty?()) ? \"expression has valid parenthesis\" :\n \"expression has invalid parenthesis\"\nend",
"title": ""
}
] |
af630984682f1a0b5a68e6092af0d102
|
Update properties of this object
|
[
{
"docid": "215e247ec23e153668686e3c1c276a44",
"score": "0.0",
"text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"title": ""
}
] |
[
{
"docid": "150fa2bdc1fc43d28ac45e2278a1f797",
"score": "0.7012568",
"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": "e72f78e0e269f94de07625d4972f0298",
"score": "0.6918917",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.6918917",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.6918917",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.6918917",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "e72f78e0e269f94de07625d4972f0298",
"score": "0.6918917",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n end",
"title": ""
},
{
"docid": "37ae8a386fde14c02d7021605aa72f45",
"score": "0.67404634",
"text": "def refresh\n self.class.base_properties.each_with_index do |prop, prop_id|\n @properties[prop] = get_property(prop_id)\n end\n refresh_features\n refresh_status\n refresh_config\n self\n end",
"title": ""
},
{
"docid": "10e41ec39ba2af73495ccece21c2d8a3",
"score": "0.6709981",
"text": "def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end",
"title": ""
},
{
"docid": "10e41ec39ba2af73495ccece21c2d8a3",
"score": "0.6709981",
"text": "def update!(**args)\n @subobject_properties = args[:subobject_properties] if args.key?(:subobject_properties)\n end",
"title": ""
},
{
"docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7",
"score": "0.66964126",
"text": "def update(attrs)\n super(attrs)\n end",
"title": ""
},
{
"docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7",
"score": "0.66964126",
"text": "def update(attrs)\n super(attrs)\n end",
"title": ""
},
{
"docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7",
"score": "0.66964126",
"text": "def update(attrs)\n super(attrs)\n end",
"title": ""
},
{
"docid": "092b765ad7cf3ce4b6bf4e7d8a2e6af7",
"score": "0.66964126",
"text": "def update(attrs)\n super(attrs)\n end",
"title": ""
},
{
"docid": "47bbd8b88b35da987fc3775b82211e56",
"score": "0.6619218",
"text": "def update_properties!(branch_id=nil)\n properties = fetch_properties(false, branch_id)\n length = properties.length\n counter = 0\n properties.each do |property|\n counter += 1\n if Vebra.debugging?\n puts \"[Vebra]: #{counter}/#{length}: live updating property with Vebra ref: #{property.attributes[:vebra_ref]}\"\n end\n live_update!(property)\n Vebra.set_last_updated_at(Time.now) if counter == length\n end\n end",
"title": ""
},
{
"docid": "769b77b7f7f9f82ae847f5968eb201dc",
"score": "0.6570895",
"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": "c3b6fccdeb696de5e9dbc38a9486b742",
"score": "0.6539287",
"text": "def update_attributes(properties_hash)\n self.class.get_class_properties.each do |property|\n key = property[:name].to_sym\n if properties_hash.has_key? key\n self.setValue(properties_hash[key], forKey:key)\n end\n end\n end",
"title": ""
},
{
"docid": "bb403006cc5423d9b1820fe684a7c5a5",
"score": "0.6517026",
"text": "def update\n # TODO: implement update\n end",
"title": ""
},
{
"docid": "1ee90e4f66e82aec13076a98b288a2d1",
"score": "0.63946927",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @states = args[:states] if args.key?(:states)\n end",
"title": ""
},
{
"docid": "23eb6f5fbeae4bf9f56ac93a4126b4b5",
"score": "0.63901657",
"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": "23eb6f5fbeae4bf9f56ac93a4126b4b5",
"score": "0.63901657",
"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": "3f85752da065340d4ca70ce879a3b23d",
"score": "0.63328683",
"text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n @total_value_count = args[:total_value_count] if args.key?(:total_value_count)\n @value = args[:value] if args.key?(:value)\n @value_status = args[:value_status] if args.key?(:value_status)\n end",
"title": ""
},
{
"docid": "da63345424fc9aecef032928485bd149",
"score": "0.6318612",
"text": "def update\n \n end",
"title": ""
},
{
"docid": "5a8e82caac01cee661bc875a5b0cf723",
"score": "0.62846893",
"text": "def refresh\n set_attributes\n end",
"title": ""
},
{
"docid": "60d8c4f58de490a0d7cdd918c16a2cce",
"score": "0.62692374",
"text": "def update(attrs)\n @attrs.update(attrs)\n self\n end",
"title": ""
},
{
"docid": "7a41bc9d5a07220fb8626d1fa90d2d79",
"score": "0.6264273",
"text": "def update!(**args)\n @properties = args[:properties] if args.key?(:properties)\n @source = args[:source] if args.key?(:source)\n end",
"title": ""
},
{
"docid": "29c22ae2290ffca9b9682a5f20f48103",
"score": "0.6241163",
"text": "def update_resource object, attributes\n object.update attributes\n end",
"title": ""
},
{
"docid": "91dc386ff8fa066852510a5d62b13078",
"score": "0.6216599",
"text": "def update(attrs)\n @attrs ||= {}\n @attrs.update(attrs)\n self\n end",
"title": ""
},
{
"docid": "6249943d1eeff63f8f611fcf73254058",
"score": "0.6214641",
"text": "def update\n \n end",
"title": ""
},
{
"docid": "1c12f310aca206a2cefff8c291007668",
"score": "0.6210363",
"text": "def update!(**args)\n @property = args[:property] if args.key?(:property)\n @schema = args[:schema] if args.key?(:schema)\n end",
"title": ""
},
{
"docid": "1c0316f22c6db917fa4719767b5326a9",
"score": "0.6203827",
"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": "1c0316f22c6db917fa4719767b5326a9",
"score": "0.6203827",
"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.620312",
"text": "def update(attributes = {})\n super(attributes)\n retrieve!\n self\n end",
"title": ""
},
{
"docid": "85a79fb5c3cc199e689344861658b09b",
"score": "0.6201905",
"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])))\n end\n end\n @dirty[property] = nil\n @attributes[:original][property] = attribute_get(property)\n end\n self.class.repository_or_fail.insert(RDF::Statement.new(@subject, RDF.type, type)) unless type.nil?\n end",
"title": ""
},
{
"docid": "549a7eef6c18558dea47a8e8d72df295",
"score": "0.62001497",
"text": "def update\n @objects.map(&:update);\n end",
"title": ""
},
{
"docid": "e1f766468b11768b786daa133483b157",
"score": "0.61728275",
"text": "def update\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "e1f766468b11768b786daa133483b157",
"score": "0.61728275",
"text": "def update\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "b76d372399abbb21b748df3ae7b06470",
"score": "0.6159924",
"text": "def live_update!(property)\n property_class = Vebra.models[:property][:class].to_s.camelize.constantize\n\n # ensure we have the full property attributes\n property.get_property if !property.attributes[:status] && property.attributes[:action] != 'deleted'\n\n # find & update or build a new property\n property_model = property_class.find_or_initialize_by_vebra_ref(property.attributes[:vebra_ref])\n\n # make sure property object is not empty\n return false if !property.attributes || !property.attributes[:property_type]\n\n # if the property has been deleted, mark it appropriately and move on\n if property.attributes[:action] == 'deleted'\n return property_model.destroy\n end\n\n # extract accessible attributes for the property\n property_accessibles = property_class.accessible_attributes.map(&:to_sym)\n property_attributes = property.attributes.inject({}) do |result, (key, value)|\n result[key] = value if property_accessibles.include?(key)\n result\n end\n\n # update the property model's attributes\n property_model.no_callbacks = true if property_model.respond_to?(:no_callbacks)\n property_model.update_attributes(property_attributes)\n\n # find & update or build a new address\n if Vebra.models[:address]\n address_class = Vebra.models[:address][:class].to_s.camelize.constantize\n address_model = property_model.send(Vebra.models[:property][:address_method])\n address_model = property_model.send(\"build_#{Vebra.models[:property][:address_method]}\") unless address_model\n\n # extract accessible attributes for the address\n address_accessibles = address_class.accessible_attributes.map(&:to_sym)\n address_attributes = property.attributes[:address].inject({}) do |result, (key, value)|\n result[key] = value if address_accessibles.include?(key)\n result\n end\n\n # update the address model's attributes\n address_model.update_attributes(address_attributes)\n end\n\n # find & update or build new rooms\n if Vebra.models[:room]\n room_class = Vebra.models[:room][:class].to_s.camelize.constantize\n\n # accessible attributes for the rooms\n room_accessibles = room_class.accessible_attributes.map(&:to_sym)\n\n # delete any rooms which are no longer present\n property_rooms = property.attributes[:rooms] || []\n property_model_rooms = property_model.send(Vebra.models[:property][:rooms_method])\n refs_to_delete = property_model_rooms.map(&:vebra_ref) - property_rooms.map { |r| r[:vebra_ref] }\n property_model_rooms.each do |room|\n room.destroy if refs_to_delete.include?(room.vebra_ref)\n end\n\n # find & update or build new rooms\n property_rooms.each do |room|\n room_model = room_class.find_by_property_id_and_vebra_ref(property_model.id, room[:vebra_ref])\n room_model = property_model_rooms.build unless room_model\n\n # extract accessible attributes for the room\n room_attributes = room.inject({}) do |result, (key, value)|\n result[key] = value if room_accessibles.include?(key)\n result\n end\n\n # update the room model's attributes\n room_model.update_attributes(room_attributes)\n end\n end\n\n # find & update or build new file attachments\n if Vebra.models[:file]\n file_class = Vebra.models[:file][:class].to_s.camelize.constantize\n\n # accessible attributes for the files\n file_accessibles = file_class.accessible_attributes.map(&:to_sym)\n\n # first normalize the collection (currently nested collections)\n property_files = property.attributes[:files].inject([]) do |result, (kind, collection)|\n collection.each do |file|\n file[:type] = kind.to_s.singularize.camelize if file_accessibles.include?(:type)\n file[\"remote_#{Vebra.models[:file][:attachment_method]}_url\".to_sym] = file.delete(:url)\n # if file[:type] is set, it means the attachment file class can be subclassed. In this\n # case we need to ensure that the subclass exists. If not, we ignore this file\n begin\n file[:type].constantize if file_accessibles.include?(:type)\n result << file\n rescue NameError => e\n # ignore - this means the subclass does not exist\n puts \"[Vebra]: #{e.message}\" if Vebra.debugging?\n end\n end\n\n result\n end\n\n # delete any files which are no longer present\n property_model_files = property_model.send(Vebra.models[:property][:files_method])\n refs_to_delete = property_model_files.map(&:vebra_ref) - property_files.map { |f| f[:vebra_ref] }\n property_model_files.each do |file|\n file.destroy if refs_to_delete.include?(file.vebra_ref)\n end\n\n # find & update or build new files\n property_files.each do |file|\n begin\n file_model = property_model_files.find_by_vebra_ref(file[:vebra_ref])\n file_model = property_model_files.build unless file_model\n\n # extract accessible attributes for the file\n file_attributes = file.inject({}) do |result, (key, value)|\n result[key] = value if file_accessibles.include?(key)\n result\n end\n\n # update the room model's attributes\n file_model.update_attributes(file_attributes)\n rescue CarrierWave::ProcessingError, OpenURI::HTTPError => e\n # just ignore the file\n puts \"[Vebra]: #{e.message}\" if Vebra.debugging?\n end\n end\n end\n\n property_model.no_callbacks = false if property_model.respond_to?(:no_callbacks)\n property_model.save\n return property_model\n end",
"title": ""
},
{
"docid": "01219537b43bd1cf8341e0f00e27d4c8",
"score": "0.61569315",
"text": "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @property_value = args[:property_value] if args.key?(:property_value)\n end",
"title": ""
},
{
"docid": "147d62c4df79ff1ca86cbd477112bf7f",
"score": "0.61442953",
"text": "def update\n end",
"title": ""
},
{
"docid": "f3dea89f306804c3f2aa813c06584d06",
"score": "0.61260897",
"text": "def update!(**args)\n @mid = args[:mid] if args.key?(:mid)\n @property_value = args[:property_value] if args.key?(:property_value)\n end",
"title": ""
},
{
"docid": "44756fd86dd095556580199f7e78936f",
"score": "0.6125199",
"text": "def modified_properties=(value)\n @modified_properties = value\n end",
"title": ""
},
{
"docid": "593de84fa9950baa68153e4fa9b6e17c",
"score": "0.61227936",
"text": "def apply_properties!(properties)\n # Non-commutitivity etc. eventually.\n end",
"title": ""
},
{
"docid": "ea25adea5b43c27e6c84f27ad88c3d9f",
"score": "0.61111224",
"text": "def set_properties(hash)\n hash.each do |key, value|\n add_or_remove_ostruct_member(key, value)\n end\n rest_reset_properties\n end",
"title": ""
},
{
"docid": "147138a710a0ff53e9288ae66341894f",
"score": "0.610543",
"text": "def update\n\t\t\n\t\tend",
"title": ""
},
{
"docid": "7b1d2242b1a6bd8d3cad29be97783a80",
"score": "0.6102925",
"text": "def set_props(props)\n @props.merge!(props)\n end",
"title": ""
},
{
"docid": "cb2162d3a1fd3434effd12aa702f250f",
"score": "0.60839343",
"text": "def update() end",
"title": ""
},
{
"docid": "231370ed2400d22825eba2b5b69e7a67",
"score": "0.6083609",
"text": "def update!(**args)\n @property_definitions = args[:property_definitions] if args.key?(:property_definitions)\n end",
"title": ""
},
{
"docid": "86ff97cc222b987bff78c1152a1c8ee1",
"score": "0.6066973",
"text": "def assign_properties\n self.properties ||= {}\n listing_properties.each do |prop|\n self.properties[prop.key] ||= prop.value\n end\n end",
"title": ""
},
{
"docid": "0f6ea4c54f9bc18020c08410f67289cd",
"score": "0.60602766",
"text": "def change_properties(new_current_floor, new_next_floor, new_movement)\n @current_floor = new_current_floor\n @next_floor = new_next_floor\n @movement = new_movement\n end",
"title": ""
},
{
"docid": "453da6bb915596261c5b82f2d17cabf8",
"score": "0.6055065",
"text": "def update!(**args)\n @property_value = args[:property_value] if args.key?(:property_value)\n end",
"title": ""
},
{
"docid": "52a81d6eb0fed16fe2a23be3d9ebc264",
"score": "0.6051568",
"text": "def update!(**args)\n @property_name = args[:property_name] if args.key?(:property_name)\n end",
"title": ""
},
{
"docid": "52a81d6eb0fed16fe2a23be3d9ebc264",
"score": "0.6051568",
"text": "def update!(**args)\n @property_name = args[:property_name] if args.key?(:property_name)\n end",
"title": ""
},
{
"docid": "874639781ed80ae451fbdd6ebbef2218",
"score": "0.6042057",
"text": "def update(attributes)\n (@attributes ||= {}).merge! attributes\n\n (self.class.attr_initializables & attributes.keys).each do |name|\n instance_variable_set :\"@#{name}\", attributes[name]\n end\n\n self\n end",
"title": ""
},
{
"docid": "d175f5bedd91a8daf191cad42b04dc0c",
"score": "0.60319084",
"text": "def update_attributes(attrs)\n super({})\n end",
"title": ""
},
{
"docid": "b8d1a7cd8f443ee5f30b5085aadff479",
"score": "0.60221004",
"text": "def update\n @dirty = true\n end",
"title": ""
},
{
"docid": "d7d62f9c97f629ef8c88e56d3d1ce8ee",
"score": "0.60149413",
"text": "def update\n\n # Run through the mixin updates\n colourable_update\n movable_update\n\n end",
"title": ""
},
{
"docid": "71750bae7e3d6bdde2b60ec30e70949a",
"score": "0.5994295",
"text": "def set(props)\n props.each do |prop, val|\n self.send(:\"#{ prop }=\", val)\n end\n end",
"title": ""
},
{
"docid": "73fe9bc31bfeeab4d84483e2fa65cbbb",
"score": "0.5989816",
"text": "def update\n super\n end",
"title": ""
},
{
"docid": "a98ac99e6e5115383e9148202286ff9e",
"score": "0.597674",
"text": "def update!(**args)\n @property_id = args[:property_id] if args.key?(:property_id)\n @value_status = args[:value_status] if args.key?(:value_status)\n end",
"title": ""
},
{
"docid": "fb14f35e7fab31199053a7b87ef451a4",
"score": "0.5973157",
"text": "def update!(**args)\n @object_size_bytes = args[:object_size_bytes] if args.key?(:object_size_bytes)\n @object_version = args[:object_version] if args.key?(:object_version)\n end",
"title": ""
},
{
"docid": "6441b3fa93c3dfd974c66a975adb9d9c",
"score": "0.5967343",
"text": "def movable_update\n\n # Work through the different aspects we update\n movable_location_update\n movable_size_update\n movable_angle_update\n\n end",
"title": ""
},
{
"docid": "51a59f953548d1eff10532bdffdd8df9",
"score": "0.5965598",
"text": "def properties=(value)\n @properties = value\n end",
"title": ""
},
{
"docid": "e7a3d5504fcc6e382b06845ede0d5fd8",
"score": "0.59629464",
"text": "def update(attrs)\n attrs.each_pair do |key, value|\n send(\"#{key}=\", value) if respond_to?(\"#{key}=\")\n # attributes[key] = value <- lets make use of virtual attributes too\n end\n end",
"title": ""
},
{
"docid": "c7a2880c3da02b3708afc43c48d37f2e",
"score": "0.59618354",
"text": "def update(context={})\n self.pre_cast_attributes\n m2o = @relations.reject{|k, v| !self.class.many2one_relations.has_key?(k)}\n vals = @attributes.reject {|key, value| key == 'id'}.merge(m2o.merge(m2o){|k, v| v.is_a?(Array) ? v[0] : v})\n self.class.rpc_execute('write', self.id, vals, context)\n reload_from_record!(self.class.find(self.id, :context => context))\n end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950329",
"text": "def update; end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950329",
"text": "def update; end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950329",
"text": "def update; end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950329",
"text": "def update; end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950329",
"text": "def update; end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950329",
"text": "def update; end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950329",
"text": "def update; end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.5950329",
"text": "def update; end",
"title": ""
},
{
"docid": "5ca2caa1a207739e77f437de35e41cf1",
"score": "0.59495455",
"text": "def update ; end",
"title": ""
},
{
"docid": "2c309c8084bf29f0b8d8674d22086956",
"score": "0.59442014",
"text": "def method_missing(method, *args)\n super if @updated\n set_up_properties_from(@client.get(@path))\n self.send method, *args\n end",
"title": ""
},
{
"docid": "2c309c8084bf29f0b8d8674d22086956",
"score": "0.59442014",
"text": "def method_missing(method, *args)\n super if @updated\n set_up_properties_from(@client.get(@path))\n self.send method, *args\n end",
"title": ""
},
{
"docid": "a20f534093aba7e3633ca0ac07a56d53",
"score": "0.5944142",
"text": "def update!(**args)\n @freshness_duration = args[:freshness_duration] if args.key?(:freshness_duration)\n @freshness_property = args[:freshness_property] if args.key?(:freshness_property)\n end",
"title": ""
},
{
"docid": "a20f534093aba7e3633ca0ac07a56d53",
"score": "0.5944142",
"text": "def update!(**args)\n @freshness_duration = args[:freshness_duration] if args.key?(:freshness_duration)\n @freshness_property = args[:freshness_property] if args.key?(:freshness_property)\n end",
"title": ""
},
{
"docid": "879f1214e030bb2d9e43a0aedb1bc3ea",
"score": "0.59361076",
"text": "def update_with(attributes)\n assign_attributes(attributes)\n end",
"title": ""
},
{
"docid": "10b1cb39dbb1f67820e37bb6d2632986",
"score": "0.5925741",
"text": "def update\n # don't need to update; hash is shared\n end",
"title": ""
},
{
"docid": "51982942bd4f09be3f7adc59da4cf104",
"score": "0.5925574",
"text": "def update(attributes)\n HashProxy.with(attributes) do |proxy|\n self.class.attribute_names.each do |name|\n send(\"#{name}=\", proxy[name]) if proxy.key?(name)\n end\n end\n save\n end",
"title": ""
},
{
"docid": "f0dd489c52fa73b1c3846fa43727c29e",
"score": "0.59250593",
"text": "def update!(**args)\n @object_id_prop = args[:object_id_prop] if args.key?(:object_id_prop)\n @relation = args[:relation] if args.key?(:relation)\n @subject_id = args[:subject_id] if args.key?(:subject_id)\n end",
"title": ""
},
{
"docid": "4229acd17d03e94871226b09dd3bd37d",
"score": "0.5924476",
"text": "def update!(**args)\n @boolean_property_options = args[:boolean_property_options] if args.key?(:boolean_property_options)\n @date_property_options = args[:date_property_options] if args.key?(:date_property_options)\n @display_options = args[:display_options] if args.key?(:display_options)\n @double_property_options = args[:double_property_options] if args.key?(:double_property_options)\n @enum_property_options = args[:enum_property_options] if args.key?(:enum_property_options)\n @html_property_options = args[:html_property_options] if args.key?(:html_property_options)\n @integer_property_options = args[:integer_property_options] if args.key?(:integer_property_options)\n @is_facetable = args[:is_facetable] if args.key?(:is_facetable)\n @is_repeatable = args[:is_repeatable] if args.key?(:is_repeatable)\n @is_returnable = args[:is_returnable] if args.key?(:is_returnable)\n @is_sortable = args[:is_sortable] if args.key?(:is_sortable)\n @is_suggestable = args[:is_suggestable] if args.key?(:is_suggestable)\n @is_wildcard_searchable = args[:is_wildcard_searchable] if args.key?(:is_wildcard_searchable)\n @name = args[:name] if args.key?(:name)\n @object_property_options = args[:object_property_options] if args.key?(:object_property_options)\n @text_property_options = args[:text_property_options] if args.key?(:text_property_options)\n @timestamp_property_options = args[:timestamp_property_options] if args.key?(:timestamp_property_options)\n end",
"title": ""
},
{
"docid": "4229acd17d03e94871226b09dd3bd37d",
"score": "0.5924476",
"text": "def update!(**args)\n @boolean_property_options = args[:boolean_property_options] if args.key?(:boolean_property_options)\n @date_property_options = args[:date_property_options] if args.key?(:date_property_options)\n @display_options = args[:display_options] if args.key?(:display_options)\n @double_property_options = args[:double_property_options] if args.key?(:double_property_options)\n @enum_property_options = args[:enum_property_options] if args.key?(:enum_property_options)\n @html_property_options = args[:html_property_options] if args.key?(:html_property_options)\n @integer_property_options = args[:integer_property_options] if args.key?(:integer_property_options)\n @is_facetable = args[:is_facetable] if args.key?(:is_facetable)\n @is_repeatable = args[:is_repeatable] if args.key?(:is_repeatable)\n @is_returnable = args[:is_returnable] if args.key?(:is_returnable)\n @is_sortable = args[:is_sortable] if args.key?(:is_sortable)\n @is_suggestable = args[:is_suggestable] if args.key?(:is_suggestable)\n @is_wildcard_searchable = args[:is_wildcard_searchable] if args.key?(:is_wildcard_searchable)\n @name = args[:name] if args.key?(:name)\n @object_property_options = args[:object_property_options] if args.key?(:object_property_options)\n @text_property_options = args[:text_property_options] if args.key?(:text_property_options)\n @timestamp_property_options = args[:timestamp_property_options] if args.key?(:timestamp_property_options)\n end",
"title": ""
},
{
"docid": "32ed734ad4f899f0ee9ec74a760ca1d0",
"score": "0.5921039",
"text": "def update\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "900f4c147e0916b2e9270373fb83c7e2",
"score": "0.59155524",
"text": "def update_attributes attributes\n @attributes.merge! attributes\n end",
"title": ""
},
{
"docid": "f63de190ae582620103d96f60d684114",
"score": "0.59145254",
"text": "def update!(**args)\n @async_options = args[:async_options] if args.key?(:async_options)\n @input_mappings = args[:input_mappings] if args.key?(:input_mappings)\n @name_property = args[:name_property] if args.key?(:name_property)\n @validation_options = args[:validation_options] if args.key?(:validation_options)\n end",
"title": ""
},
{
"docid": "512d9095b05a696270730ee09c640773",
"score": "0.5888445",
"text": "def update\r\n end",
"title": ""
},
{
"docid": "5b1f6d40d29f0afb908434d0a6404ac8",
"score": "0.58860934",
"text": "def update!(**args)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @type = args[:type] if args.key?(:type)\n end",
"title": ""
},
{
"docid": "efcb8c985b9e7911a606a9149b4ab171",
"score": "0.5882302",
"text": "def update\n raise NotImplemented\n end",
"title": ""
},
{
"docid": "65f67197ac4544cbebca350d889922ee",
"score": "0.5879913",
"text": "def update_obj\n mean, sd = rating.to_glicko_rating\n @obj.rating = mean\n @obj.rating_deviation = sd\n @obj.volatility = volatility\n end",
"title": ""
},
{
"docid": "c71a8be944fb89ab77a17fd4c16f7193",
"score": "0.5877467",
"text": "def update_values\n end",
"title": ""
},
{
"docid": "c71a8be944fb89ab77a17fd4c16f7193",
"score": "0.5877467",
"text": "def update_values\n end",
"title": ""
},
{
"docid": "10e162e857be9c47150e8eccd327cad9",
"score": "0.58743787",
"text": "def update\n raise NotImplementedError\n end",
"title": ""
},
{
"docid": "389ac4585e8143f353e2535499a23085",
"score": "0.585829",
"text": "def update!(**args)\n @answers_header_signals = args[:answers_header_signals] if args.key?(:answers_header_signals)\n @property_value = args[:property_value] if args.key?(:property_value)\n @response_meaning_application = args[:response_meaning_application] if args.key?(:response_meaning_application)\n end",
"title": ""
},
{
"docid": "c202a823016f05ee2fc4aade77320497",
"score": "0.584583",
"text": "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @method_prop = args[:method_prop] if args.key?(:method_prop)\n @name = args[:name] if args.key?(:name)\n @state = args[:state] if args.key?(:state)\n end",
"title": ""
},
{
"docid": "dc268f568dcb7aca1d3905736d2477af",
"score": "0.58408254",
"text": "def update attributes, collection #:nodoc:\n 0\n end",
"title": ""
},
{
"docid": "9763ac25d7fdf4b4f35a971609f70b04",
"score": "0.5835501",
"text": "def update_property_groups(roll)\n @property_groups.each { |_, v| v.update_rent(roll) }\n end",
"title": ""
},
{
"docid": "49a282f2ce0c099a5ced60524a492b4f",
"score": "0.5829063",
"text": "def update_info(update_attr_hash)\n update_attr_hash.each do |k,v| \n\t\t\tself.send(\"#{k}=\",v)\n\t\tend\n end",
"title": ""
},
{
"docid": "541550458a4c8f94afeb6b10c0cb2293",
"score": "0.5828611",
"text": "def update!(**args)\n @source_property = args[:source_property] if args.key?(:source_property)\n end",
"title": ""
},
{
"docid": "f6c4eafa4f48a0c81157fb03ff350901",
"score": "0.58228916",
"text": "def update_properties(path, properties)\n prop_patch = PropPatch.new(properties)\n emit('propPatch', [path, prop_patch])\n prop_patch.commit\n\n prop_patch.result\n end",
"title": ""
},
{
"docid": "524a6a969929f9af4bad05dbd9c8f935",
"score": "0.5819882",
"text": "def update\n set_deltatime\n set_last_update_at\n end",
"title": ""
}
] |
25a8c985b29679870ff81e6e9a3e4c4b
|
GET /mangakas or /mangakas.json
|
[
{
"docid": "924ed178c6e28ca10c9b04c0f1f3e2e4",
"score": "0.6431781",
"text": "def index\n @mangakas = Mangaka.all\n end",
"title": ""
}
] |
[
{
"docid": "fd5133db7b786c5ff6d791caf515696c",
"score": "0.69160306",
"text": "def show\n @manga = Finder.find_manga_by_id params[:id]\n @manga ||= KiWi.show_manga params[:id]\n\n render json: @manga\n end",
"title": ""
},
{
"docid": "06df5d73d0d966c2500245b69f8ef57b",
"score": "0.6574552",
"text": "def index\n @mangas = Manga.all\n end",
"title": ""
},
{
"docid": "06df5d73d0d966c2500245b69f8ef57b",
"score": "0.6574552",
"text": "def index\n @mangas = Manga.all\n end",
"title": ""
},
{
"docid": "f01d65d1ec57a176191cbe6bcf5aa13b",
"score": "0.62110406",
"text": "def show\n @mak = Mak.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mak }\n end\n end",
"title": ""
},
{
"docid": "bc0ecd18cfd9d822639f38e29ce6d7f6",
"score": "0.6060026",
"text": "def index\n @manga_lists = MangaList.all\n end",
"title": ""
},
{
"docid": "aa2728ad5f5807730b626f22a96dd1e7",
"score": "0.6034135",
"text": "def get(method,options)\n\t\toptions.merge!({\n\t\t\tmethod: \"zemanta.#{method}\",\n\t\t\tapi_key: @@api_key,\n\t\t\tformat: \"json\"})\n\n\t\thandle_response(\n\t\t\tself.class.get('/services/rest/0.0/',query:options),\n\t\toptions)\n\tend",
"title": ""
},
{
"docid": "1d0ada8b51180970652d48b8d2398a3c",
"score": "0.6033232",
"text": "def show\n @makanan = Makanan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @makanan }\n end\n end",
"title": ""
},
{
"docid": "d4691cdbb664bac58e4a7865887297c6",
"score": "0.6026496",
"text": "def getAlmacenes()\n options = {\n :path => \"/almacenes\",\n :headers => generate_security_header(\"get\")\n }\n get options\n end",
"title": ""
},
{
"docid": "a530c32130711e9051e93bdd69ea77ea",
"score": "0.60239226",
"text": "def list_guest_access_portals(args = {}) \n get(\"/guestaccess.json/gap/\", args)\nend",
"title": ""
},
{
"docid": "a530c32130711e9051e93bdd69ea77ea",
"score": "0.60239226",
"text": "def list_guest_access_portals(args = {}) \n get(\"/guestaccess.json/gap/\", args)\nend",
"title": ""
},
{
"docid": "248798d9db88be762becb89cffab007c",
"score": "0.5997281",
"text": "def show\n @mangment = Mangment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mangment }\n end\n end",
"title": ""
},
{
"docid": "00f5127c73612f28dc8e55bba7e6065a",
"score": "0.5971383",
"text": "def get(name, args={})\n response = RestClient.get(route(name), params: args)\n JSON.parse(response, symbolize_names: true)\n rescue\n nil\n end",
"title": ""
},
{
"docid": "d040eaf5d59515b92d3f817655245862",
"score": "0.595847",
"text": "def show\n @maingall = Maingall.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @maingall }\n end\n end",
"title": ""
},
{
"docid": "a9d7e983b80038850de7ecae8d204527",
"score": "0.59359044",
"text": "def show\n @raman = Raman.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @raman }\n end\n end",
"title": ""
},
{
"docid": "9cadc562754ec30b5ab47ed4287edf71",
"score": "0.5930524",
"text": "def index\n @maquinas = Maquina.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @maquinas }\n end\n end",
"title": ""
},
{
"docid": "6ad6f072046a634da702b802e830541c",
"score": "0.590965",
"text": "def show\n @mekan = Mekan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mekan }\n end\n end",
"title": ""
},
{
"docid": "88c90ca4851edd8c85493c4d7cefb4b8",
"score": "0.59006834",
"text": "def index\r\n @a_gudangs = AGudang.page(params[:page]).per(PAGINATE)\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @a_gudangs }\r\n end\r\n end",
"title": ""
},
{
"docid": "be22af22b8dea1c9c19c1ceb9f806eb8",
"score": "0.5893353",
"text": "def show\n @mangaka = Mangaka.find(params[:id])\n end",
"title": ""
},
{
"docid": "956a52e4df12d8bff8a0260cf9530379",
"score": "0.58393246",
"text": "def index\n @lokasi_atms = LokasiAtm.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lokasi_atms }\n end\n end",
"title": ""
},
{
"docid": "25b256a63c8867093ce94d8d577799e1",
"score": "0.5834828",
"text": "def index\n @katas = Kata.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @katas }\n end\n end",
"title": ""
},
{
"docid": "31479342eedc2fffe95ec5f4fa48df7d",
"score": "0.58254516",
"text": "def index\n @otakus = Otaku.all\n\n render json: @otakus\n end",
"title": ""
},
{
"docid": "fee26d1f575073facd95e48e0c038ca1",
"score": "0.5821881",
"text": "def get(path)\n # FAKING RESPONSE\n [{ id: 1, name: 'Jane' }, { id: 2, name: 'John' }].to_json\n end",
"title": ""
},
{
"docid": "7e93b332cdabcfad7bf44e3458f45a5f",
"score": "0.5820818",
"text": "def index\n @anketa = Anketum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @anketa }\n end\n end",
"title": ""
},
{
"docid": "a6534541421ea152b38818f99fd5d934",
"score": "0.5815578",
"text": "def search_manga query\n search 'manga', query\n end",
"title": ""
},
{
"docid": "811492ec5e50882e7d254ab2ccae8dbf",
"score": "0.5812242",
"text": "def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ambassadors }\n end\n end",
"title": ""
},
{
"docid": "251689c639f4c96b81408b4613162118",
"score": "0.5805664",
"text": "def index\n @murais = Mural.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @murais }\n end\n end",
"title": ""
},
{
"docid": "44cd4a702641a6ac7f44ddbef3d9c850",
"score": "0.5774545",
"text": "def index\n @maestras = Maestra.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @maestras }\n end\n end",
"title": ""
},
{
"docid": "f04395d57bb181404f66943f8056031a",
"score": "0.57640725",
"text": "def index\n authorize! :index, Moon\n @moons = Moon.search(params)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @moons }\n end\n end",
"title": ""
},
{
"docid": "4aeecc8dad109ffc3816ccece393d660",
"score": "0.5762586",
"text": "def index\n @mars = Mar.all\n render json: @mars\n end",
"title": ""
},
{
"docid": "37bf004d9d9fe614f683b3a6e2288c79",
"score": "0.5760255",
"text": "def list\n http.get(\"/takers\") do |response|\n respond_with_collection(response)\n end\n end",
"title": ""
},
{
"docid": "e68670042e8ff8aad0f7af46874aa82e",
"score": "0.5752869",
"text": "def index\n @karyalay_samagris = KaryalaySamagri.all\n render json: @karyalay_samagris\n end",
"title": ""
},
{
"docid": "c22dcadab669f5064728419caa8484ea",
"score": "0.5744695",
"text": "def search_for_a_guest(args = {}) \n get(\"/guestaccess.json/search\", args)\nend",
"title": ""
},
{
"docid": "a30a4bd4a06be50ab3df736186fd3d77",
"score": "0.57364815",
"text": "def show\n @sangano = Sangano.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sangano }\n end\n end",
"title": ""
},
{
"docid": "12bf49200d8f5ebd22b232acf368e727",
"score": "0.5716947",
"text": "def show\n @anken = Anken.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @anken }\n end\n end",
"title": ""
},
{
"docid": "ddc034b58d152ff4ed0ce2cfa51a6a50",
"score": "0.5710102",
"text": "def get(path)\n response = kolkrabbi_client.get do |request|\n request.url path\n request.headers[\"Content-Type\"] = \"application/json\"\n request.headers[\"Authorization\"] = \"Bearer #{client.heroku.token}\"\n end\n\n JSON.parse(response.body)\n end",
"title": ""
},
{
"docid": "dd72c994cb1888b5382c26a8c0710dc7",
"score": "0.56945634",
"text": "def show\n @tak = Tak.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tak }\n end\n end",
"title": ""
},
{
"docid": "2aa5f0a6b74359f0f2c7a8b259e244c6",
"score": "0.5683393",
"text": "def index\n @muas = Mua.search(params)\n end",
"title": ""
},
{
"docid": "08c3c010ecd9fb7cab44f948281b2e2e",
"score": "0.5681291",
"text": "def index\n @musicas = Musica.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @musicas }\n end\n end",
"title": ""
},
{
"docid": "02179abe6e193a87c697bd4a71e10eaf",
"score": "0.568059",
"text": "def index\n @rmas = Rma.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rmas }\n end\n end",
"title": ""
},
{
"docid": "4a040d0d753329077cdbb5e6500ec18a",
"score": "0.5674964",
"text": "def index\n pokemon = open('http://pokeapi.co/api/v2/pokemon/').read\n pokemon = JSON.parse pokemon\n @pokemon = pokemon.paginate(page: params[:page], per_page: 12)\n respond_to do |format|\n format.html\n format.json { render json: @pokemon }\n end\n end",
"title": ""
},
{
"docid": "1984e8f359bd73bea9118a3bd83cb370",
"score": "0.5667192",
"text": "def show\n @kapper = Kapper.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kapper }\n end\n end",
"title": ""
},
{
"docid": "1dedf6cd4f6a39acc02433413ba8b26b",
"score": "0.56660765",
"text": "def show\n @zaklad = Zaklad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zaklad }\n end\n end",
"title": ""
},
{
"docid": "b7613502548a846de82aec7926b78db4",
"score": "0.56469995",
"text": "def marina_find_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MarinaApi.marina_find ...\"\n end\n # resource path\n local_var_path = \"/Marinas\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\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 = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Marina>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MarinaApi#marina_find\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"title": ""
},
{
"docid": "9158343d3c29b445abee01ab710b4a28",
"score": "0.56407577",
"text": "def show\n @afspraak = Afspraak.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @afspraak }\n end\n end",
"title": ""
},
{
"docid": "49ba69c47852ec5b5f399eb2e6938323",
"score": "0.5639322",
"text": "def index\n @angels = Angel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @angels }\n end\n end",
"title": ""
},
{
"docid": "82aefef21d17a43400251bb68a94e8d4",
"score": "0.5632724",
"text": "def show\n @mla = Mla.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mla }\n end\n end",
"title": ""
},
{
"docid": "1f0d14a19ad55aef8dbee84976e26908",
"score": "0.56290776",
"text": "def index\n @bakashas = Bakasha.all\n @heading = t(:reshimat)\n @subheading = t(:all_you_filled)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bakashas }\n end\n end",
"title": ""
},
{
"docid": "04d1a099debdf15beb9fe45d99ea8aa1",
"score": "0.5616826",
"text": "def index\n @admin_grampanchyats = Admin::Grampanchyat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_grampanchyats }\n end\n end",
"title": ""
},
{
"docid": "32b782420654bdc67d44ab539701e064",
"score": "0.561582",
"text": "def show\n @orak = Orak.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @orak }\n end\n end",
"title": ""
},
{
"docid": "6f3ea23e7f82c51703274da167f1bbd2",
"score": "0.56099355",
"text": "def list_all_guests(args = {}) \n get(\"/guestaccess.json/all\", args)\nend",
"title": ""
},
{
"docid": "6f3ea23e7f82c51703274da167f1bbd2",
"score": "0.56099355",
"text": "def list_all_guests(args = {}) \n get(\"/guestaccess.json/all\", args)\nend",
"title": ""
},
{
"docid": "008dd8aa9e1ae6243a33f57f54a739e0",
"score": "0.5608337",
"text": "def show\n @jogo = Jogo.find(params[:id])\n \n respond_to do |format|\n format.html # index.html.erb\n #perguntas = mountPerguntas(@jogo.perguntas)\n #format.json { render :json => { :jogo => @jogo }, :include => { :perguntas => { :include => :respostas } } }\n end\n end",
"title": ""
},
{
"docid": "b26887f8b952ca6bf6ce5a7d46d22dcf",
"score": "0.5606177",
"text": "def index\n @pengirimen = Pengiriman.all\n render json: { items: @pengirimen }\n end",
"title": ""
},
{
"docid": "4dcb0edc7be5a0b1ed926259ef9112ab",
"score": "0.5605565",
"text": "def show\n @maquina = Maquina.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @maquina }\n end\n end",
"title": ""
},
{
"docid": "1e7bed4f4a7000e8c795c366cd77cbac",
"score": "0.55970514",
"text": "def index\n @mashups = @user.mashups\n respond_to do |format|\n format.json { render json: @mashups.as_json(include: {:keywords => {}, :links => {include: {:link_source => {}}} })}\n end\n end",
"title": ""
},
{
"docid": "dd61d24e8cef878c4f6438d4632ec485",
"score": "0.55964684",
"text": "def index\n @honyakus = Honyaku.all\n # render json: @honyakus\n end",
"title": ""
},
{
"docid": "d6a879df85abc965945f045bb2476ecc",
"score": "0.5591246",
"text": "def larves\n self.class.get('/monstre_larve.json')\n end",
"title": ""
},
{
"docid": "39932749d43130a1a3a77b669fe27055",
"score": "0.55891305",
"text": "def index\n \trespond_with @monedas = @monedas.paginate(:page => params[:page], :per_page => 10)\n end",
"title": ""
},
{
"docid": "769a6e0ea07292cb5714e6a90826d9da",
"score": "0.558423",
"text": "def list\n get('/')\n end",
"title": ""
},
{
"docid": "ab9ff6d6fe6a467609d79a7184c096c6",
"score": "0.5580234",
"text": "def show\n @padawan = Padawan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @padawan }\n end\n end",
"title": ""
},
{
"docid": "30b22e6520ec1d80b46307341f191070",
"score": "0.5569051",
"text": "def show\n @palavra = Palavra.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @palavra }\n end\n end",
"title": ""
},
{
"docid": "67473ef14751606d9c731c198874cbef",
"score": "0.55689716",
"text": "def get_mapping(types)\n get do |req|\n req.url \"#{@name}/#{types}/_mapping\"\n end\n end",
"title": ""
},
{
"docid": "ba7637badf6025aa83ef6a480a77b910",
"score": "0.55661976",
"text": "def home\n \t#uri = URI.parse(\"http://octopart.com/api/v2/parts/search?q=CY7C2544\")\n \turi = URI.parse(\"http://octopart.com/api/v2/parts/search?q=MT49H&apikey=298ff890\")\n \t#@data = Net::HTTP.get(uri) - works\n \t#render :json => @data\n \t@data = MultiJson.load(Net::HTTP.get(uri))\n \t@data = @data[\"results\"]\n end",
"title": ""
},
{
"docid": "3a02d0e1c8919ec3b48444197a3bd57a",
"score": "0.5560542",
"text": "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ambassador }\n end\n end",
"title": ""
},
{
"docid": "69027b93ad108cbc98c783f917822cca",
"score": "0.5558142",
"text": "def index\n @alunos = Aluno.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @alunos }\n end\n end",
"title": ""
},
{
"docid": "90470c55e0452b0513c90d012aef13c4",
"score": "0.5556842",
"text": "def set_manga\n @manga = Manga.find(params[:id])\n end",
"title": ""
},
{
"docid": "90470c55e0452b0513c90d012aef13c4",
"score": "0.5556842",
"text": "def set_manga\n @manga = Manga.find(params[:id])\n end",
"title": ""
},
{
"docid": "90470c55e0452b0513c90d012aef13c4",
"score": "0.5556842",
"text": "def set_manga\n @manga = Manga.find(params[:id])\n end",
"title": ""
},
{
"docid": "90470c55e0452b0513c90d012aef13c4",
"score": "0.5556842",
"text": "def set_manga\n @manga = Manga.find(params[:id])\n end",
"title": ""
},
{
"docid": "e2a14afbc848f1a5120b3523d25b2938",
"score": "0.55567807",
"text": "def show\n @marina = Marina.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @marina }\n end\n end",
"title": ""
},
{
"docid": "189ba8ede0eb4c7cc1c25736de533056",
"score": "0.5551685",
"text": "def show\n @kompanija = Kompanija.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kompanija }\n end\n end",
"title": ""
},
{
"docid": "f3c319724af60505286f20b0b6acf2cc",
"score": "0.554054",
"text": "def show\n @talisman = Talisman.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @talisman }\n end\n end",
"title": ""
},
{
"docid": "3208821ad490795a4f067ad2aeacec93",
"score": "0.553578",
"text": "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @majors }\n format.json { render :text => get_json }\n end\n end",
"title": ""
},
{
"docid": "708084e986bf32809d5a0aaaff2083e8",
"score": "0.55349445",
"text": "def show\n @karyawan = Karyawan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @karyawan }\n end\n end",
"title": ""
},
{
"docid": "a4118adfd1fa0ca8d3a6e920531eaf60",
"score": "0.5533462",
"text": "def me\n get(\"1/me\", :format => :json, :phoenix => true)\n end",
"title": ""
},
{
"docid": "9e8b999b99f7272f59a35d35c4dceafe",
"score": "0.553178",
"text": "def show\n @moeda = Moeda.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moeda }\n end\n end",
"title": ""
},
{
"docid": "fcf2b896dd65adf25a89a729c472750d",
"score": "0.55307287",
"text": "def show\n @amigo = Amigo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @amigo }\n end\n end",
"title": ""
},
{
"docid": "8f2ceb893701a9dbd99d46a8c9c0b5b4",
"score": "0.55284554",
"text": "def show\n @anagram = Anagram.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @anagram }\n end\n end",
"title": ""
},
{
"docid": "e2f026226c247c84bb64b2c9ebccfe32",
"score": "0.55243546",
"text": "def show\n @baoming = Baoming.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @baoming }\n end\n end",
"title": ""
},
{
"docid": "4a2a29d84695a03a11718ddc21baa35b",
"score": "0.55094373",
"text": "def index\n @title = \"Препараты\"\n @medicaments = Medicament.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @medicaments }\n end\n end",
"title": ""
},
{
"docid": "618fc83ac857bab63a8d671a79ea32ae",
"score": "0.5508651",
"text": "def index\n @anios_escolares = AnioEscolar.order(\"anio\") # all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @anios_escolares }\n end\n end",
"title": ""
},
{
"docid": "34d27023512f7f54b6f6393f2af8cd81",
"score": "0.5502824",
"text": "def show\n @anagrafica = Anagrafica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @anagrafica }\n end\n end",
"title": ""
},
{
"docid": "fb5345a3fe7a4ec43a9ddee74b650ef1",
"score": "0.55024403",
"text": "def index\n\n begin\n @pathways = Pathway.order(:name).to_a\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pathways }\n end\n rescue\n handle_unspecified_error\n end\n\n end",
"title": ""
},
{
"docid": "b0fcf578ed41c228d6eb381ad661f14f",
"score": "0.550224",
"text": "def show\n @bakasha = Bakasha.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bakasha }\n end\n end",
"title": ""
},
{
"docid": "cb81b7e27d0646db68cb482abe7c8c7a",
"score": "0.5501091",
"text": "def show\n @malariacase = Malariacase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @malariacase }\n end\n end",
"title": ""
},
{
"docid": "97e6c1f258c914fd9cbe9e1a7d0b5316",
"score": "0.5497008",
"text": "def show\n @gammi = Gammi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gammi }\n end\n end",
"title": ""
},
{
"docid": "ccb0f907679b267b13ecd1312b952251",
"score": "0.5495848",
"text": "def show\n @ganador = Ganador.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ganador }\n end\n end",
"title": ""
},
{
"docid": "7ec307997239cd33a1d273d2216d5299",
"score": "0.5495774",
"text": "def show\n @manhattan = Manhattan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manhattan }\n end\n end",
"title": ""
},
{
"docid": "ef01e1271feec176306982beee745364",
"score": "0.5495387",
"text": "def index\n @questaos = Questao.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questaos }\n end\n end",
"title": ""
},
{
"docid": "715bedf42b5b75bd1df03faa2bd7839c",
"score": "0.5491182",
"text": "def index\n @materias = Materia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @materias }\n end\n end",
"title": ""
},
{
"docid": "98e00b1f4d94d670baca8c8c65cba55b",
"score": "0.5488423",
"text": "def show\n @koan = Koan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @koan }\n end\n end",
"title": ""
},
{
"docid": "40fd82f0c67b2792488d00176d4a1ef4",
"score": "0.5488008",
"text": "def index\n respond_to do |format|\n format.html\n format.json {\n data=Sudo.all\n .where(\"name LIKE ?\", \"%#{params[:name]}%\")\n .where(\"description LIKE ?\", \"%#{params[:description]}%\")\n .where(\"sudo_rule LIKE ?\", \"%#{params[:sudo_rule]}%\")\n render json: {'value' => data}\n }\n #.where(\"name LIKE ?\", \"%#{params[:name]}%\")\n end\n end",
"title": ""
},
{
"docid": "c8a31edcf5142b08d5fe8676db082f31",
"score": "0.5487915",
"text": "def show\n @kunal = Kunal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kunal }\n end\n end",
"title": ""
},
{
"docid": "dfc36703f45411ff33358a95b26bc78a",
"score": "0.54868466",
"text": "def show\n @llamada = Llamada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @llamada }\n end\n end",
"title": ""
},
{
"docid": "7b7a44b359404ff3443e2bb18ad4a56e",
"score": "0.54864925",
"text": "def index\n @komentarzs = Komentarz.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @komentarzs }\n end\n end",
"title": ""
},
{
"docid": "95b9c87355f3dc29c993be8b1dd0fe90",
"score": "0.5486208",
"text": "def get_carriers_by_country(args = {}) \n get(\"/mobile.json/countries\", args)\nend",
"title": ""
},
{
"docid": "95b9c87355f3dc29c993be8b1dd0fe90",
"score": "0.5486208",
"text": "def get_carriers_by_country(args = {}) \n get(\"/mobile.json/countries\", args)\nend",
"title": ""
},
{
"docid": "b52a7d2d1da70a785c6f1874eff97559",
"score": "0.5485247",
"text": "def index\n @mangas = if search_word.present?\n # scoreを確認用\n # Manga.es_search(search_word).page(params[:page] || 1).per(5).records.each_with_hit { |record, hit| puts \"* #{record.title}: #{hit._score}\" }\n Manga.es_search(search_word).page(params[:page] || 1).per(5).records\n else\n Manga.page(params[:page] || 1).per(5)\n end\n end",
"title": ""
},
{
"docid": "b2ef9541874beda0f3b274d5f3b35d2d",
"score": "0.5484386",
"text": "def liste_magasins # liste magasins\n @magasins = Magasin.all\n results = @magasins.map {|m| {\n :magasin_id => m.id,\n :magasin_nom => m.nom_magasin, \n :magasin_adresse => m.adresse_magasin}}\n render json: results\n end",
"title": ""
},
{
"docid": "a18e302717536083c68a1d76b60ad169",
"score": "0.5484253",
"text": "def show\n @nasabah = Nasabah.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nasabah }\n end\n end",
"title": ""
}
] |
3abb6f865d2af36f494922921c0eeaef
|
Returns a hash of the changed attributes with the new values
|
[
{
"docid": "ae013c90c40e6c0340934bcf064c18c2",
"score": "0.7006782",
"text": "def new_attributes\n (changes || {}).inject({}.with_indifferent_access) do |attrs,(attr,values)|\n attrs[attr] = Array(values).last\n attrs\n end\n end",
"title": ""
}
] |
[
{
"docid": "6547db99002dabb7076cc299ce8a6454",
"score": "0.8571037",
"text": "def changed_attributes\n changed_attributes_names.each_with_object({}) do |attr, hash|\n hash[attr] = attribute_value(attr)\n end\n end",
"title": ""
},
{
"docid": "e3e0719a70c734def780049d0ea511cd",
"score": "0.8168913",
"text": "def changes\n array = changed.map { |attr| [attr, attribute_change(attr)] }\n ActiveSupport::HashWithIndifferentAccess[array]\n end",
"title": ""
},
{
"docid": "2d5b374241e0415938cf71741cf0ba49",
"score": "0.8161998",
"text": "def dirty_attributes\n changed.inject({}) { |h, k| h[k] = attributes[k.to_s]; h }\n end",
"title": ""
},
{
"docid": "31eb78088e7e879c0cbd881aa923acc9",
"score": "0.80122924",
"text": "def attributes_hash\n hash = self.as_json\n hash.merge!(:changes => previous_changes) if previous_changes && hash\n hash.symbolize_keys! if hash\n hash\n end",
"title": ""
},
{
"docid": "f51ebb2ca53e8828dee92e4ff2e3311c",
"score": "0.79814327",
"text": "def changes\n {}.tap do |hash|\n changed.each do |name|\n change = attribute_change(name)\n hash[name] = change if change[0] != change[1]\n end\n end\n end",
"title": ""
},
{
"docid": "dc7de468e73ef2bf17b3bc0b72da8f20",
"score": "0.7958532",
"text": "def changes\n changed.inject({}) {|h, attr| h[attr] = attribute_change(attr); h}\n end",
"title": ""
},
{
"docid": "fb1392f8896aca4b44a7fd70ec2bd833",
"score": "0.78889567",
"text": "def changes\n attributes = @data.inject({}) do |memo, pair|\n key, value = *pair\n if @data[key] != @data[\"original_#{key}\"] && !key.to_s.match(/original/)\n memo[key] = value\n end\n memo\n end\n end",
"title": ""
},
{
"docid": "205ffb4d62854accf18bb5596f723faa",
"score": "0.7805748",
"text": "def changes\n changed.each_with_object({}) do |attr, changes|\n change = attribute_change(attr)\n changes[attr] = change if change\n end.with_indifferent_access\n end",
"title": ""
},
{
"docid": "d3e6800e99ee04317dd223bbb5165178",
"score": "0.7765428",
"text": "def changed\n delta = (@attributes_to_save.keys + @attributes_to_incr.keys)\n delta.uniq!\n delta\n end",
"title": ""
},
{
"docid": "cef16495b83da6f3f4ea59de028fcc3f",
"score": "0.7686733",
"text": "def changed_attributes\n @changed_attributes ||= {}\n end",
"title": ""
},
{
"docid": "cef16495b83da6f3f4ea59de028fcc3f",
"score": "0.7686733",
"text": "def changed_attributes\n @changed_attributes ||= {}\n end",
"title": ""
},
{
"docid": "cef16495b83da6f3f4ea59de028fcc3f",
"score": "0.7686733",
"text": "def changed_attributes\n @changed_attributes ||= {}\n end",
"title": ""
},
{
"docid": "cef16495b83da6f3f4ea59de028fcc3f",
"score": "0.7686733",
"text": "def changed_attributes\n @changed_attributes ||= {}\n end",
"title": ""
},
{
"docid": "5949016291af7dd6a5794deddbb0e2df",
"score": "0.76487225",
"text": "def changed_attributes\n @changed_attributes ||= {}\n end",
"title": ""
},
{
"docid": "d256edb415273d5591949554543bf11b",
"score": "0.76186866",
"text": "def hash\n attributes.values.reduce { |a, e| a.to_s + e.to_s }.hash\n end",
"title": ""
},
{
"docid": "57cff906fda05cd849a888c6f61c21bb",
"score": "0.75841033",
"text": "def as_change_hash\n hash = {}\n omit_attrs = %w(id created_at updated_at) # filter out the noise\n self.attributes.reject{ |k, v| omit_attrs.include?(k) }.each do |attr|\n hash[attr[0]] = attr[1]\n end\n hash\n end",
"title": ""
},
{
"docid": "12037008869cadcf737c412ce684c9a3",
"score": "0.757685",
"text": "def changed_attributes\n @changed_attributes ||= begin\n attributes = Set.new([])\n attributes.merge(before.keys)\n attributes.merge(after.keys)\n\n attributes.to_a\n .map { |key| [ key, before[key], after[key] ] }\n .select { |row| row[1].to_s != row[2].to_s }\n .sort!\n end\n end",
"title": ""
},
{
"docid": "937e23b3d464fb3bed5cde001e44d0b1",
"score": "0.75041807",
"text": "def modified_attributes_changes(result={})\r\n @_modified_attributes.each_pair { |k,v| result[k] = [v,attributes[k]] } if @_modified_attributes\r\n result\r\n end",
"title": ""
},
{
"docid": "ec68e4db3228ce9d9ce089f2401aef90",
"score": "0.7467149",
"text": "def attr_hash\n md5 = Digest::MD5.new\n @attributes.each do |k,v|\n md5.update \"#{k}:#{v.attr_hash}\"\n end\n md5.hexdigest\n end",
"title": ""
},
{
"docid": "fd91513fad00ff99e5752a128609e359",
"score": "0.74342895",
"text": "def delta_changed_attributes\n @delta_changed_attributes ||= {}\n end",
"title": ""
},
{
"docid": "e10364dbc304421008e0a8a74d72b33d",
"score": "0.7425907",
"text": "def changed\n changed_attributes.keys.select { |attr| attribute_change(attr) }\n end",
"title": ""
},
{
"docid": "10aed5c0ae13aa922b65f1afc0391d15",
"score": "0.73959064",
"text": "def changed\n changed_attributes.keys\n end",
"title": ""
},
{
"docid": "10aed5c0ae13aa922b65f1afc0391d15",
"score": "0.73959064",
"text": "def changed\n changed_attributes.keys\n end",
"title": ""
},
{
"docid": "10aed5c0ae13aa922b65f1afc0391d15",
"score": "0.73959064",
"text": "def changed\n changed_attributes.keys\n end",
"title": ""
},
{
"docid": "10aed5c0ae13aa922b65f1afc0391d15",
"score": "0.73959064",
"text": "def changed\n changed_attributes.keys\n end",
"title": ""
},
{
"docid": "10aed5c0ae13aa922b65f1afc0391d15",
"score": "0.73959064",
"text": "def changed\n changed_attributes.keys\n end",
"title": ""
},
{
"docid": "10aed5c0ae13aa922b65f1afc0391d15",
"score": "0.73959064",
"text": "def changed\n changed_attributes.keys\n end",
"title": ""
},
{
"docid": "29b4ddd220139c45c5651345e7a76ef0",
"score": "0.73882437",
"text": "def to_hash\n return attributes.dup\n end",
"title": ""
},
{
"docid": "573b4502e9b62c9278baf159c21487fb",
"score": "0.7369695",
"text": "def old_attributes\n (changes || {}).inject({}.with_indifferent_access) do |attrs,(attr,values)|\n attrs[attr] = Array(values).first\n attrs\n end\n end",
"title": ""
},
{
"docid": "cde8d494aa27d9e80b8368f212f2da23",
"score": "0.736233",
"text": "def to_hash\n attributes.dup\n end",
"title": ""
},
{
"docid": "706cbdb4c78e6b67e29589df0a4b1b5c",
"score": "0.7316683",
"text": "def attr_hash\n md5 = Digest::MD5.new\n # just hash it by name\n md5.update @name\n #\n # @attributes.each do |k,v|\n # md5.update \"#{k}:#{v.attr_hash}\"\n # end\n md5.hexdigest\n end",
"title": ""
},
{
"docid": "adeafa6ad4498417ff0ed3e7a512b0e1",
"score": "0.7290288",
"text": "def to_hash\n attributes.dup\n end",
"title": ""
},
{
"docid": "c4d1b2ef200a83a20cf004fb10f12f22",
"score": "0.7281399",
"text": "def old_attributes\n (changes || {}).inject({}.with_indifferent_access) do |attrs,(attr,values)|\n attrs[attr] = Array(values).first\n attrs\n end\n end",
"title": ""
},
{
"docid": "c4d1b2ef200a83a20cf004fb10f12f22",
"score": "0.7281399",
"text": "def old_attributes\n (changes || {}).inject({}.with_indifferent_access) do |attrs,(attr,values)|\n attrs[attr] = Array(values).first\n attrs\n end\n end",
"title": ""
},
{
"docid": "c4d1b2ef200a83a20cf004fb10f12f22",
"score": "0.7281399",
"text": "def old_attributes\n (changes || {}).inject({}.with_indifferent_access) do |attrs,(attr,values)|\n attrs[attr] = Array(values).first\n attrs\n end\n end",
"title": ""
},
{
"docid": "5dba2023b40210130798db78b99807a1",
"score": "0.72727984",
"text": "def changed_attributes\n changed = []\n new_attributes = @new_resource.attributes\n current_attributes = @current_resource.attributes\n\n new_attributes.each_key do |key, value|\n changed << key unless current_attributes[key.to_sym] == value\n end\n\n changed\nend",
"title": ""
},
{
"docid": "7071f0127c93af8894914b0d5e6d24c3",
"score": "0.7246358",
"text": "def original_attributes\n attributes.merge(changed_attributes)\n end",
"title": ""
},
{
"docid": "bc2fd96c849c6b4439116674ff93736f",
"score": "0.72422594",
"text": "def attr_hash\n Hash[attributes.map {|k, v| [k.to_s, v.to_s]}]\n end",
"title": ""
},
{
"docid": "c24f105e6023e0aafd492fbf5162c4eb",
"score": "0.72381014",
"text": "def original_changed_attributes\n @changed_attributes\n end",
"title": ""
},
{
"docid": "c24f105e6023e0aafd492fbf5162c4eb",
"score": "0.72381014",
"text": "def original_changed_attributes\n @changed_attributes\n end",
"title": ""
},
{
"docid": "081a1bec333958d9bbd1df4308872569",
"score": "0.72112334",
"text": "def attributes\n # This could be simply done like this\n # return { \"id\" => uuid, \"name\" => name, \"category\" => category, \"_lastChange\" => _lastChange,\n # \"dirty\" => dirty, \"deleted\" => deleted }\n #\n # Follows a more generic way of doing this (doesn't rely on specific attribute names)\n hash = super.merge(\"_lastChange\" => _lastChange, \"id\" => uuid ) # Add the _lastChange param\n hash.except('updated_at', 'created_at', 'uuid')\n end",
"title": ""
},
{
"docid": "e10d9539c4497172e9ec806911924821",
"score": "0.720193",
"text": "def to_hash\n @attributes.dup\n end",
"title": ""
},
{
"docid": "8a4c399d2f850a7a4f0b6b49022b5306",
"score": "0.7193164",
"text": "def hash\n @hash ||= attributes.hash\n end",
"title": ""
},
{
"docid": "80c8a00c417d4cfbd3496976614f8e90",
"score": "0.7174791",
"text": "def changes\n if persisted?\n store = self.class.get_store\n changed_attrs = SYNC_ATTRIBUTES.select { |attr| send(attr) != store[attr] }\n changed_attrs << :default_category_id if default_category_id!=store[:default_category][:id]\n changed_attrs << :logo_uri unless logo_uri.nil? || logo_uri =~ /^\\s*$/\n return changed_attrs\n else\n # All attributes have changed ;-)\n SYNC_ATTRIBUTES\n end\n end",
"title": ""
},
{
"docid": "24a4b4babc083eea8790aecc0d32177b",
"score": "0.71663785",
"text": "def changed\n @dirty_attributes.keys\n end",
"title": ""
},
{
"docid": "7145005a6ad95683a79e02d3273bfff3",
"score": "0.7112634",
"text": "def new_attributes_hashed\n new_attribute_translation_keys.reduce({}) { |h, a| h.merge({ a => nil} ) }\n end",
"title": ""
},
{
"docid": "8d4aa21615eed2c9554deb6528b13ede",
"score": "0.71107256",
"text": "def hash\n attrs = attributes.dup\n attrs.delete_if {|key, value| [:created_at, :updated_at, :id].include?(key)}\n attrs.delete_if {|key, value| value.kind_of?(Base) }\n keys = attrs.keys.map{|sym| sym.to_s}.sort.join ''\n values = attrs.values.map{|sym| sym.to_s}.sort.join ''\n Digest::MD5.hexdigest(keys + values)\n end",
"title": ""
},
{
"docid": "593b2a14e5e29b433e275abd1bd42153",
"score": "0.7062456",
"text": "def new_attributes\n (changes || {}).inject({}.with_indifferent_access) do |attrs,(attr,values)|\n attrs[attr] = values.is_a?(Array) ? values.last : values\n attrs\n end\n end",
"title": ""
},
{
"docid": "af3e517501bc61f1950ec8c874309e64",
"score": "0.70068187",
"text": "def protector_changed\n HashWithIndifferentAccess[changed.map { |field| [field, read_attribute(field)] }]\n end",
"title": ""
},
{
"docid": "ca8863fbbbd6db5c1dcb57995feec4a3",
"score": "0.69889385",
"text": "def changed\n [].tap do |a|\n @attribute_objects.each do |key, attribute|\n a << key if attribute.changed?\n end\n end\n end",
"title": ""
},
{
"docid": "0178ebc06fda6dc74960e762f9a4ea65",
"score": "0.6972199",
"text": "def old_attributes\n (audited_changes || {}).inject({}.with_indifferent_access) do |attrs,(attr,values)|\n attrs[attr] = Array(values).first\n\n attrs\n end\n end",
"title": ""
},
{
"docid": "e4adebe545f068846e6867fe3dc8cf62",
"score": "0.69544375",
"text": "def attributes_hash; end",
"title": ""
},
{
"docid": "76432a1c909e61dbc367dc45a09da34e",
"score": "0.6953236",
"text": "def dirty_attributes\n dirty_attributes = {}\n properties = self.properties\n\n original_values.each do |name, old_value|\n property = properties[name]\n new_value = property.get!(self)\n\n dirty = case property.track\n when :hash then old_value != new_value.hash\n else\n property.value(old_value) != property.value(new_value)\n end\n\n if dirty\n property.hash\n dirty_attributes[property] = property.value(new_value)\n end\n end\n\n dirty_attributes\n end",
"title": ""
},
{
"docid": "69eea576b5a70cca363cc346cb2ad018",
"score": "0.69521934",
"text": "def dirty_attributes\n pairs = {}\n\n database_context.table(self).columns.each do |column|\n value = instance_variable_get(column.instance_variable_name)\n if value != original_values[column.name] && (!new_record? || !column.serial?)\n pairs[column.name] = column.type != :object ? value : YAML.dump(value)\n end\n end\n\n pairs\n end",
"title": ""
},
{
"docid": "ee547214ed2b3fca6c56e728c640b743",
"score": "0.69478136",
"text": "def attributes\n hashed_attributes = {}\n\n @attributes.each do |attribute|\n hashed_attributes[attribute] = send(attribute)\n end\n\n hashed_attributes\n end",
"title": ""
},
{
"docid": "f7fd6f331b27bdc59fc232a8424981c1",
"score": "0.69389445",
"text": "def attributes\n sort.reverse.inject({}) do |final, (_, changeset)|\n changeset.merge(final)\n end\n end",
"title": ""
},
{
"docid": "3bdde13c81b3cacc8f58922b60f50be5",
"score": "0.6936494",
"text": "def attributes_hash\n _attrs.inject({}) do |hash, attr|\n hash.merge(attr => send(attr))\n end\n end",
"title": ""
},
{
"docid": "be419af6aa97e7250ac569d84af9ff13",
"score": "0.69250566",
"text": "def old_attributes\n (audited_changes || {}).each_with_object({}.with_indifferent_access) do |(attr, values), attrs|\n attrs[attr] = (action == \"update\") ? values.first : values\n end\n end",
"title": ""
},
{
"docid": "2d0e573c8142a564dc9f70bd1e1f36d0",
"score": "0.6914366",
"text": "def attributes_hash\n \"{\" + attribute_names.map { |name| \":#{name} => _#{name}\" }.join(',') + \"}\"\n end",
"title": ""
},
{
"docid": "8c89818bff9172147dea50e344e9573c",
"score": "0.69094527",
"text": "def to_hash; @attributes; end",
"title": ""
},
{
"docid": "8c89818bff9172147dea50e344e9573c",
"score": "0.69094527",
"text": "def to_hash; @attributes; end",
"title": ""
},
{
"docid": "549bf4703d2f67d9842539971c2e83ce",
"score": "0.6899403",
"text": "def attributes_hash\n \"{\" + attribute_names.map { |name| \":#{name} => _#{name}\" }.join(\",\") + \"}\"\n end",
"title": ""
},
{
"docid": "b91d922d581029facdd2dce4da6576f6",
"score": "0.6878005",
"text": "def changes_applied # :doc:\n @previously_changed = changes\n @changed_attributes = ActiveSupport::HashWithIndifferentAccess.new\n end",
"title": ""
},
{
"docid": "e09488914cf2d40fd38b57f63d7475c6",
"score": "0.68664247",
"text": "def attributes_hash\n {}\n end",
"title": ""
},
{
"docid": "dd0ee2999306947bf1ec2efa3097676b",
"score": "0.6861745",
"text": "def old_attributes\n (audited_changes || {}).inject({}.with_indifferent_access) do |attrs,(attr,values)|\n attrs[attr] = Array(values).first\n attrs\n end\n end",
"title": ""
},
{
"docid": "0ae05c71f342a034f4bb937c27f47d85",
"score": "0.68595093",
"text": "def attribute_diffs\n @attribute_diffs ||= begin\n changes = self.object_changes.dup\n attribute_diffs = {}\n\n # Compare each of object_b's attributes to object_a's attributes\n # And if there is a difference, add it to the Diff\n changes.each do |attribute, values|\n # values is [previous_value, new_value]\n diff = Diffy::Diff.new(values[0].to_s, values[1].to_s)\n attribute_diffs[attribute] = diff\n end\n\n attribute_diffs\n end\n end",
"title": ""
},
{
"docid": "0eba333cfb9d5e58086aef33ba2e5c88",
"score": "0.68447113",
"text": "def dirty_attributes\n dirty_attributes = {}\n\n original_attributes.each_key do |property|\n dirty_attributes[property] = property.value(property.get!(self))\n end\n\n dirty_attributes\n end",
"title": ""
},
{
"docid": "c7005e7aa5e471060faaf56d61c61588",
"score": "0.68430686",
"text": "def changed\n\t\thash = {}\n\t\t@new_hash.each do |k,v|\n\t\t\thash.store(k,v) if @old_hash.key?(k) and @old_hash[k] != v\n\t\tend\n\t\thash\n\tend",
"title": ""
},
{
"docid": "201b2356f1c9e3d1046e0ec16133fbcb",
"score": "0.68395185",
"text": "def dirty_attributes(compare={})\n compare = original_values if compare.empty?\n pairs = {}\n self.class.read_write.each do |column|\n value = instance_variable_get('@' + column.to_s)\n if value != compare[column.to_s]\n pairs[column.to_s] = value\n end\n end\n pairs\n end",
"title": ""
},
{
"docid": "9e4ad406fa2c84fe94c6443aca56e9ac",
"score": "0.67913604",
"text": "def attribute_change(attr)\n [changed_attributes[attr], attributes[attr]] if attribute_changed?(attr)\n end",
"title": ""
},
{
"docid": "448cddb723c4d1024bd1b66de05608a7",
"score": "0.6785975",
"text": "def to_hash\n attributes\n end",
"title": ""
},
{
"docid": "448cddb723c4d1024bd1b66de05608a7",
"score": "0.6785975",
"text": "def to_hash\n attributes\n end",
"title": ""
},
{
"docid": "ddb233ec803baeed9569f61d0de29996",
"score": "0.67803323",
"text": "def changed_attributes(records)\n changed = records.flat_map(&:changed)\n return changed if changed.empty?\n\n attrs = changed.dup << 'updated_at'\n attrs << locking_column if locking_enabled?\n attrs.tap(&:uniq!)\n end",
"title": ""
},
{
"docid": "59da233c0819547261f3a060e06a8ce3",
"score": "0.67670673",
"text": "def to_hash\n \thash = {}; self.attributes.each { |k,v| hash[k] = v }\n return hash\n end",
"title": ""
},
{
"docid": "bfc837e014e27a74c914a893333d896d",
"score": "0.6765255",
"text": "def original_attributes\n @original_attributes_hash\n end",
"title": ""
},
{
"docid": "1a48dfdaf7740b3ddc24063ee5d8b430",
"score": "0.6764602",
"text": "def to_hash\n @attributes\n end",
"title": ""
},
{
"docid": "a4ea406016f1d21a54ef5af979b04470",
"score": "0.6760979",
"text": "def hash\n [changed_by, id, organization_id, entity, entity_id, audit_action, field_changes, new_entity, state, created].hash\n end",
"title": ""
},
{
"docid": "04edc389b0ecbaed65a9840866efe660",
"score": "0.6749057",
"text": "def changes\n changed.each_with_object({}) do |name, h|\n h[name] = [previous_value(name), public_send(name)]\n end\n end",
"title": ""
},
{
"docid": "5acde953948fa9831113f944ae77a86b",
"score": "0.6741115",
"text": "def attributes_to_hash(hash={})\r\n each_attr { |attr| hash[attr.name] = attr.value }\r\n hash\r\n end",
"title": ""
},
{
"docid": "4a5945549359a60a38fe11c64d4f5a45",
"score": "0.6717156",
"text": "def to_hash\n _to_hash(@attributes)\n end",
"title": ""
},
{
"docid": "a3513a3c7b4a34ac0a9e489870b93c30",
"score": "0.6705436",
"text": "def modified_attributes_loaded_values\r\n @_modified_attributes || {}\r\n end",
"title": ""
},
{
"docid": "4cd7089d1535b4ecee1f1e0c50c86690",
"score": "0.6705034",
"text": "def to_hash\n hash = Hash.new\n self.class::ATTR_LIST.each do |attr, metadata|\n if (newval = self.method(attr).call)\n if (newval.is_a?(Array))\n newval = newval.collect do |x|\n if (x.methods.include?(\"to_hash\"))\n x.to_hash\n else\n x\n end\n end\n elsif (newval.methods.include?(\"to_hash\"))\n newval = newval.to_hash\n end\n hash[attr.to_s] = newval \n end\n end\n hash\n end",
"title": ""
},
{
"docid": "d1c55b3e7d73946315b1fe15f9d837dc",
"score": "0.6693696",
"text": "def original_attributes\n @original_attributes ||= {}\n end",
"title": ""
},
{
"docid": "8842623f38ffa11f94af49d30aa6cb61",
"score": "0.6690648",
"text": "def versioned_attributes\n json = self.as_json(:root => false).select do |k,_|\n versioned_attribute?(k)\n end\n\n json.to_hash\n end",
"title": ""
},
{
"docid": "c38da841ada08041d8fbf0e968a04a4a",
"score": "0.66885895",
"text": "def toHash\n\t\treturn @attributes\n\tend",
"title": ""
},
{
"docid": "1db698607e226c4bbcf17b13c71c65b7",
"score": "0.6677759",
"text": "def clear_changes_information # :doc:\n @previously_changed = ActiveSupport::HashWithIndifferentAccess.new\n @changed_attributes = ActiveSupport::HashWithIndifferentAccess.new\n end",
"title": ""
},
{
"docid": "44b88bc56b0ea48f2ab73e2f3d712526",
"score": "0.6675128",
"text": "def attr_hash\n md5 = Digest::MD5.new\n @ruby_types.each do |k,typ|\n md5.update typ.attr_hash\n end\n md5.hexdigest\n end",
"title": ""
},
{
"docid": "d97986e99ab1149adb6c61f19f424e5d",
"score": "0.66494125",
"text": "def attributes_for_update(attribute_names)\n serializable_hash(only: attribute_names.reject{|name| readonly_attribute?(name) || key_attribute?(name) })\n end",
"title": ""
},
{
"docid": "f5e7793b6182a8ff38857d715d8cc0b2",
"score": "0.6640528",
"text": "def to_hash\n @attributes.to_hash\n end",
"title": ""
},
{
"docid": "91cf08963b2421cdb1cb212d896bf67b",
"score": "0.6639147",
"text": "def changes_applied\n @previously_changed = @record_changes\n @changed_attributes = ActiveSupport::HashWithIndifferentAccess.new\n end",
"title": ""
},
{
"docid": "e2f05e2c074870ad2b7857c349658246",
"score": "0.66241",
"text": "def attr_hash; end",
"title": ""
},
{
"docid": "dbc5de4cd68c9e5dd348f9755546231d",
"score": "0.6621362",
"text": "def to_hash\n\t\thash = Hash.new\n\t\tself.attributes.each do |k,v|\n\t\t\thash[k] = v\n\t\tend\n\tend",
"title": ""
},
{
"docid": "d598147ad6c5f4311190c13d2579401a",
"score": "0.661881",
"text": "def original_attributes\n @original_attributes ||= versioned_attributes\n end",
"title": ""
},
{
"docid": "99e28be5d9c2af89434d727b33505edc",
"score": "0.660598",
"text": "def values(attrs, changed_attributes = false)\n changed_hash = {}\n if changed_attributes\n changed_attrs = attrs.changes.delete_if {|k,v| v.first == v.last}\n changed = changed_attrs.map{|k,v| k}.to_set\n if !self.range_keys.nil?\n return changed_hash if !(!(self.hash_keys.map(&:to_s).to_set & changed).empty? || !(self.range_keys.map(&:to_s).to_set & changed).empty?)\n else \n return changed_hash if !(!(self.hash_keys.map(&:to_s).to_set & changed).empty?)\n end\n changed_attrs.each {|k, v| changed_hash[k.to_sym] = (v.first || v.last)}\n end\n attrs = attrs.send(:attributes) if attrs.respond_to?(:attributes)\n source_attributes = self.source.attributes\n {}.tap do |hash|\n hash[:hash_value] = self.hash_keys.collect{|key| (if changed_hash[key]; changed_hash[key]; else attrs[key]; end)}.join('.')\n # check to see if we have a string in the range_keys\n # could make it simpler if the limit for a range_key is based on one attribute\n if self.range_key?\n if self.range_keys.select{|v| !source_attributes[v].nil? && source_attributes[v][:type] == :string}.any?\n hash[:range_value] = self.range_keys.inject(\"\") {|sum, key| sum + if changed_hash[key]; changed_hash[key].to_s; else attrs[key].to_s; end} \n else\n hash[:range_value] = self.range_keys.inject(0) {|sum, key| sum + if changed_hash[key]; changed_hash[key].to_i; else attrs[key].to_i; end}\n end\n end\n end\n end",
"title": ""
},
{
"docid": "fa585b99962516ba57c9e477e4df6520",
"score": "0.659883",
"text": "def get_changed_attributes\n return self.versions.last.changeset.except(\"updated_at\", \"created_at\", \"stathist\")\n end",
"title": ""
},
{
"docid": "8b06e438910b823b9e64b9176f9cacc6",
"score": "0.6596525",
"text": "def audited_changes\n ch = changed_attributes.except(*non_audited_columns).inject({}) do |changes,(attr, old_value)|\n changes[attr] = [old_value, self[attr]]\n changes\n end\n ch.merge(get_fields_changes)\n end",
"title": ""
},
{
"docid": "a893b26422f83023dee94eaad29fab31",
"score": "0.659396",
"text": "def updated\n changed.select {|a| sensitive_attributes.include?(a)}\n end",
"title": ""
},
{
"docid": "92014e461a46389fa862d155ed6d1fb1",
"score": "0.6589962",
"text": "def attribute_change(attr)\n [changed_attributes[attr], __send__(attr)] if attribute_changed?(attr)\n end",
"title": ""
}
] |
899bc511437db30ff275901f5102e34c
|
generate a female name +frequency+ :common, :rare, :all +surname+ true if you want a full name, false if you just want a first name
|
[
{
"docid": "3842348cc4091fd2459dcfe1d5b207da",
"score": "0.81182027",
"text": "def female(frequency = :common, surname = true)\n generate(:type => :female, :frequency => frequency, :with_surname => surname) \n end",
"title": ""
}
] |
[
{
"docid": "494a06d9b5cf76beaefc3025bddbcb54",
"score": "0.81948256",
"text": "def female_name\n case rand(9)\n when 0, 5 then \"#{first_name(:female)} #{middle_name(:female)}\"\n else first_name(:female)\n end\n end",
"title": ""
},
{
"docid": "aecdcbd244bb89e659e7cc28e136fe6f",
"score": "0.78653586",
"text": "def male(frequency = :common, surname = true)\n generate(:type => :male, :frequency => frequency, :with_surname => surname)\n end",
"title": ""
},
{
"docid": "cfed892a466cf80fa81a99d28c1e23ed",
"score": "0.7755025",
"text": "def firstname_female\n @@female_first_names.rand.capitalize\n end",
"title": ""
},
{
"docid": "cfed892a466cf80fa81a99d28c1e23ed",
"score": "0.7755011",
"text": "def firstname_female\n @@female_first_names.rand.capitalize\n end",
"title": ""
},
{
"docid": "85a23f80d7d2a487328cfc5c863710cd",
"score": "0.7602525",
"text": "def male_name\n case rand(9)\n when 0, 5 then \"#{first_name(:male)} #{middle_name(:male)}\"\n else first_name(:male)\n end\n end",
"title": ""
},
{
"docid": "d4ce32597a7ada1d3881dd593617f438",
"score": "0.739982",
"text": "def name(for_sex = :random)\n with_same_sex(for_sex) do\n case rand(0..9)\n when 0 then \"#{prefix} #{first_name} #{last_name} #{suffix}\"\n when 1..2 then \"#{prefix} #{first_name} #{last_name}\"\n else \"#{first_name} #{last_name}\"\n end\n end\n end",
"title": ""
},
{
"docid": "e2e0c91be973f63e8422284df4cb92d1",
"score": "0.71775275",
"text": "def name(frequency = :common, surname = true)\n generate(:frequency => frequency, :with_surname =>surname)\n end",
"title": ""
},
{
"docid": "6668f17b3fabfe84181248d25b0cf65d",
"score": "0.7157661",
"text": "def generate(params = {})\n params = {\n :type => random_gender,\n :frequency => :common,\n :with_surname => true\n }.merge(params)\n\n \n if ! ( params[:min_freq] || params[:max_freq] )\n params[:min_freq], params[:max_freq] = frequency_values(params[:frequency])\n else\n\n #\n # do some basic data validation in case someone is being a knucklehead\n #\n params[:min_freq] = params[:min_freq].to_i\n params[:max_freq] = params[:max_freq].to_i\n\n params[:max_freq] = params[:min_freq] + 1 if params[:max_freq] <= params[:min_freq]\n\n # max_freq needs to be at least 4 to get any results back,\n # because the most common male name only rates 3.3\n # JAMES 3.318 3.318 1\n params[:max_freq] = 4 if params[:max_freq] < 4\n end\n\n \n name = get_name(params[:type], params[:min_freq], params[:max_freq])\n\n # add surname if needed\n if params[:type] != :surname && params[:with_surname] == true\n name = \"#{name} #{get_name(:surname, params[:min_freq], params[:max_freq])}\"\n end\n name\n end",
"title": ""
},
{
"docid": "fcca523a82f65031b16a9a48477f8e01",
"score": "0.71513236",
"text": "def first_name\n \t(male_first_names | female_first_names | unknown_names).rand\n end",
"title": ""
},
{
"docid": "75285a00a8fcc33b361aa71da6de1323",
"score": "0.71339923",
"text": "def generate_name\n @male_first_names ||= %w(Buzz James John Fred Neil)\n @female_first_names ||= %w(Valentina Svetlana Sally)\n @last_names ||= %w(Baggins Bell Armstrong Aldrin Collins Grissom Chaffee Borman Lovell Mattingly Haise Swigert)\n @character_unique_traits[:first_name] = @male_first_names.sample if @character_unique_traits[:sex] == \"male\"\n @character_unique_traits[:first_name] = @female_first_names.sample if @character_unique_traits[:sex] == \"female\"\n @character_unique_traits[:last_name] = @last_names.sample unless @last_names.nil?\n end",
"title": ""
},
{
"docid": "95071f9f132cf1ee2432c45ec3bfdaad",
"score": "0.71288663",
"text": "def forename(gender)\n @forenames[gender][rand(@forenames[gender].length)]\n end",
"title": ""
},
{
"docid": "9c1e121ed64b061e855741b2206a2538",
"score": "0.7119138",
"text": "def full_name_no_prefix(gender = :any)\n case gender\n when :any then\n case rand(9)\n when 0, 3, 6, 8 then \"#{female_name} #{paternal_last_names}\"\n else \"#{male_name} #{paternal_last_names}\"\n end\n when :male then \"#{male_name} #{paternal_last_names}\"\n when :female then \"#{female_name} #{paternal_last_names}\"\n else raise ArgumentError, \"Invalid gender, must be one of :any, :male, :female\"\n end\n end",
"title": ""
},
{
"docid": "b2a994479fe3d8ec5bb353628a9f3b74",
"score": "0.71071535",
"text": "def generate_username(gender)\n name = \"\"\n while name.length < 4\n if gender == \"Male\"\n name = Faker::Name.male_first_name\n else\n name = Faker::Name.female_first_name\n end\n end\n name\nend",
"title": ""
},
{
"docid": "8fd6097481cb1c490a8cbfe2e87a1fb8",
"score": "0.71028405",
"text": "def surname(frequency = :common)\n generate(:type => :surname, :frequency => frequency)\n end",
"title": ""
},
{
"docid": "342f690291bfffd3a6e18c2de54dcfd7",
"score": "0.7084444",
"text": "def firstname_male\n @@male_first_names.rand.capitalize\n end",
"title": ""
},
{
"docid": "342f690291bfffd3a6e18c2de54dcfd7",
"score": "0.7084444",
"text": "def firstname_male\n @@male_first_names.rand.capitalize\n end",
"title": ""
},
{
"docid": "ba91840e520975e6d4a622d190024404",
"score": "0.6966532",
"text": "def his_her\n \"their\"\n # gender.blank? ? \"his or her\" : gender == \"F\" ? \"her\" : \"his\"\n end",
"title": ""
},
{
"docid": "a5b4704a529235de67a9e858a4d8fc1c",
"score": "0.6923868",
"text": "def him_her\n \"them\"\n # gender.blank? ? \"him or her\" : gender == \"F\" ? \"her\" : \"him\"\n end",
"title": ""
},
{
"docid": "3bf6f488cd9c869bda15c730e036a998",
"score": "0.6886062",
"text": "def name_tag_generator(first, last, gender, age)\n if gender == \"f\"\n if age <19\n puts \"Miss #{first} #{last}\"\n else\n puts \"Ms #{first} #{last}\"\n end\n else\n puts \"Mr #{first} #{last}\"\n end\nend",
"title": ""
},
{
"docid": "42343175151cbeb861bac0e0798eee58",
"score": "0.68849254",
"text": "def female_first_name\n fetch('name.female_first_name')\n end",
"title": ""
},
{
"docid": "b91de66841ae57144839256307404d84",
"score": "0.6883049",
"text": "def full_name_prefix(gender = :any)\n case gender\n when :any then\n case rand(9)\n when 0, 3, 6, 8 then \"#{female_prefix} #{female_name} #{paternal_last_names}\"\n else \"#{male_prefix} #{male_name} #{paternal_last_names}\"\n end\n when :male then \"#{male_prefix} #{male_name} #{paternal_last_names}\"\n when :female then \"#{female_prefix} #{female_name} #{paternal_last_names}\"\n else raise ArgumentError, \"Invalid gender, must be one of :any, :male, :female\"\n end\n end",
"title": ""
},
{
"docid": "9582440185a9f9efd766491dda2a5e93",
"score": "0.6858002",
"text": "def gender_pronoun\n if gender\n return 'She' if gender.name == 'Female'\n return 'He' if gender.name == 'Male'\n end\n 'They'\n end",
"title": ""
},
{
"docid": "578e59161574390ba5b728cf48a36793",
"score": "0.6801691",
"text": "def female_titles\n @female_titles ||= ['Mrs', 'Miss', 'Ms']\n end",
"title": ""
},
{
"docid": "35f7e804b59210abede4db5d0d21804b",
"score": "0.6771647",
"text": "def display_name(gender, name)\n if gender.present?\n title = gender == 'male' ? 'Mr. ' : 'Ms. '\n name.insert(0, title)\n end\n\n name\n end",
"title": ""
},
{
"docid": "360cb390be627c0d8dc5e1e6f80c9632",
"score": "0.6743494",
"text": "def random_name(sex = gender)\n self.class.random_name(sex)\n end",
"title": ""
},
{
"docid": "2671bf7fdce642110c30ba778116dfc7",
"score": "0.6726674",
"text": "def he_she\n \"they\"\n # gender.blank? ? \"he or she\" : gender == \"F\" ? \"she\" : \"he\"\n end",
"title": ""
},
{
"docid": "e4a957d265698c575a3f122f48036773",
"score": "0.66967887",
"text": "def is_female?\n 'f' == self.gender.to_s ? true : false\n end",
"title": ""
},
{
"docid": "160e8c5e85804fe5c83e5001de23b7b5",
"score": "0.66813064",
"text": "def name(gender = :any)\n case gender\n when :any then FIRST_NAMES.rand\n when :male then MALE_FIRST_NAMES.rand\n when :female then FEMALE_FIRST_NAMES.rand\n else raise ArgumentError, \"Invalid gender, must be one of :any, :male, :female\"\n end\n end",
"title": ""
},
{
"docid": "63d2f9360e07444af07239c22e39aa04",
"score": "0.66179276",
"text": "def infer_gender(name)\n if name.end_with?(\"ов\")\n :male\n elsif name.end_with?(\"ова\")\n :female\n end\nend",
"title": ""
},
{
"docid": "b9b5a51e93e1a903fae3447627657e15",
"score": "0.66165274",
"text": "def first_with_title\n Connie? ? [male, male_title] : [female, female_title]\n end",
"title": ""
},
{
"docid": "b454d391323142c1fa45699fb11bf98d",
"score": "0.65989226",
"text": "def singular_possessive\n if self.sex == \"Male\"\n return \"his\"\n elsif self.sex == \"Female\"\n return \"her\"\n end\n end",
"title": ""
},
{
"docid": "c75cc38d1c7fa68774a4e512fd9b2403",
"score": "0.65981936",
"text": "def generate_sex\n rand(2) == 0 ? @character_unique_traits[:sex] = \"male\" : @character_unique_traits[:sex] = \"female\"\n end",
"title": ""
},
{
"docid": "c2b8eb05ff3e6ae247e7f2185e325630",
"score": "0.6596366",
"text": "def same_sex?(words, sex = :any)\n (sex == :any ? [:male, :female] : [sex]).any? do |sex|\n words.all? do |word|\n [Faker::NameRU::LAST_NAMES, Faker::NameRU::FIRST_NAMES, Faker::NameRU::PATRONYMICS].any? do |names|\n names[sex].include?(word)\n end\n end\n end\n end",
"title": ""
},
{
"docid": "485eeaffd6970db9ac29922c4b910257",
"score": "0.6595037",
"text": "def full_name(options = { :initial => false, :gender => nil })\n \"#{first_name} #{last_name}\"\n end",
"title": ""
},
{
"docid": "485eeaffd6970db9ac29922c4b910257",
"score": "0.6595037",
"text": "def full_name(options = { :initial => false, :gender => nil })\n \"#{first_name} #{last_name}\"\n end",
"title": ""
},
{
"docid": "e195c9c207ae22853a4a7822bdaa6ac9",
"score": "0.6591546",
"text": "def name_gen(two_chars)\r\n\t\r\n\t# fn stands for \"family name\" (姓)\r\n\r\n\tfn_ping = [\"黎\", \"卓\", \"苏\", \"林\", \"蓝\", \"童\", \"茹\", \"柯\"]\r\n\tfn_ze = [\"洛\", \"冷\", \"木\", \"易\", \"路\", \"段\", \"牧\", \"叶\"]\r\n\r\n\t# gn stands for \"given name\" (名)\r\n\t# yinp stands for \"yinping\" (阴平)\r\n\t# yang stands for \"yangping\" (阳平)\r\n\t# shsh stands for \"shangsheng\" (上声) \r\n\t# qush stands for \"qusheng\" (去声)\r\n\r\n\tgn_yinp = [\"潇\", \"溦\", \"轩\", \"倾\", \"殊\", \"汐\"]\r\n\tgn_yang = [\"言\", \"唯\", \"茗\", \"瑶\", \"洄\", \"宜\"]\r\n\tgn_shsh = [\"语\", \"芷\", \"子\", \"宛\", \"萦\", \"蓼\"]\r\n\tgn_qush = [\"绰\", \"彦\", \"黛\", \"茜\", \"漫\", \"沫\"]\r\n\r\n\tfn_list = fn_ping + fn_ze\r\n\r\n\tgn_ping = gn_yinp + gn_yang\r\n\tgn_ze = gn_shsh + gn_qush\r\n\tgn_list = gn_ping + gn_ze\r\n\r\n\tfn = fn_list.sample\r\n\r\n\tif two_chars\r\n\t\tgn = gn_gen_one_char(fn, fn_ping, gn_ping, gn_ze) \r\n\telse\r\n\t\tgn = gn_gen_two_char(fn, fn_ping, gn_yinp, gn_yang, gn_shsh, gn_qush, gn_ping, gn_ze, gn_list)\r\n\tend\r\n\r\n\tname = fn + gn\r\n\r\nend",
"title": ""
},
{
"docid": "f0019e54ba09a1d09635575b8484230a",
"score": "0.6586502",
"text": "def same_sex?(words, sex = :any)\n (sex == :any ? [:male, :female] : [sex]).any? do |sex|\n words.all? do |word|\n [Faker::NameCS::LAST_NAMES, Faker::NameCS::FIRST_NAMES].any? do |names|\n names[sex].include?(word)\n end\n end\n end\n end",
"title": ""
},
{
"docid": "ab57b75acc1842923f243ccbea92d07d",
"score": "0.658394",
"text": "def salutation\n if gender == \"m\"\n return \"Mr.\"\n elsif gender == \"f\"\n return \"Ms. \"\n else\n return \"\"\n end\n end",
"title": ""
},
{
"docid": "e2c648271aa7d98085fab1670fba1946",
"score": "0.655736",
"text": "def salutation(options={})\n return self.academic_title.name if self.academic_title\n return \"Mr\".t if self.gender == 'm' \n return \"Ms\".t if self.gender == 'f' \n end",
"title": ""
},
{
"docid": "6bf4ae40aa27a2823d43fbefd24ee59a",
"score": "0.6539186",
"text": "def formal_name \n salutation = self.company.salutation_types.find_by_id(self.salutation_id).try(:alvalue)\n format_full_name(salutation || \"\" , self.first_name, self.middle_name, self.last_name, self.nickname ,\"formal\")\n end",
"title": ""
},
{
"docid": "e739307b1fc03b0c5b2882a0561b1334",
"score": "0.6502531",
"text": "def salutation(options={})\n (self.is_gender_male? ? (return \"Mr\") : (return \"Ms\")) if self.gender\n ''\n end",
"title": ""
},
{
"docid": "a1b280f3b41dcde1613f1256218723ea",
"score": "0.648367",
"text": "def gender\n\t\tgenders = [\"agender\", \"female\", \"bigender\", \"male\", \"female\", \"gender fluid\", \"N/A\"]\n\t\tgenders.sample\n\tend",
"title": ""
},
{
"docid": "636b58e0beee4e7ec0a343adeb931249",
"score": "0.64696574",
"text": "def gender_title\n gender.titleize\n end",
"title": ""
},
{
"docid": "531d67bf156289570c88c868bd2f11b8",
"score": "0.64650846",
"text": "def name\n if ( self.id.blank? )\n return \"New Patient\"\n end\n result=self.family_name;\n result+= \", #{self.given_names.capitalize}\" if !self.given_names.blank?;\n result\n end",
"title": ""
},
{
"docid": "0135586454b8f2e8ee14f63aedc49e5b",
"score": "0.64485466",
"text": "def female?\n return true if gender_sym.to_sym == Params::GENDER_FEMALE\n return false\n end",
"title": ""
},
{
"docid": "dd3db26b3d3e280d05719c8df6f0a72f",
"score": "0.64382833",
"text": "def gender_check(str)\n if str == \"Male\"\n return \"Hello, Sir!\"\n elsif str == \"Female\"\n return \"Hello, Ma'am!\"\n else \n return \"Hello there\"\n end\nend",
"title": ""
},
{
"docid": "c6d5b12e3a4b4ea0cccf3cfdff685fe2",
"score": "0.6386762",
"text": "def identifyGender\n male = [/\\b[Hh]e\\b/, /\\b[Hh]is\\b/, /\\b[Hh]imself\\b/, \n\t /\\b[Hh]im\\b/]\n\n #get male names from file \n #this'll probably result in a slowdown...probably should\n #make this static accross all classes\n \n if @@male_names.length == 0\n File.readlines(\"source/assets/male_names.txt\").each do |line|\n @@male_names << line \n end\n end\n\n female = [/\\b[Ss]he\\b/,/\\b[Hh]er\\b/, /\\b[Hh]erself\\b/,\n\t /\\b[Hh]ers\\b/]\n it = /\\b[Ii]t\\b/\n \n #if it's a male name, consider the gender to be\n #male no matter what \n @phrase.split(' ').each do |word|\n\tif(@@male_names.include?(word.upcase))\n\t gender = \"MALE\"\n\t return\t \n\tend\n end\n\t\n male.each do |regex|\n if(regex.match(@phrase) != nil)\n\t gender = \"MALE\" \n end\n end\n\n female.each do |regex|\n if(regex.match(@phrase) != nil) \n\t gender = \"FEMALE\" \n end\n end\n\n if(it.match(@phrase) != nil)\n\t gender = \"UNKNOWN\"\n end\n end",
"title": ""
},
{
"docid": "6c7246524cd28349c94738bd15c5cc23",
"score": "0.6383146",
"text": "def gender_info(i)\n return 'Genderless' if i > 254\n return 'Always Female' if i == 254\n return 'Always Male' if i == 0\n \"#{(100.0 * i / 255).round}% Female\"\n end",
"title": ""
},
{
"docid": "1c204c3c4e4c6dbabc30bd3332526d2e",
"score": "0.6377764",
"text": "def FN(map, force=false)\n #check if the field is optional and randomly generate it of skip\n return '' if(!generate?(map, force))\n\n #surname (ST)\n @yml['person.names.last'].sample\n #own surname prefix (ST)\n #own surname (ST)\n #surname prefix from partner/spouse (ST)\n #surname from partner/spouse (ST)\n end",
"title": ""
},
{
"docid": "a079bb2addb337bab033336556b29eea",
"score": "0.637472",
"text": "def localized_gender\n @@gender[female] || ''\n end",
"title": ""
},
{
"docid": "12e84b140be71385a3ad5531563b95db",
"score": "0.63692296",
"text": "def male_titles\n @male_titles ||= ['Mr']\n end",
"title": ""
},
{
"docid": "8f7f6e16b5abab74caff2a0752042cb2",
"score": "0.63661665",
"text": "def formatted_gender\n\n if self.gender == \"F\" then \"Female\"\n elsif self.gender == \"M\" then \"Male\"\n else \"Unknown\"\n end\n\n end",
"title": ""
},
{
"docid": "2edad52fcc8a460455ba8c1ef005ccd5",
"score": "0.6364919",
"text": "def last_name(for_sex = :random)\n fetch_sample(LAST_NAMES[select_sex(for_sex)])\n end",
"title": ""
},
{
"docid": "54c93fd616075a6ac500805467fc4657",
"score": "0.6364075",
"text": "def first_name(for_sex = :random)\n fetch_sample(FIRST_NAMES[select_sex(for_sex)])\n end",
"title": ""
},
{
"docid": "e358665b8e363ee469d7f5bd21acb83a",
"score": "0.63617593",
"text": "def random_gender\n rand > 0.5 ? :male : :female\n end",
"title": ""
},
{
"docid": "e0f93db6373b50569fc37dd75e4c35c8",
"score": "0.6322237",
"text": "def name_for_family\n (user.present? ? user.show_name : email )\n end",
"title": ""
},
{
"docid": "a2ea4ab7a3ed539cb81b4108b0e32510",
"score": "0.63196445",
"text": "def first_name\n @first_name ||= self.class.given_names(self.gender).shuffle.first\n end",
"title": ""
},
{
"docid": "226a6b7c6dd66d9fcf0c01e2def6ee53",
"score": "0.63177407",
"text": "def unify_gender\n gender = \"nil\"\n input = self.gender.strip\n male = [\"Men\",\"Male\",\"M\",\"Boy\",\"Guy\",\"Man\"]\n female = [\"Women\",\"Female\",\"F\",\"Girl\",\"Lady\",\"Ladie\",\"Woman\"]\n male.each do |name|\n if input.casecmp(name) == 0 || input.casecmp(name+\"s\") == 0\n gender = \"Male\"\n end\n end\n female.each do |name|\n if input.casecmp(name) == 0 || input.casecmp(name+\"s\") == 0\n gender = \"Female\"\n end\n end\n self.gender = gender\n end",
"title": ""
},
{
"docid": "24615dd9515498724b98e59d0590ca10",
"score": "0.6309168",
"text": "def gender\n # Attempt to determine if gender is being specified by the URL\n # TODO: determine gender by preference\n # Failing that, use the first name as a clue\n GENDERED_NAMES.each do |k, v|\n return k if v.include?(name.first)\n end\n # Failing that, use gender-neutral pronouns\n return 2\nend",
"title": ""
},
{
"docid": "cff681218a5bb3ecc3b251cd850d38cc",
"score": "0.63070315",
"text": "def random_surname\n result = @surnames.random_item.to_s\n \n #Do a 2 % double barrel\n if rand(50) > 48\n result = result+'-'[email protected]_item.to_s\n end\n \n return result\n end",
"title": ""
},
{
"docid": "e3c48286e8f98df7f912b528c9c72f70",
"score": "0.63050824",
"text": "def human_gender(gender)\n Person::GENDERS.invert[gender].to_s.titleize\n end",
"title": ""
},
{
"docid": "fc89b139140f435691070e387075ff6f",
"score": "0.6301429",
"text": "def gender_name\n gender.name if gender\n end",
"title": ""
},
{
"docid": "e37a6191d495195c074920f069bfe070",
"score": "0.6300897",
"text": "def gender(user)\n case user.gender\n when 'F'\n 'female'\n when 'M'\n 'male'\n else\n 'gender'\n end\n end",
"title": ""
},
{
"docid": "530cd8023984780afbbbe4f47aa57778",
"score": "0.6293718",
"text": "def same_sex?(words, sex = :any)\n (sex == :any ? %i[male female] : [sex]).any? do |s|\n words.all? do |word|\n [@tester::LAST_NAMES, @tester::FIRST_NAMES, @tester::PATRONYMICS].any? do |names|\n names[s].include?(word)\n end\n end\n end\n end",
"title": ""
},
{
"docid": "03fec639b2c0f4fb784aacb8fc5123d4",
"score": "0.6291318",
"text": "def gender_mapping(gender)\n return 'male' if gender == 'Boy'\n 'female'\n end",
"title": ""
},
{
"docid": "f59b6ca3b34cf9fdf5582cb3df8e7a72",
"score": "0.6285047",
"text": "def decorate_ward_name(ward)\n if !ward.isPrivate && ward.patientGender.eql?('Male')\n '(Male) ' + ward.name\n elsif ward.isPrivate && ward.patientGender.eql?('Male')\n '(Private, Male) ' + ward.name\n elsif !ward.isPrivate && ward.patientGender.eql?('Female')\n '(Female) ' + ward.name\n elsif ward.isPrivate && ward.patientGender.eql?('Female')\n '(Private, Female) ' + ward.name\n end\n end",
"title": ""
},
{
"docid": "7572ad8a08c230426274013765b61729",
"score": "0.62829614",
"text": "def salutation(dative=false)\n result = []\n if dative\n result << \"Frau\" if self.female?\n result << \"Herrn\" if self.male?\n else\n result << \"Frau\" if self.female?\n result << \"Herr\" if self.male?\n end\n result.compact.map {|m| m.to_s.strip}.reject {|i| i.blank?}.join(' ')\n end",
"title": ""
},
{
"docid": "4af6e771f1cacd017853850c28aef8f5",
"score": "0.6271148",
"text": "def format_gender( input, mode=0 )\n if mode==0\n input.upcase[0]\n else\n if input.upcase[0] == 'M' \n \"Male\"\n else\n \"Female\"\n end\n end \n end",
"title": ""
},
{
"docid": "c3c7dcd67ed9371f1911a6de6b83215c",
"score": "0.6270589",
"text": "def guess_gender(firstname)\n return :unknown if firstname.empty?\n require 'net/http'\n require 'rubygems'\n name = firstname.downcase\n base = \"http://www.beliebte-vornamen.de/lexikon/#{name[0..0]}\"\n m = Net::HTTP.get(URI(\"#{base}-mann\")).compress_whitespace.downcase\n f = Net::HTTP.get(URI(\"#{base}-frau\")).compress_whitespace.downcase\n # find all names, and split variants separated by comma or slash\n m = m.scan(/<dt>(.*?)<\\/dt>/).map { |s| s[0].strip_html.split(/[,\\/]/) }\n f = f.scan(/<dt>(.*?)<\\/dt>/).map { |s| s[0].strip_html.split(/[,\\/]/) }\n # Also find name like Alfhild(e)\n m = m.flatten.map { |n| [n.gsub(/[\\(\\)]/, \"\"), n.gsub(/\\(.*?\\)/, \"\")] }\n f = f.flatten.map { |n| [n.gsub(/[\\(\\)]/, \"\"), n.gsub(/\\(.*?\\)/, \"\")] }\n m.flatten!\n f.flatten!\n m.map! { |n| n.strip }\n f.map! { |n| n.strip }\n\n return :unkown if m.include?(name) && f.include?(name)\n return :male if m.include?(name)\n return :female if f.include?(name)\n :unknown\nend",
"title": ""
},
{
"docid": "4f83516a5a60401c9ffc96a63aa8c557",
"score": "0.6269531",
"text": "def born_sex(male, female)\n puts \" #{male} #{female}\"\nend",
"title": ""
},
{
"docid": "629c65e51259cac5bfd3b0c4357d345f",
"score": "0.6263188",
"text": "def gender\n (male ? 'M' : 'F')\n end",
"title": ""
},
{
"docid": "614361b8fac2c9546d3593eedd90ec27",
"score": "0.6255454",
"text": "def name\n self.gender.name == \"Male\" ? gender = \"Men\" : gender = \"Women\" \n \"#{self.division.name}-#{self.age_class.name}-#{gender}\"\n end",
"title": ""
},
{
"docid": "1e55f6ad46c064949fc3eb3c537fa476",
"score": "0.6248446",
"text": "def user_singular_pronoun(user)\n user.is_male? ? 'he' : 'she'\n end",
"title": ""
},
{
"docid": "fee04f69766ea1e445155c70efb48246",
"score": "0.6247261",
"text": "def female?\n self.gender == 'f'\n end",
"title": ""
},
{
"docid": "379c5be8cdb621723b0c123c04c6b758",
"score": "0.6237886",
"text": "def sex(record)\n record.gender =~ /[Mm]/ ? \"Male\" : \"Female\"\n end",
"title": ""
},
{
"docid": "379c5be8cdb621723b0c123c04c6b758",
"score": "0.6237886",
"text": "def sex(record)\n record.gender =~ /[Mm]/ ? \"Male\" : \"Female\"\n end",
"title": ""
},
{
"docid": "03d35ad50299d1f6164f3fc247e8f579",
"score": "0.6232165",
"text": "def gender_short\n if self.gender_id == 1 then 'M' elsif self.gender_id == 2 then 'F' else '?' end\n end",
"title": ""
},
{
"docid": "6dd8193885fb020b5f30b290475ab4a1",
"score": "0.6225051",
"text": "def user_pronoun(user)\n user.is_male? ? 'his' : 'her'\n end",
"title": ""
},
{
"docid": "ce59fec1cb02d98546e1c39e13ff6e6b",
"score": "0.62136143",
"text": "def family_name\n respond_to?(:personFamilyName) ? personFamilyName : ''\n end",
"title": ""
},
{
"docid": "9c9f1413ca3da8046e8938168a5a9e3f",
"score": "0.6206487",
"text": "def sex\n if self[:sex] == 0\n 'Male'\n elsif self[:sex] == 1\n 'Female'\n else\n 'N/A'\n end\n end",
"title": ""
},
{
"docid": "67afaa52a9b58bc2bcda5779c91fc1f4",
"score": "0.6203571",
"text": "def full_name(salutation=false)\n\t\treturn ((salutation && self.salutation) ? self.salutation.to_s + \" \" : '') + self.lastname.to_s + \" \" + self.firstname.to_s\n end",
"title": ""
},
{
"docid": "875c1b5f85507deae18e2a98bfdf9da1",
"score": "0.619263",
"text": "def male_first_name\n fetch('name.male_first_name')\n end",
"title": ""
},
{
"docid": "33d16946af0b60feb9cd46134e3d988c",
"score": "0.61656576",
"text": "def gender\n [\"Femelle\", \"Mâle\"].sample\n end",
"title": ""
},
{
"docid": "33d16946af0b60feb9cd46134e3d988c",
"score": "0.61656576",
"text": "def gender\n [\"Femelle\", \"Mâle\"].sample\n end",
"title": ""
},
{
"docid": "18a2662976ac74dc5bf3878d25efb981",
"score": "0.61478305",
"text": "def get_sex\n return \"and I am \" + @sex\n end",
"title": ""
},
{
"docid": "94c149e7f0091f2d0380b95d1d1ee1f6",
"score": "0.614457",
"text": "def isFemale?\n return self.gender==1\n end",
"title": ""
},
{
"docid": "0b9529a76b963ae183aa05ebc145d20d",
"score": "0.6143492",
"text": "def full_name\n \"#{lastname}, #{firstname} - #{salutation}\"\n end",
"title": ""
},
{
"docid": "e834d433ffccb8f048a44faea667621e",
"score": "0.6131697",
"text": "def generate_username(first_name, family_name)\n initial = first_name[0].downcase\n family_name = family_name.downcase\n number = rand(100..999)\n initial + family_name + number.to_s\n end",
"title": ""
},
{
"docid": "afb1ac8d7f0759faff00ea3a2068cbec",
"score": "0.61288035",
"text": "def boy_named_sue\n \tif gender == \"male\" && first_name == \"Sue\"\n \t\terrors.add(:gender, \"anything but Sue\")\n \tend\n end",
"title": ""
},
{
"docid": "4e75a554cdfb31d6bb80be458bd9f5cc",
"score": "0.6127346",
"text": "def gender(value)\n\ttotal_value_sen = Legislator.all.where(\"title = ? AND gender = ?\", \"Sen\", value).count\n\ttotal_value_rep = Legislator.all.where(\"title = ? AND gender = ?\", \"Rep\", value).count\n\ttotal_sen = Legislator.all.where(title: \"Sen\").count\n\ttotal_rep = Legislator.all.where(title: \"Rep\").count\n\tif value === \"M\"\n\t\tputs \"Male Senators: #{total_value_sen} (#{(total_value_sen.to_f/total_sen.to_f).round(4)*100}%)\"\n\t\tputs \"Male Representatives: #{total_value_rep} (#{(total_value_rep.to_f/total_rep.to_f).round(4)*100}%)\"\n\telse\n\t\tputs \"Female Senators: #{total_value_sen} (#{(total_value_sen.to_f/total_sen.to_f).round(4)*100}%)\"\n\t\tputs \"Female Representatives: #{total_value_rep} (#{(total_value_rep.to_f/total_rep.to_f).round(4)*100}%)\"\n\tend\nend",
"title": ""
},
{
"docid": "4090b86c5d9cca229cc01e4905ea91c3",
"score": "0.6125928",
"text": "def gender\n model.gender.titleize\n end",
"title": ""
},
{
"docid": "91f194e3285063f43be7d007b6981a3d",
"score": "0.61244357",
"text": "def is_male?\n 'm' == self.gender.to_s ? true : false\n end",
"title": ""
},
{
"docid": "b9c6cd896a8358afd5a3665527a9b362",
"score": "0.612333",
"text": "def gender_as_text\n self.gender == 'm' ? 'Male' : 'Female'\n end",
"title": ""
},
{
"docid": "051a3af19b56c5c172e1cb3346e5fbcb",
"score": "0.6120914",
"text": "def gender\n @gender = case @gender[0].to_s.downcase \n when 'f'\n 'Female'\n when 'm'\n 'Male'\n else\n ''\n end\n end",
"title": ""
},
{
"docid": "21d78fa781588ae83068d5ea93a528f7",
"score": "0.61004436",
"text": "def full_name\n \t\t\"#{abr_profesion} #{persona_nombre} #{persona_apellido}\"\n\tend",
"title": ""
},
{
"docid": "bda5fb39d5ae774a94eb904a652a1cef",
"score": "0.6099354",
"text": "def gender_display\n return \"\" if gender.nil?\n DISPLAY_GENDERS[gender.to_i]\n end",
"title": ""
},
{
"docid": "bda5fb39d5ae774a94eb904a652a1cef",
"score": "0.6099354",
"text": "def gender_display\n return \"\" if gender.nil?\n DISPLAY_GENDERS[gender.to_i]\n end",
"title": ""
},
{
"docid": "49a9f8ba3edca31dafbb0d5e128ae5ce",
"score": "0.60951793",
"text": "def pick_first_name(sex=nil, age=:adult)\n sex ||= ['M', 'F'].sample\n if age == :adult\n sex.upcase == 'M' ? MENS_NAMES.sample : WOMENS_NAMES.sample\n else\n sex.upcase == 'M' ? BOYS_NAMES.sample : GIRLS_NAMES.sample \n end\n end",
"title": ""
},
{
"docid": "92ee6ffa914781f2fc882146fbbe5385",
"score": "0.60918623",
"text": "def user_gender(user)\n user.gender ? user.gender : 'female'\n end",
"title": ""
},
{
"docid": "da3b66b75b2f63cbfe2c2be659f04159",
"score": "0.6088402",
"text": "def full_name\n full_name = \"#{first} #{middle} #{last}\"\n if maiden != last\n full_name += \" nee #{maiden}\"\n end\n return full_name\n end",
"title": ""
}
] |
c657de4b70d266e9a3a784b999ea9e60
|
Never trust parameters from the scary internet, only allow the white list through.
|
[
{
"docid": "8a44c0139cb33323be5d9428334518a0",
"score": "0.0",
"text": "def course_params\n params.require(:course).permit(:name, :prerequisite,:description,:image,:user_id,category_ids:[],location_ids:[])\n end",
"title": ""
}
] |
[
{
"docid": "3663f9efd3f3bbf73f4830949ab0522b",
"score": "0.7495027",
"text": "def whitelisted_params\n super\n end",
"title": ""
},
{
"docid": "13a61145b00345517e33319a34f7d385",
"score": "0.69566035",
"text": "def strong_params\n params.require(:request).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "c72da3a0192ce226285be9c2a583d24a",
"score": "0.69225836",
"text": "def strong_params\n params.require(:post).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "3d346c1d1b79565bee6df41a22a6f28d",
"score": "0.68929327",
"text": "def strong_params\n params.require(:resource).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "aa06a193f057b6be7c0713a5bd30d5fb",
"score": "0.67848456",
"text": "def strong_params\n params.require(:listing).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "f6060519cb0c56a439976f0c978690db",
"score": "0.674347",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "fad8fcf4e70bf3589fbcbd40db4df5e2",
"score": "0.6682223",
"text": "def allowed_params\n # Only this one attribute will be allowed, no hacking\n params.require(:user).permit(:username)\n end",
"title": ""
},
{
"docid": "b453d9a67af21a3c28a62e1848094a41",
"score": "0.6636527",
"text": "def strong_params\n params.require(:kpi).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "2c8e2be272a55477bfc4c0dfc6baa7a7",
"score": "0.66291976",
"text": "def strong_params\n params.require(:community_member).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "1685d76d665d2c26af736aa987ac8b51",
"score": "0.66258276",
"text": "def permitted_params\n params.permit!\n end",
"title": ""
},
{
"docid": "77f5795d1b9e0d0cbd4ea67d02b5ab7f",
"score": "0.65625846",
"text": "def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"title": ""
},
{
"docid": "cc1542a4be8f3ca5dc359c2eb3fb7d18",
"score": "0.6491194",
"text": "def strong_params\n params.require(:message).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e291b3969196368dd4f7080a354ebb08",
"score": "0.6477825",
"text": "def permitir_parametros\n \t\tparams.permit!\n \tend",
"title": ""
},
{
"docid": "2d2af8e22689ac0c0408bf4cb340d8c8",
"score": "0.64526874",
"text": "def allowed_params\n params.require(:user).permit(:name, :email)\n end",
"title": ""
},
{
"docid": "236e1766ee20eef4883ed724b83e4176",
"score": "0.64001405",
"text": "def param_whitelist\n [\n :name,\n :tagline, :contact, :summary, :stage,\n :website, :facebook, :twitter, :linkedin, :github,\n :founded_at,\n community_ids: [],\n sectors: [\n :commercial,\n :social,\n :research\n ],\n privacy: [\n contact: [],\n kpis: []\n ],\n permission: [\n listings: [],\n profile: [],\n posts: [],\n kpis: []\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"title": ""
},
{
"docid": "b29cf4bc4a27d4b199de5b6034f9f8a0",
"score": "0.63810205",
"text": "def safe_params\n params\n .require( self.class.model_class.name.underscore.to_sym )\n .permit( self.class.params_list )\n end",
"title": ""
},
{
"docid": "bfb292096090145a067e31d8fef10853",
"score": "0.63634825",
"text": "def param_whitelist\n whitelist = [\n :title, :description, :skills,\n :positions, :category, :salary_period,\n :started_at, :finished_at,\n :deadline,\n :salary_min, :salary_max, :hours,\n :equity_min, :equity_max,\n :privacy,\n :owner_id, :owner_type,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:owner_id)\n whitelist.delete(:owner_type)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "6bf3ed161b62498559a064aea569250a",
"score": "0.633783",
"text": "def require_params\n return nil\n end",
"title": ""
},
{
"docid": "b4c9587164188c64f14b71403f80ca7c",
"score": "0.6336759",
"text": "def sanitize_params!\n request.sanitize_params!\n end",
"title": ""
},
{
"docid": "b63e6e97815a8745ab85cd8f7dd5b4fb",
"score": "0.6325718",
"text": "def excluded_from_filter_parameters; end",
"title": ""
},
{
"docid": "38bec0546a7e4cbf4c337edbee67d769",
"score": "0.631947",
"text": "def user_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password)\n end",
"title": ""
},
{
"docid": "37d1c971f6495de3cdd63a3ef049674e",
"score": "0.63146484",
"text": "def param_whitelist\n whitelist = [\n :name,\n :overview,\n :website, :facebook, :twitter,\n :privacy,\n :avatar_id, :community_id, :category_ids,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n unless action_name === 'create'\n whitelist.delete(:community_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "5ec018b4a193bf3bf8902c9419279607",
"score": "0.63137317",
"text": "def user_params # contains strong parameters\n params.require(:user).permit(:name, :email, :password,\n :password_confirmation)\n # strong parameters disallows any post information that is not permitted (admin security) when signing_up\n # so not all users will get admin access by hacking params using curl\n end",
"title": ""
},
{
"docid": "91bfe6d464d263aa01e776f24583d1d9",
"score": "0.6306224",
"text": "def permitir_parametros\n params.permit!\n end",
"title": ""
},
{
"docid": "e012d7306b402a37012f98bfd4ffdb10",
"score": "0.6301168",
"text": "def strong_params\n params.require(:team).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "157e773497f78353899720ad034a906a",
"score": "0.63000035",
"text": "def white_list_params\n params.require(:white_list).permit(:ip, :comment)\n end",
"title": ""
},
{
"docid": "8c384af787342792f0efc7911c3b2469",
"score": "0.629581",
"text": "def whitelisted_vegetable_params\n params.require(:vegetable).permit(:name, :color, :rating, :latin_name)\n end",
"title": ""
},
{
"docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c",
"score": "0.62926817",
"text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end",
"title": ""
},
{
"docid": "0f69d0204a0c9a5e4a336cbb3dccbb2c",
"score": "0.62926817",
"text": "def allowed_params\n params.permit(:campaign_id,:marketer_id,:creator_id,:status)\n end",
"title": ""
},
{
"docid": "9b76b3149ac8b2743f041d1af6b768b5",
"score": "0.6280713",
"text": "def filter_params\n params.permit(\n\t\t\t\t:name,\n\t\t\t\t:sitedefault,\n\t\t\t\t:opinions,\n\t\t\t\t:contested,\n\t\t\t\t:uncontested,\n\t\t\t\t:initiators,\n\t\t\t\t:comments,\n\t\t\t\t:following,\n\t\t\t\t:bookmarks,\n\t\t\t\t:lone_wolf,\n\t\t\t\t:level_zero,\n\t\t\t\t:level_nonzero,\n\t\t\t\t:private,\n\t\t\t\t:public_viewing,\n\t\t\t\t:public_comments,\n\t\t\t\t:has_parent,\n\t\t\t\t:has_no_parent,\n\t\t\t\t:today,\n\t\t\t\t:last_week,\n\t\t\t\t:last_month,\n\t\t\t\t:last_year,\n\t\t\t\t:sort_by_created_at,\n\t\t\t\t:sort_by_updated_at,\n\t\t\t\t:sort_by_views,\n\t\t\t\t:sort_by_votes,\n\t\t\t\t:sort_by_scores,\n\t\t\t\t:who_id)\n end",
"title": ""
},
{
"docid": "603f4a45e5efa778afca5372ae8a96dc",
"score": "0.6271388",
"text": "def param_whitelist\n [:role]\n end",
"title": ""
},
{
"docid": "f6399952b4623e5a23ce75ef1bf2af5a",
"score": "0.6266194",
"text": "def allowed_params\n\t\tparams.require(:password).permit(:pass)\n\tend",
"title": ""
},
{
"docid": "37c5d0a9ebc5049d7333af81696608a0",
"score": "0.6256044",
"text": "def safe_params\n\t\tparams.require(:event).permit(:title, :event_date, :begti, :endti, :comments, :has_length, :is_private)\n\tend",
"title": ""
},
{
"docid": "505e334c1850c398069b6fb3948ce481",
"score": "0.62550515",
"text": "def sanitise!\n @params.keep_if {|k,v| whitelisted? k}\n end",
"title": ""
},
{
"docid": "6c4620f5d8fd3fe3641e0474aa7014b2",
"score": "0.62525266",
"text": "def white_listed_parameters\n params\n .require(:movie)\n .permit(:title, :description, :year_released)\n end",
"title": ""
},
{
"docid": "d14bb69d2a7d0f302032a22bb9373a16",
"score": "0.6234781",
"text": "def protect_my_params\n return params.require(:photo).permit(:title, :artist, :url)\n\tend",
"title": ""
},
{
"docid": "5629f00db37bf403d0c58b524d4c3c37",
"score": "0.62278074",
"text": "def filtered_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "d370098b1b3289dbd04bf1c073f2645b",
"score": "0.6226693",
"text": "def allow_params\n params.permit(:id, :email, :password)\n end",
"title": ""
},
{
"docid": "fde8b208c08c509fe9f617229dfa1a68",
"score": "0.6226605",
"text": "def strong_params\n params.require(:thread).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "78cbf68c3936c666f1edf5f65e422b6f",
"score": "0.6226114",
"text": "def whitelisted_user_params\n if params[:user]\n params.require(:user).permit(:email, :username, :password)\n else\n { :email => params[:email],\n :username => params[:username],\n :password => params[:password] }\n end\nend",
"title": ""
},
{
"docid": "d38efafa6be65b2f7da3a6d0c9b7eaf5",
"score": "0.6200643",
"text": "def roaster_params\n # Returns a sanitized hash of the params with nothing extra\n params.permit(:name, :email, :img_url, :password_digest, :address, :website, :phone, :latitude, :longitutde, :description)\n end",
"title": ""
},
{
"docid": "d724124948bde3f2512c5542b9cdea74",
"score": "0.61913997",
"text": "def alpha_provider_params\n params.require(:alpha_provider).permit!\n end",
"title": ""
},
{
"docid": "d18a36785daed9387fd6d0042fafcd03",
"score": "0.61835426",
"text": "def white_listed_parameters\n params\n .require(:company)\n .permit(:company_name, :company_avatar)\n end",
"title": ""
},
{
"docid": "36956168ba2889cff7bf17d9f1db41b8",
"score": "0.6179986",
"text": "def set_param_whitelist(*param_list)\n self.param_whitelist = param_list\n end",
"title": ""
},
{
"docid": "07bc0e43e1cec1a821fb2598d6489bde",
"score": "0.61630195",
"text": "def accept_no_params\n accept_params {}\n end",
"title": ""
},
{
"docid": "fc4b1364974ea591f32a99898cb0078d",
"score": "0.6160931",
"text": "def request_params\n params.permit(:username, :password, :user_id, :status, :accepted_by, :rejected_by)\n end",
"title": ""
},
{
"docid": "13e3cfbfe510f765b5944667d772f453",
"score": "0.6155551",
"text": "def admin_security_params\n params.require(:security).permit(:name, :url, :commonplace_id)\n end",
"title": ""
},
{
"docid": "84bd386d5b2a0d586dca327046a81a63",
"score": "0.61542404",
"text": "def good_params\n permit_params\n end",
"title": ""
},
{
"docid": "b9432eac2fc04860bb585f9af0d932bc",
"score": "0.61356604",
"text": "def wall_params\n params.permit(:public_view, :guest)\n end",
"title": ""
},
{
"docid": "f2342adbf71ecbb79f87f58ff29c51ba",
"score": "0.61342114",
"text": "def housing_request_params\n params[:housing_request].permit! #allow all parameters for now\n end",
"title": ""
},
{
"docid": "8fa507ebc4288c14857ace21acf54c26",
"score": "0.61188847",
"text": "def strong_params\n # to dooo\n end",
"title": ""
},
{
"docid": "9292c51af27231dfd9f6478a027d419e",
"score": "0.61140966",
"text": "def domain_params\n params[:domain].permit!\n end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.611406",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "fc43ee8cb2466a60d4a69a04461c601a",
"score": "0.611406",
"text": "def check_params; true; end",
"title": ""
},
{
"docid": "a3aee889e493e2b235619affa62f39c3",
"score": "0.61107725",
"text": "def user_params\n params.permit(:full_name, :email, :job, :about, :max_search_distance,\n :website_url, :linkedin_url,\n :behance_url, :github_url, :stackoverflow_url)\n end",
"title": ""
},
{
"docid": "585f461bf01ed1ef8d34fd5295a96dca",
"score": "0.61038506",
"text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "585f461bf01ed1ef8d34fd5295a96dca",
"score": "0.61038506",
"text": "def param_whitelist\n whitelist = [\n :message,\n :privacy,\n :author_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:author_id)\n end\n \n whitelist\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.6097247",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "b63ab280629a127ecab767e2f35b8ef0",
"score": "0.6097247",
"text": "def params\n @_params ||= super.tap {|p| p.permit!}.to_unsafe_h\n end",
"title": ""
},
{
"docid": "677293afd31e8916c0aee52a787b75d8",
"score": "0.60860336",
"text": "def newsletter_params\n params.permit!.except(:action, :controller, :_method, :authenticity_token)\n end",
"title": ""
},
{
"docid": "e50ea3adc222a8db489f0ed3d1dce35b",
"score": "0.60855556",
"text": "def params_without_facebook_data\n params.except(:signed_request).permit!.to_hash\n end",
"title": ""
},
{
"docid": "b7ab5b72771a4a2eaa77904bb0356a48",
"score": "0.608446",
"text": "def search_params\n params.permit!.except(:controller, :action, :format)\n end",
"title": ""
},
{
"docid": "b2841e384487f587427c4b35498c133f",
"score": "0.6076753",
"text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end",
"title": ""
},
{
"docid": "3f5347ed890eed5ea86b70281803d375",
"score": "0.60742563",
"text": "def user_params\n params.permit!\n end",
"title": ""
},
{
"docid": "0c8779b5d7fc10083824e36bfab170de",
"score": "0.60677326",
"text": "def white_base_params\n params.fetch(:white_base, {}).permit(:name)\n end",
"title": ""
},
{
"docid": "7646659415933bf751273d76b1d11b40",
"score": "0.60666215",
"text": "def whitelisted_observation_params\n return unless params[:observation]\n\n params[:observation].permit(whitelisted_observation_args)\n end",
"title": ""
},
{
"docid": "fa0608a79e8d27c2a070862e616c8c58",
"score": "0.6065763",
"text": "def vampire_params\n # whitelist all of the vampire attributes so that your forms work!\n end",
"title": ""
},
{
"docid": "a3dc8b6db1e6584a8305a96ebb06ad21",
"score": "0.60655254",
"text": "def need_params\n end",
"title": ""
},
{
"docid": "4f8205e45790aaf4521cdc5f872c2752",
"score": "0.6064794",
"text": "def search_params\n params.permit(:looking_for, :utf8, :authenticity_token, :min_age,\n :max_age, :sort_by, likes:[])\n end",
"title": ""
},
{
"docid": "e39a8613efaf5c6ecf8ebd58f1ac0a06",
"score": "0.6062697",
"text": "def permitted_params\n params.permit :utf8, :_method, :authenticity_token, :commit, :id,\n :encrypted_text, :key_size\n end",
"title": ""
},
{
"docid": "c436017f4e8bd819f3d933587dfa070a",
"score": "0.60620916",
"text": "def filtered_parameters; end",
"title": ""
},
{
"docid": "d6886c65f0ba5ebad9a2fe5976b70049",
"score": "0.60562736",
"text": "def allow_params_authentication!\n request.env[\"devise.allow_params_authentication\"] = true\n end",
"title": ""
},
{
"docid": "96ddf2d48ead6ef7a904c961c284d036",
"score": "0.60491294",
"text": "def user_params\n permit = [\n :email, :password, :password_confirmation,\n :image, :name, :nickname, :oauth_token,\n :oauth_expires_at, :provider, :birthday\n ]\n params.permit(permit)\n end",
"title": ""
},
{
"docid": "f78d6fd9154d00691c34980d7656b3fa",
"score": "0.60490465",
"text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "f78d6fd9154d00691c34980d7656b3fa",
"score": "0.60490465",
"text": "def authorize_params\n super.tap do |params|\n %w[display with_offical_account forcelogin].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"title": ""
},
{
"docid": "75b7084f97e908d1548a1d23c68a6c4c",
"score": "0.6046521",
"text": "def allowed_params\n params.require(:sea).permit(:name, :temperature, :bio, :mood, :image_url, :favorite_color, :scariest_creature, :has_mermaids)\n end",
"title": ""
},
{
"docid": "080d2fb67f69228501429ad29d14eb29",
"score": "0.6041768",
"text": "def filter_user_params\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"title": ""
},
{
"docid": "aa0aeac5c232d2a3c3f4f7e099e7e6ff",
"score": "0.60346854",
"text": "def parameters\n params.permit(permitted_params)\n end",
"title": ""
},
{
"docid": "0bdcbbe05beb40f7a08bdc8e57b7eca8",
"score": "0.6030552",
"text": "def filter_params\n end",
"title": ""
},
{
"docid": "cf73c42e01765dd1c09630007357379c",
"score": "0.6024842",
"text": "def params_striper\n\t \tparams[:user].delete :moonactor_ability\n\t end",
"title": ""
},
{
"docid": "793abf19d555fb6aa75265abdbac23a3",
"score": "0.6021606",
"text": "def user_params\n if admin_user?\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter, :active, :admin, :receive_customer_inquiry)\n else\n # Don't allow non-admin users to hack the parameters and give themselves admin security; self created records automatically set to active\n params.require(:user).permit(:email, :password, :password_confirmation, :name, :address_1, :address_2, :apt_number, :city, :state_id, :zip_code, :newsletter)\n end\n end",
"title": ""
},
{
"docid": "2e70947f467cb6b1fda5cddcd6dc6304",
"score": "0.6019679",
"text": "def strong_params(wimpy_params)\n ActionController::Parameters.new(wimpy_params).permit!\nend",
"title": ""
},
{
"docid": "2a11104d8397f6fb79f9a57f6d6151c7",
"score": "0.6017253",
"text": "def user_params\n sanitize params.require(:user).permit(:username, :password, :password_confirmation, :display_name, :about_me, :avatar, :current_password, :banned, :ban_message)\n end",
"title": ""
},
{
"docid": "a83bc4d11697ba3c866a5eaae3be7e05",
"score": "0.60145336",
"text": "def user_params\n\t params.permit(\n\t :name,\n\t :email,\n\t :password\n\t \t )\n\t end",
"title": ""
},
{
"docid": "2aa7b93e192af3519f13e9c65843a6ed",
"score": "0.60074294",
"text": "def user_params\n params[:user].permit!\n end",
"title": ""
},
{
"docid": "9c8cd7c9e353c522f2b88f2cf815ef4e",
"score": "0.6006753",
"text": "def case_sensitive_params\n params.require(:case_sensitive).permit(:name)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6005122",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "45b8b091f448e1e15f62ce90b681e1b4",
"score": "0.6005122",
"text": "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"title": ""
},
{
"docid": "9736586d5c470252911ec58107dff461",
"score": "0.60048765",
"text": "def params_without_classmate_data\n params.clone.permit!.except(*(CLASSMATE_PARAM_NAMES + DEBUG_PARAMS))\n end",
"title": ""
},
{
"docid": "e7cad604922ed7fad31f22b52ecdbd13",
"score": "0.60009843",
"text": "def member_params\n # byebug\n params.require(:member).permit(\n :first_name, \n :last_name, \n :username, \n :email, \n :password, \n :image, \n :family_size, \n :address)\n\n end",
"title": ""
},
{
"docid": "58ad32a310bf4e3c64929a860569b3db",
"score": "0.6000742",
"text": "def user_params\n\t\tparams.require(:user).permit!\n\tend",
"title": ""
},
{
"docid": "58ad32a310bf4e3c64929a860569b3db",
"score": "0.6000742",
"text": "def user_params\n\t\tparams.require(:user).permit!\n\tend",
"title": ""
},
{
"docid": "f70301232281d001a4e52bd9ba4d20f5",
"score": "0.6000161",
"text": "def room_allowed_params\n end",
"title": ""
},
{
"docid": "2e6de53893e405d0fe83b9d18b696bd5",
"score": "0.599852",
"text": "def user_params\n params.require(:user).permit(:username, :password, :realname, :email, :publicvisible)\n end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.59984183",
"text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end",
"title": ""
},
{
"docid": "19bd0484ed1e2d35b30d23b301d20f7c",
"score": "0.59984183",
"text": "def unsafe_params\n ActiveSupport::Deprecation.warn(\"Using `unsafe_params` isn't a great plan\", caller(1))\n params.dup.tap(&:permit!)\n end",
"title": ""
},
{
"docid": "a50ca4c82eaf086dcbcc9b485ebd4261",
"score": "0.59947807",
"text": "def white_listed_parameters\n params\n .require(:story)\n .permit(:title, :link, :upvotes, :category)\n end",
"title": ""
},
{
"docid": "0f53610616212c35950b45fbcf9f5ad4",
"score": "0.5993962",
"text": "def user_params(params)\n\tparams.permit(:email, :password, :name, :blurb)\n end",
"title": ""
},
{
"docid": "b545ec7bfd51dc43b982b451a715a538",
"score": "0.5992739",
"text": "def user_params\n params_allowed = %i[email password password_confirmation is_admin]\n params.require(:user).permit(params_allowed)\n end",
"title": ""
},
{
"docid": "0b704016f3538045eb52c45442e7f704",
"score": "0.59911275",
"text": "def admin_params\n filtered_params = params.require(:admin).permit(:display_name, :email, :password, :password_confirmation)\n if filtered_params[:password] == \"\"\n filtered_params.delete(:password)\n filtered_params.delete(:password_confirmation)\n end\n filtered_params\n end",
"title": ""
},
{
"docid": "6af3741c8644ee63d155db59be10a774",
"score": "0.59906775",
"text": "def allowed_params\n %i[\n lock_version\n comments\n organization\n job_title\n pronouns\n year_of_birth\n gender\n ethnicity\n opted_in\n invite_status\n acceptance_status\n registered\n registration_type\n can_share\n registration_number\n can_photo\n can_record\n name\n name_sort_by\n name_sort_by_confirmed\n pseudonym\n pseudonym_sort_by\n pseudonym_sort_by_confirmed\n ]\n end",
"title": ""
}
] |
54e0750f49c42aae728ed01456f328db
|
Time Complexity: log(n) Space Complexity: log(n)
|
[
{
"docid": "ab1bdf7a343770dd3c6ac42a7c0bcdb9",
"score": "0.0",
"text": "def add(key, value)\n new_node = TreeNode.new(key, value)\n\n if @root.nil?\n @root = new_node\n else\n add_helper(@root, new_node, key)\n end\n end",
"title": ""
}
] |
[
{
"docid": "876b1577ae1ba612137db52a7a2ae711",
"score": "0.6761441",
"text": "def dec2FactString(nb)\n facts = []\n current = 1\n while nb > (fact = fact(current)) do # QUESTION: is this O(logn) or O(n)?\n facts << fact\n current += 1\n end\n\n result = []\n facts.reverse_each do |factorial|\n multiple = (nb/factorial).floor\n nb -= multiple*factorial\n result << code(multiple)\n end\n result.push(0).join\nend",
"title": ""
},
{
"docid": "ba1958a12d523bd63f8d13a97f2ed084",
"score": "0.659915",
"text": "def fibSeq(n)\n\ta=[0]\t\t\t\t\t\t# O(1)\n\tn.times do |index|\t\t\t\t# O(n)\n\t\tif index==0\t\t\t\t# O(1)\n\t\t\ta[index]=0\t\t\t# O(1)\n\t\telsif index==1\n\t\t\ta[index]=1\n\t\telse\n\t\t\ta[index] = a[index-1] + a[index-2] # O(n+n) \n\t\tend\n\tend\n\n\tputs \"Complete Array: #{a}\"\n\tevens = []\n\ta.each do |n|\n\t\tif n % 2 == 0\n\t\t\tevens.push(n)\n\t\tend\n\tend\n\tputs \"Evens: #{evens}\"\n\tsum = 0\n\tevens.each do |num| sum += num end\n\tputs \"Total: #{sum}\"\n\n\nend",
"title": ""
},
{
"docid": "0d56c612a8a29b3bb1ff5b1962f8d274",
"score": "0.64304155",
"text": "def run_benchmark(n)\n puts \"Scale of #{n}\"\n Benchmark.bm(14) do |x|\n if n > 2\n puts \"O(n!) --- ommited for sake of brevity ---\"\n else\n x.report(\"O(n!):\"){ first_anagram?(\"elvis\" * n, \"lives\" * n) }\n end\n x.report(\"O(n^2):\"){ second_anagram?(\"elvis\" * n, \"lives\" * n) }\n x.report(\"O(n*long(n)):\"){ third_anagram?(\"elvis\" * n, \"lives\" * n) }\n x.report(\"O(n):\"){ fourth_anagram?(\"elvis\" * n, \"lives\" * n) }\n end\n puts \"\\n\\n\"\nend",
"title": ""
},
{
"docid": "c978c895d39f4228b0e144beeaf88f7c",
"score": "0.6410385",
"text": "def removNb_inefficient(n)\n sigma = n*(n+1)/2 # First find the sum of the first n numbers\n (1..n).each do |i| # Start one iteration from 1 to n, call that i\n (i+1..n).each do |j| # Start an inner iteration fron i+1 to n\n product = i*j \n gap_sum = sigma - i - j\n if product == gap_sum # if it meets our conditions then we're done\n return [[i,j],[j,i]]\n end\n end\n end\n return [] # if we have gotten this far then we have no solution\nend",
"title": ""
},
{
"docid": "27f29666484272c0d973e8400c4c357c",
"score": "0.6377055",
"text": "def hash_two_sum?(arr, num)\n hash = Hash.new(0) #O(1) work\n arr.each do |ele| # N times\n return true if hash.has_key?(num - ele) # O(1) work\n hash[ele]+= 1 # O(1) work\n end\n false\nend",
"title": ""
},
{
"docid": "530f3c8d626b19da2322955ed759c3af",
"score": "0.63301235",
"text": "def calcUniqPermutationsLog2\n counts = Hash.new(0)\n self.each{|item| counts[item]+=1}\n sum = 0\n counts.each{|k,v|\n if v > 1\n sum += Math.log2factorial(v)\n end\n }\n return Math.log2factorial(self.length) - sum\n end",
"title": ""
},
{
"docid": "93467339662d228ca010e49ce00e51b0",
"score": "0.6303068",
"text": "def dbl_linear(n)\n i = 0\n result = [1]\n while result.length < n\n result.push(2*result[i]+1)\n result.push(3*result[i]+1)\n i += 1\n result = result.sort\n end\n return result\nend",
"title": ""
},
{
"docid": "855a55b7301e7286dd66d3d26709d17e",
"score": "0.6296738",
"text": "def problem_94\n py = lambda do |m,n|\n [m*m-n*n,2*n*m,m*m+n*n]\n end\n\n m,n,used = 2,1,0\n t,tt,r = 0,0,nil\n loop do\n r = py.call(m,n).sort\n if (r[2] - r[0]*2).abs == 1\n tt = r[2]*2 + r[0]*2\n puts \"#{m} #{n} #{r.inspect} circ=#{tt}\"\n used += 1\n if used == 2\n n = m\n used = 0\n end\n t += tt\n return(t-tt) if t > 1_000_000_000\n end\n m += 1\n end\nend",
"title": ""
},
{
"docid": "f91b4d47a631f1f01d2f344a4b79e6db",
"score": "0.6296439",
"text": "def solution(n)\n sum_of_squares = 0\n square_of_the_sum = 0\n (1..n).each do |v|\n sum_of_squares += v * v\n end\n (1..n).each do |v|\n square_of_the_sum += v\n end\n square_of_the_sum = square_of_the_sum ** 2\n sum_of_squares - square_of_the_sum\nend",
"title": ""
},
{
"docid": "cd9ceea76c6817e25e0f2d52abfe4fb9",
"score": "0.62882763",
"text": "def triangle_number_n2logn(nums)\n count = 0\n sorted_nums = nums.sort!\n \n (0..sorted_nums.length-3).each do |i1|\n (i1+1..sorted_nums.length-2).each do |i2|\n # for every i1, i2 pair, binary search for the last correct i3 \n target = sorted_nums[i1] + sorted_nums[i2] - 1\n i3_upper_limit = bs_last_less_or_eq(sorted_nums[i2+1..-1], target)\n if i3_upper_limit\n i3_upper_limit += i2 + 1\n count += i3_upper_limit - i2\n end\n end\n end\n count\nend",
"title": ""
},
{
"docid": "0ff1d12526f0eff62dd1ff078060074f",
"score": "0.625503",
"text": "def log_perm(n, r)\n\t0.upto(r-1).reduce(0){|r, i| r = r + Math.log(n-i)}\nend",
"title": ""
},
{
"docid": "50147e265d753958b07156b7a401cd07",
"score": "0.6245975",
"text": "def solve(n)\n result = []\n start = Time.now\n for a in 0..n\n for b in 0..n\n for c in 0..n\n for d in 0..n\n if (a**3 + b**3) == (c**3 + d**3)\n result.push([a,b,c,d])\n puts \"#{a} #{b} #{c} #{d}\"\n end\n end\n end\n end\n end\n puts \"number of solutions #{result.length}\"\n runTime = Time.now - start\n return runTime\nend",
"title": ""
},
{
"docid": "127d70f82163741a33e07786ec81594e",
"score": "0.62429875",
"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": "796f25e0681df34a827346132dc97d3f",
"score": "0.622751",
"text": "def log_comb(n, r)\n\tlog_perm(n, r) - log_perm(r, r)\nend",
"title": ""
},
{
"docid": "acdd54c774673e7bdb3ba24ff6d6940c",
"score": "0.6222645",
"text": "def fun2(n)\n\tm = 0\n\ti = 0\n\twhile i < n\n\t\tj = 0\n\t\twhile j < n\n\t\t\tm += 1\n\t\t\tj += 1\n\t\tend\n\t\ti += 1\n\tend\n\treturn m\nend",
"title": ""
},
{
"docid": "4fcb042de6af6b76dc383090247fc115",
"score": "0.620404",
"text": "def solve( n = 2_000_000 )\n n.prime_sieve.inject( :+ )\n end",
"title": ""
},
{
"docid": "1c8f72ec246b696d4c647d2865636c2a",
"score": "0.6201569",
"text": "def solve( n = 1_000 )\n count = 0\n a, b = 2, 1\n\n n.times do\n count += 1 if (a + b).to_s.length > a.to_s.length\n a, b = (a << 1) + b, a\n end\n\n count\n end",
"title": ""
},
{
"docid": "554ba15bb2c03ef0f3f8d4262066ba23",
"score": "0.619757",
"text": "def abundant(n)\n abundant_list = []\n \n 1.upto(n) do |i|\n if proper_divisors(i).inject(:+) > i\n abundant_list << i\n end\n end\n\n abundant_list\nend",
"title": ""
},
{
"docid": "23a31f343e8bdd2c867350a35f62dcc3",
"score": "0.61915904",
"text": "def solve( n = 50_000_000 )\n terms = (2..4).map {|root| (1 + n**(1.0 / root)).to_i.prime_sieve}\n (2..4).each {|i| terms[i - 2].map! {|j| j**i}}\n\n sums = {}\n for c in terms[2]\n for b in terms[1]\n for a in terms[0]\n sum = a + b + c\n sums[sum] = true if sum < n\n end\n end\n end\n\n sums.keys.count\n end",
"title": ""
},
{
"docid": "db9dd3da6669f37e660700e7e7c45f5b",
"score": "0.6185368",
"text": "def solution(n)\n i = Math.sqrt(n).floor\n \n while i > 0 do\n k = n / i\n \n if k * i == n\n return 2 * (k + i)\n end\n \n i -= 1\n end\nend",
"title": ""
},
{
"docid": "c33a262c078fba27a9a84e7bbd69b546",
"score": "0.6172054",
"text": "def reordered_power_of2(n) #O(29logN)\n return true if n == 1\n n = digit_count(n)\n get_potentials.each { |p| return true if p == n }\n return false\nend",
"title": ""
},
{
"docid": "7c341432fa7294e71154b72e87bcc162",
"score": "0.61712486",
"text": "def problem_75\n p3 = lambda do |m,n|\n raise \"bad value\" if m == n\n m,n = n,m if m < n\n mm = m*m\n nn = n*n\n [mm - nn, 2*m*n, mm + nn]\n end\n\n max = 1_500_000\n upto = Math.sqrt(max/2).to_i\n# upto = max\n hits = Hash.new\n\n (1..upto).each do |x|\n hit = 0\n y = x + 1\n ((x+1)..(upto+1)).each do |y|\n next unless (x+y).odd?\n a,b,c = p3.call(x,y).sort\n d = a+b+c\n if d <= max\n k = 1\n begin\n hits[d*k] ||= {}\n hits[d*k][[a*k,b*k,c*k].sort.join(\"-\")] = true\n hit += 1\n k += 1\n end while d*k <= max\n else\n break\n end\n end\n puts \"for x = #{x}, #{hit} hits\"\n end\n puts hits.length\n h = hits.select {|k,v| v.length == 1}\n h.length\nend",
"title": ""
},
{
"docid": "86e8324d4292c9312d64eae6f2041796",
"score": "0.6136342",
"text": "def solution_21\n def d(n)\n divisors = divisor_list(n)\n divisors.delete(n)\n divisors.reduce(:+)\n end\n result = 0\n (2..9999).each do |a|\n b = d(a)\n result += a if a == d(b) and a != b\n end\n result\n end",
"title": ""
},
{
"docid": "fda2733731715150f9db3d1255b4992b",
"score": "0.61276895",
"text": "def time(n, x, y)\n if x > y \n x, y = y, x\n end\n t = x \n while t/x + (t - x)/y <= n - 1 do\n t += 1\n end\nt\nend",
"title": ""
},
{
"docid": "1eb11ebc2450890d7a8a8885c8137c04",
"score": "0.6125143",
"text": "def linear(n)\n print \"\\nLinear Search worst case number of iterations:\\n\"\n (1..n).each do |number|\n print \"\\nn = #{number} | iterations = #{number}\"\n end\nend",
"title": ""
},
{
"docid": "a14b824d5f04c185bec4091cf20fda06",
"score": "0.61190176",
"text": "def log3(n)\n a = log(n)\n b = log(3)\n return a / b\nend",
"title": ""
},
{
"docid": "f87c6cc86ae4a1090bb797afd4bccbf2",
"score": "0.6109258",
"text": "def nlogn_fish(arr)\n arr.sort\n arr[-1]\nend",
"title": ""
},
{
"docid": "f18ac23d301da3a4cb6b1496f591d5d2",
"score": "0.61061233",
"text": "def solution(n)\n result = 0\n i = 1\n while i * i < n\n result += 2 if (n % i).zero?\n i += 1\n end\n result += 1 if i * i == n\n result\nend",
"title": ""
},
{
"docid": "83415dea3d7100c1aaecd6d3d6b40414",
"score": "0.61009586",
"text": "def largest_contiguous_subsum(list) #O(n^2)\n sub_arrs = [] #O(1)\n num = list.first #O(1)\n (0...list.length).each do |i| #O(n)\n (i...list.length).each do |j| #O(n)\n sub_arrs << list[i..j] #??? O(1)\n #sub_arrs.shift O(n)\n #the length of sub_arrs\n end\n end \n p sub_arrs #O(1)\n sub_arrs.each do |sub| #O(n)\n if sub.sum > num #O(1)\n num = sub.sum #O(1)\n end \n end \n num #O(1)\nend",
"title": ""
},
{
"docid": "9f058d080f26f609192ec4bbdb27a792",
"score": "0.60997224",
"text": "def two_sum_time(arr, sum)\n hash = {}\n arr.each do |n|\n hash[n] ? hash[n] += 1 : hash[n] = 1\n end\n\n result = []\n arr.each do |n|\n if hash[sum - n] && hash[sum - n] > 0\n hash[sum - n] -= 1\n hash[n] -= 1\n result.push([n, sum - n])\n end\n end\n result\nend",
"title": ""
},
{
"docid": "b59c93bbd575ef4df4c96d164a13c06c",
"score": "0.60872835",
"text": "def solve( n = 10_000_000 )\n f = Array.new( n ) {0}\n\n # Visit all multiples of each potential factor, incrementing a counter\n # for each number less than n.\n (2...n/2).each do |i|\n j = 2*i\n while j < n\n f[j] += 1\n j += i\n end\n end\n\n # Determine how many numbers have same factor count as their successor. \n (2...n).count {|i| f[i] == f[i+1]}\n end",
"title": ""
},
{
"docid": "4101210ce4e3d893a1a6981a890be755",
"score": "0.60857046",
"text": "def coinflips(n)\n Math.log(n, 2)\nend",
"title": ""
},
{
"docid": "32a0ef79e59e9f9547a01b3fcc7312dd",
"score": "0.60755444",
"text": "def solution(a)\n acc = 0\n sum = 0\n\n a.each do |n|\n if n == 0\n acc += 1\n else\n sum += acc\n end\n\n return -1 if sum > 1000000000\n end\n\n sum\nend",
"title": ""
},
{
"docid": "3e34ded6668b4b9f9b5ab1abffa42cc2",
"score": "0.6071966",
"text": "def two_sum?(arr,target_sum) #O(n)\n hash = Hash.new#(false)\n\n arr.each do |el| \n hash[el] = true\n return true if hash[target_sum-el] \n # arr.each do |el| \n # if el*2 != target_sum\n # return true if hash[(target_sum-el)] > 0 \n # else \n # return true if hash[(target_sum-el)] > 1\n # end\n end\n false\nend",
"title": ""
},
{
"docid": "68440ca1495f14ac38532ce439fcd222",
"score": "0.60702467",
"text": "def slow_solution(a)\n ans = []\n a.size.times do |i|\n primes = prime_factors(a[i]) # log n\n nondivisors = a - primes - [1, a[i]]\n ans << nondivisors.size - nondivisors.select {|nd| a[i] % nd == 0}.size\n end\n ans\nend",
"title": ""
},
{
"docid": "f1360fbb565da683e801fab8398866c8",
"score": "0.6068813",
"text": "def slow_solution(n, p, q)\n return [0] * p.size if n == 1\n ans = []\n primes = sieve(n / 2)\n\n # 2. Find all semiprimes between 2 and n\n semiprimes = []\n primes.each_with_index do |prime1, i|\n primes[i..-1].each do |prime2|\n prod = prime1 * prime2\n break if prod > n\n semiprimes << prod\n end\n end\n semiprimes.sort!\n\n p.size.times do |i|\n ans << semiprimes.count { |semi| semi.between?(p[i], q[i]) }\n end\n ans\nend",
"title": ""
},
{
"docid": "4aa095be523badff0b5727113bb3a00b",
"score": "0.6068039",
"text": "def solve( n = 10_000 )\n 5.upto( n - 1 ).count {|i| i.lychrel?}\n end",
"title": ""
},
{
"docid": "927e1b497bf221bac27238a17aa37eaf",
"score": "0.604925",
"text": "def div_sum_divisors(n)\n results = []\n (2..1_000_000).each do |num|\n results << num if (num**3) % div_sum(num) == 0\n break if results.length == n\n end\n results\nend",
"title": ""
},
{
"docid": "a80b476dffcc968e1b56767a9040a1ef",
"score": "0.60439557",
"text": "def discussion\n puts \"For the sorting a 2D mesh the W(n) = sqrt(n)*log(n) + sqrt(n). EvenOddRowSort (line 23) and\\nEvenOddColumnSort (line 47) each perform sqrt(n) parallel comparison steps.\"\n puts \"The Sort2dMesh or in our case sort_mesh (line 7) function itself involes log_2_(n) + 1 steps.\\nThis is how we get the worst case complexity as mentioned before.\"\n end",
"title": ""
},
{
"docid": "4adcd8ce1f663221c3c23c720e9dae18",
"score": "0.60355955",
"text": "def solution(n)\n counter_array = Array.new(n.size+1, 0)\n n.each do |v|\n counter_array[v-1] = 1\n end\n counter_array.find_index(0) + 1\nend",
"title": ""
},
{
"docid": "4209f21a613d287f388b69132f8a5174",
"score": "0.6025921",
"text": "def abundant? n\r\n sum = 1\r\n (2..Math.sqrt(n)).each {|x|\r\n if n%x == 0 \r\n sum += n/x if x != Math.sqrt(n)\r\n sum += x\r\n end\r\n }\r\n sum > n\r\nend",
"title": ""
},
{
"docid": "ea7b59e86ca10e8de54f2f946c9924f7",
"score": "0.60253686",
"text": "def solve( n = 10_000 )\n (0..n).select {|i| i.sqrt_cf.count % 2 == 0}.count\n end",
"title": ""
},
{
"docid": "13080714a25d11a8ff3932a231d9887a",
"score": "0.60083014",
"text": "def method_12478687(arr, i)\n # Simple first answer\n # Linear or O(n) behavior\n #arr.sort.each { |n| return n if n > i }\n\n # Logarithmic or O(log n) behavior\n # Divide-and-counquer algorithm\n #high, low = arr.partition { |n| n > i }\n #high.sort!\n #while high.first <= i\n # high, low = high.partition { |n| n > i }\n #end\n #high.first\n\n # Sort and select greater in the one iteration\n greater = 0\n arr.each do |n|\n next if n <= i\n if greater == 0 || n < greater\n greater = n\n end\n end\n greater\nend",
"title": ""
},
{
"docid": "9e80e359380a420b9f5d0a5b48bc625c",
"score": "0.6008297",
"text": "def problem_70a\n all = []\n (2...10_000_000).each do |n|\n next if n.even? || n % 5 == 0\n t = n.totient\n if n.to_s.split(//).sort == t.to_s.split(//).sort\n puts \"#{n} -> #{t} -> #{n.to_f/t}\" \n all << [n.to_f/t,n]\n end\n end\n all.sort.first\nend",
"title": ""
},
{
"docid": "66487015b79c96d3b0f7cfe917d4f75f",
"score": "0.59989893",
"text": "def logspace(a, b, n)\n (0...n).map do |i|\n t = Float(i) / (n-1)\n 10**( (1-t)*a + t*b )\n end\n end",
"title": ""
},
{
"docid": "7486486d145945704d265f4b9c09cdf9",
"score": "0.59988433",
"text": "def solution(n, a)\n result = Array.new(n, 0)\n max_value = 0\n max_value_used = false\n\n a.each do |elem|\n if elem <= n\n result[elem-1] += 1\n if max_value < result[elem-1]\n max_value = result[elem-1]\n max_value_used = false\n end\n else\n next if max_value_used\n result.fill(max_value)\n max_value_used = true\n end\n end\n\n result\nend",
"title": ""
},
{
"docid": "e30636afa04d1cf8f5432f75d329a456",
"score": "0.5994187",
"text": "def problem(n=28123)\n abunds = n.abundants\n abunds.each_with_index do |a,i|\n abunds[(i)..(abunds.length)].each do |j| \n @sum_two_abunds[a+j] = false\n end\n end\n (1..n).inject(0) {|s,i| @sum_two_abunds[i] ? s+i : s}\n end",
"title": ""
},
{
"docid": "0dc0e6fc48ed8ef2c3238b488877fd94",
"score": "0.5984943",
"text": "def solve( n = 5_000 )\n # From observation, brute force.\n limit = (10 * Math.log( n )).floor\n limit.primepartition_sieve.find_index {|i| i > n}\n end",
"title": ""
},
{
"docid": "d71d7007742232dce050a76397eab1e5",
"score": "0.5983761",
"text": "def solution(n)\n a=Math.sqrt(n).floor.downto(1) {|c| break c if n%c == 0 }\n b=n/a\n 2*(a+b)\nend",
"title": ""
},
{
"docid": "d40fb1372be302f457e9d2d28c4b115f",
"score": "0.5980109",
"text": "def largest_contiguous_subsum(list)\n new_list = []\n i = 0\n while i < list.length # O(n)\n j = i\n while j < list.length # O(n)\n sub = list[i..j] # O(n)\n new_list << sub\n j += 1\n end\n i += 1\n end\n largest_sub_sum = new_list[0].sum #O(n)\n \n new_list.each do |sub| # O(n)\n sub_sum = sub.sum # O(n)\n largest_sub_sum = sub_sum if largest_sub_sum < sub_sum\n end\n\n p new_list\n return largest_sub_sum\nend",
"title": ""
},
{
"docid": "05b623b41aedb92cf80ab1438dccebf1",
"score": "0.5976967",
"text": "def log2factorial(n)\n sum = 0\n 1.upto(n){|i|\n sum += Math.log2(i)\n }\n return sum\n end",
"title": ""
},
{
"docid": "028c2f12b555f61d5187dd608e21672f",
"score": "0.5970484",
"text": "def get_sum_square_difference(n)\n a = 0\n b = 0\n\n (1..n).each do |j|\n a += j\n b += (j * j)\n end\n a *= a\n a - b\nend",
"title": ""
},
{
"docid": "cacfcee9f4f36db314894b97089ed377",
"score": "0.59645057",
"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": "5e7252c1d3551ef48e12c75d0b01ca93",
"score": "0.59644175",
"text": "def solve( n = 100 )\n # Brute force.\n arr = []\n 2.upto( n ) {|a| 2.upto( n ) {|b| arr << a**b}}\n\n arr.uniq!.length\n end",
"title": ""
},
{
"docid": "e19630cfc9dafaa58f0f0d7628e3d758",
"score": "0.5962571",
"text": "def fast_solution(n, p, q)\n return [0] * p.size if n == 1\n ans = []\n # 1. Find primes between 2 and n/2.\n # Semiprime factors don't include > n/2\n primes = sieve(n / 2)\n\n # 2. Mark all semiprimes between 2 and n, with 1\n semiprimes = [0] * (n + 1)\n primes.each_with_index do |prime1, i|\n primes[i..-1].each do |prime2|\n prod = prime1 * prime2\n break if prod > n\n semiprimes[prod] = 1\n end\n end\n# p semiprimes\n# [0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1]\n\n # 3. Prefix sum. Rewrite semiprimes to track # of them up to index.\n (1..n).each do |i|\n semiprimes[i] += semiprimes[i - 1]\n end\n# p semiprimes\n# [0, 0, 0, 0, 1, 1, 2, 2, 2, 3, 4, 4, 4, 4, 5, 6, 6, 6, 6, 6, 6, 7, 8, 8, 8, 9, 10]\n\n ans = []\n # 4. Loop through p, q, using answer to #2, and build answer array\n p.size.times do |i|\n # prefix sums trick. Sum of 1 slice, from p[i] to q[i]\n ans << semiprimes[q[i]] - semiprimes[p[i] - 1]\n end\n ans # [10, 4, 0]\nend",
"title": ""
},
{
"docid": "9cc6bf79ddff9aea1bdffe83b35e5e7b",
"score": "0.59611374",
"text": "def fn( n )\n cache = Array.new(n + 1) { Array.new }\n cache[2] = [0, 9, 8, 7, 6, 5, 4, 3, 2, 1]\n\n place = 2\n\n while place <= n\n\n prev = cache[place]\n next_place = Array.new\n prev.each_with_index do |x, idx|\n next_place[idx] = x * idx\n end\n\n cache[place+1] = next_place\n\n place += 1\n\n end\n\n sum = cache[n].inject(:+)\n sum *= 2\n sum -= 9\n\n sum\nend",
"title": ""
},
{
"docid": "23ba39b5e7e25b07f7e2d4f1fe0c5e84",
"score": "0.59383255",
"text": "def abundant? (n)\r\n\thold=[]\r\n\t(1..((n/2)+1)).each do |y|\r\n\t\tif n % y == 0\r\n\t\t\thold.push(y)\r\n\t\tend\r\n\tend\r\n\tsum = hold.inject(:+)\r\n\t if sum > n\r\n\t \t#puts n\r\n\t \treturn true\r\n\t else\r\n\t \treturn false\r\n\t end\r\nend",
"title": ""
},
{
"docid": "9edc103a9b0ab68ff18d660322e36867",
"score": "0.59360564",
"text": "def solve( n = 1_000 )\n term = 1\n curr = 0\n succ = 1\n\n # Sum/count terms until one is \n while succ < 10**(n - 1)\n term += 1\n curr, succ = succ, curr + succ\n end\n\n term\n end",
"title": ""
},
{
"docid": "c11c0362d3fc52907ab88c5759edd215",
"score": "0.5932469",
"text": "def okay_two_sum?(arr, target)\n merge_sort(arr) #==> time nlogn space nlogn\n\n\nend",
"title": ""
},
{
"docid": "d4e94b2414d8706af520344d32288f18",
"score": "0.59305394",
"text": "def next_number_inefficient(n)\r\n return 0 if n == 0\r\n return 1 if n == 1\r\n next_number_inefficient(n-1) + next_number_inefficient(n-2)\r\nend",
"title": ""
},
{
"docid": "83bc92da8c58bc87fcc2bfc7f4d56beb",
"score": "0.5930079",
"text": "def solve( n = 100 )\n co = {}\n\n (0..20).each do |i|\n d3 = (0 == i) ? 50 : i << 1\n co[\"D#{i}\"] = d3\n\n (0..20).each do |j|\n d2 = (0 == j) ? 25 : j\n co[\"S#{j} D#{i}\"] = d2 + d3\n\n (0..20).each do |k|\n d1 = (0 == k) ? 25 : k\n co[\"S#{k} S#{j} D#{i}\"] = d1 + d2 + d3 if k >= j\n\n d1 <<= 1\n co[\"D#{k} S#{j} D#{i}\"] = d1 + d2 + d3\n\n if 0 < k\n d1 += k\n co[\"T#{k} S#{j} D#{i}\"] = d1 + d2 + d3\n end\n end\n\n d2 <<= 1\n co[\"D#{j} D#{i}\"] = d2 + d3\n\n (0..20).each do |k|\n d1 = (0 == k) ? 50 : k << 1\n co[\"D#{k} D#{j} D#{i}\"] = d1 + d2 + d3 if k >= j\n\n if 0 < k\n d1 += k\n co[\"T#{k} D#{j} D#{i}\"] = d1 + d2 + d3\n end\n end\n\n if 0 < j\n d2 += j\n co[\"T#{j} D#{i}\"] = d2 + d3\n\n (j..20).each do |k|\n d1 = 3*k\n co[\"T#{k} T#{j} D#{i}\"] = d1 + d2 + d3\n end\n end\n end\n end\n\n co.count {|k, v| n > v}\n end",
"title": ""
},
{
"docid": "58e1fa8bcd6897d0c0d2f244ac3d723b",
"score": "0.59254736",
"text": "def subsum(list) \r\n subs = []\r\n list.each_with_index do |el, i| #O(n)\r\n list.each_with_index do |el2, j| #O(n)\r\n subs << list[i..j] if j >= i #O(n)\r\n end\r\n end # => O(n^3)\r\n # O(n^2)\r\n subs.map{|sub| sub.sum}.max # => O(n)\r\nend",
"title": ""
},
{
"docid": "803ddb77c208610ac4827e994b451008",
"score": "0.5921217",
"text": "def better_two_sum(arr, target)\n sorted = arr.sort #n log n\n sorted.each do |ele|\n dif = target - ele\n return true if sorted.bsearch{|x| x == dif}\n end\n false\nend",
"title": ""
},
{
"docid": "1d39b6d1ff27f413c7e218e534d6cc91",
"score": "0.5916336",
"text": "def solve( n = 1_000_000 )\n h = Hash.new\n n.prime_sieve.each {|i| h[i] = true}\n\n p = h.keys\n max = run = 1\n\n 0.upto( p.length - 2 ) do |u|\n s = p[u]\n (u+1).upto( p.length - 1 ) do |v|\n s += p[v]\n\n break if s >= n\n max, run = s, v - u if v - u > run && h[s]\n end\n end\n\n max # puts \"%d (%d primes)\" % [max, 1 + run]\n end",
"title": ""
},
{
"docid": "11b85ac901ed03b44bad347d1c9ca624",
"score": "0.5914742",
"text": "def solve(n, operations)\n arr = Array.new(n, 0)\n operations.each do |op|\n arr[op[0]-1] += op[2]\n arr[op[1]] = arr[op[1]] - op[2] if op[1]< n\n end\n prev = 0\n sum = 0\n arr.each_with_index do |a, idx|\n arr[idx] += prev\n prev = arr[idx]\n sum += arr[idx]\n end\n sum/n\nend",
"title": ""
},
{
"docid": "e11582b13b5018eb7c5ca0f6a44ab79b",
"score": "0.5913093",
"text": "def solve( n = 1_000_000 )\n # Worst kind of brute force...\n (%w(0 1 2 3 4 5 6 7 8 9).permutation( 10 ).to_a.map! {|a| a.join}.sort![n - 1]).to_i\n end",
"title": ""
},
{
"docid": "0bf89226965a1d9fe96f3ff9c85d8fe0",
"score": "0.59108776",
"text": "def tri(n) n * (n + 1) / 2 end",
"title": ""
},
{
"docid": "935543033b8f39002c5f47c08c759ee6",
"score": "0.5910875",
"text": "def two_sum?(arr, target_sum) # O(n + n)\n hash = Hash.new(0)\n arr.each do |ele|\n return true if hash.has_value?(ele)\n hash[ele] = target_sum - ele\n end\n false\nend",
"title": ""
},
{
"docid": "04b208e234cf3d4eb5130cb1368b4cd7",
"score": "0.5909836",
"text": "def euler16(n)\n (2**n).to_s.split('').map { |i| i.to_i }.inject(:+)\nend",
"title": ""
},
{
"docid": "d5735fb98dee51db38d8131e3cee3294",
"score": "0.59074473",
"text": "def n_log_n\n fishes = FISH.dup\n prc = Proc.new { |x, y| x.length <=> y.length }\n fishes.merge_sort(&prc)[0]\nend",
"title": ""
},
{
"docid": "c9935f229eddf053ce762d39e42e44e6",
"score": "0.59052026",
"text": "def solution(n)\n num = 0\n len = Math.sqrt(n).floor\n\n (1..len).each do |i|\n next unless n % i == 0\n\n num += n / i != i ? 2 : 1\n end\n\n num\nend",
"title": ""
},
{
"docid": "0803250b088bcdd04e1de1aae071cacc",
"score": "0.5904676",
"text": "def fun6(n)\n\tm = 0\n\ti = 0\n\twhile i < n\n\t\tj = 0\n\t\twhile j < n\n\t\t\tk = 0\n\t\t\twhile k < n\n\t\t\t\tm += 1\n\t\t\t\tk += 1\n\t\t\tend\n\t\t\tj += 1\n\t\tend\n\t\ti += 1\n\tend\n\treturn m\nend",
"title": ""
},
{
"docid": "9d67d9840e11aaec0e06b88fa6efe516",
"score": "0.59034884",
"text": "def solve( n = 1_000_000 )\n # From observation, brute force.\n limit = (2.75 * n**0.75).floor\n limit.partition_sieve.find_index {|i| 0 == (i % n)}\n end",
"title": ""
},
{
"docid": "17bcc6620e558ee15ac96061fb9df182",
"score": "0.5903193",
"text": "def problem_74\n fac = (0..9).map {|n| n.factorial}\n (0..9).each { |n| fac[n + ?0.ord] = fac[n] }\n\n seen = {\n 1454 => 3, 169 => 3, 363601 => 3,\n 871 => 2, 45361 => 2, \n 145 => 1\n }\n total = 0\n (10..1_000_000).each do |number|\n n = number\n run = []\n until len = seen[n] do\n seen[n] = -1\n run << n\n #n = n.to_digits.reduce(0) {|a,d| a + fac[d.to_i]}\n n = n.to_s.unpack(\"C*\").reduce(0) {|a,d| a + fac[d]} # 21sec\n# n = n.to_digits.reduce(0) {|a,d| a + fac[d]} # 21sec\n# puts \">>#{run.length} #{run.inspect}\"\n end\n # We have now entered a loop\n len += run.length\n# puts \"#{n} => #{len} #{run.inspect}\"\n run.reverse.each_index {|i| seen[run[i]] = len - i }\n if len >= 60\n puts \"#{number} => #{len}\" \n total += 1\n end\n end\n total\nend",
"title": ""
},
{
"docid": "243595c427d1899b0e72093e3e77655e",
"score": "0.5901287",
"text": "def problem_13\n n = %w{\n 37107287533902102798797998220837590246510135740250\n 46376937677490009712648124896970078050417018260538\n 74324986199524741059474233309513058123726617309629\n 91942213363574161572522430563301811072406154908250\n 23067588207539346171171980310421047513778063246676\n 89261670696623633820136378418383684178734361726757\n 28112879812849979408065481931592621691275889832738\n 44274228917432520321923589422876796487670272189318\n 47451445736001306439091167216856844588711603153276\n 70386486105843025439939619828917593665686757934951\n 62176457141856560629502157223196586755079324193331\n 64906352462741904929101432445813822663347944758178\n 92575867718337217661963751590579239728245598838407\n 58203565325359399008402633568948830189458628227828\n 80181199384826282014278194139940567587151170094390\n 35398664372827112653829987240784473053190104293586\n 86515506006295864861532075273371959191420517255829\n 71693888707715466499115593487603532921714970056938\n 54370070576826684624621495650076471787294438377604\n 53282654108756828443191190634694037855217779295145\n 36123272525000296071075082563815656710885258350721\n 45876576172410976447339110607218265236877223636045\n 17423706905851860660448207621209813287860733969412\n 81142660418086830619328460811191061556940512689692\n 51934325451728388641918047049293215058642563049483\n 62467221648435076201727918039944693004732956340691\n 15732444386908125794514089057706229429197107928209\n 55037687525678773091862540744969844508330393682126\n 18336384825330154686196124348767681297534375946515\n 80386287592878490201521685554828717201219257766954\n 78182833757993103614740356856449095527097864797581\n 16726320100436897842553539920931837441497806860984\n 48403098129077791799088218795327364475675590848030\n 87086987551392711854517078544161852424320693150332\n 59959406895756536782107074926966537676326235447210\n 69793950679652694742597709739166693763042633987085\n 41052684708299085211399427365734116182760315001271\n 65378607361501080857009149939512557028198746004375\n 35829035317434717326932123578154982629742552737307\n 94953759765105305946966067683156574377167401875275\n 88902802571733229619176668713819931811048770190271\n 25267680276078003013678680992525463401061632866526\n 36270218540497705585629946580636237993140746255962\n 24074486908231174977792365466257246923322810917141\n 91430288197103288597806669760892938638285025333403\n 34413065578016127815921815005561868836468420090470\n 23053081172816430487623791969842487255036638784583\n 11487696932154902810424020138335124462181441773470\n 63783299490636259666498587618221225225512486764533\n 67720186971698544312419572409913959008952310058822\n 95548255300263520781532296796249481641953868218774\n 76085327132285723110424803456124867697064507995236\n 37774242535411291684276865538926205024910326572967\n 23701913275725675285653248258265463092207058596522\n 29798860272258331913126375147341994889534765745501\n 18495701454879288984856827726077713721403798879715\n 38298203783031473527721580348144513491373226651381\n 34829543829199918180278916522431027392251122869539\n 40957953066405232632538044100059654939159879593635\n 29746152185502371307642255121183693803580388584903\n 41698116222072977186158236678424689157993532961922\n 62467957194401269043877107275048102390895523597457\n 23189706772547915061505504953922979530901129967519\n 86188088225875314529584099251203829009407770775672\n 11306739708304724483816533873502340845647058077308\n 82959174767140363198008187129011875491310547126581\n 97623331044818386269515456334926366572897563400500\n 42846280183517070527831839425882145521227251250327\n 55121603546981200581762165212827652751691296897789\n 32238195734329339946437501907836945765883352399886\n 75506164965184775180738168837861091527357929701337\n 62177842752192623401942399639168044983993173312731\n 32924185707147349566916674687634660915035914677504\n 99518671430235219628894890102423325116913619626622\n 73267460800591547471830798392868535206946944540724\n 76841822524674417161514036427982273348055556214818\n 97142617910342598647204516893989422179826088076852\n 87783646182799346313767754307809363333018982642090\n 10848802521674670883215120185883543223812876952786\n 71329612474782464538636993009049310363619763878039\n 62184073572399794223406235393808339651327408011116\n 66627891981488087797941876876144230030984490851411\n 60661826293682836764744779239180335110989069790714\n 85786944089552990653640447425576083659976645795096\n 66024396409905389607120198219976047599490197230297\n 64913982680032973156037120041377903785566085089252\n 16730939319872750275468906903707539413042652315011\n 94809377245048795150954100921645863754710598436791\n 78639167021187492431995700641917969777599028300699\n 15368713711936614952811305876380278410754449733078\n 40789923115535562561142322423255033685442488917353\n 44889911501440648020369068063960672322193204149535\n 41503128880339536053299340368006977710650566631954\n 81234880673210146739058568557934581403627822703280\n 82616570773948327592232845941706525094512325230608\n 22918802058777319719839450180888072429661980811197\n 77158542502016545090413245809786882778948721859617\n 72107838435069186155435662884062257473692284509516\n 20849603980134001723930671666823555245252804609722\n 53503534226472524250874054075591789781264330331690}.reduce(0) do |a,v|\n a + v.to_i\n end.to_s[0,10]\nend",
"title": ""
},
{
"docid": "72fa899102c258037694540f9f1f4414",
"score": "0.5898818",
"text": "def zaprzyjaznione(n)\n tab = []; (1..n).to_a.each {|x| a = suma_dzielnikow(x); b = suma_dzielnikow(a); tab.push([a,b].sort()) if (x == b) and (x!=a)}; tab.uniq\nend",
"title": ""
},
{
"docid": "245bf9ad2804c63300cf8b5f463204fa",
"score": "0.5893358",
"text": "def sum_less_equal(n)\n sum = 0\n for i in 1..n\n sum += i\n end\n return sum\nend",
"title": ""
},
{
"docid": "6e220f0690e615d3660a744ec48abf9b",
"score": "0.58906484",
"text": "def fun10(n) \n\tm = 0\n\ti = 0\n\twhile i < n\n\t\tj = i\n\t\twhile j > 0\n\t\t\tm += 1\n\t\t\tj -= 1\n\t\tend\n\t\ti += 1\n\tend\n\treturn m\nend",
"title": ""
},
{
"docid": "597abb7cfee605592beed9f2aebab238",
"score": "0.58857167",
"text": "def solution(n)\n total = 0\n\n i = 1\n while i * i < n\n total += 2 if n % i == 0\n i += 1\n end\n total += 1 if i * i == n\n\n total\nend",
"title": ""
},
{
"docid": "1b32d12110d03025a4df2add98d7f9d6",
"score": "0.5883082",
"text": "def solve( n = 1_000 )\n (2**n).sum_digits\n end",
"title": ""
},
{
"docid": "3449dd75ee83b80747955ceb9e33427a",
"score": "0.58824265",
"text": "def sum_of_power(n)\n\tsum=[]\n\t(2..1000000).each do |value|\n\t\tarray = value.to_s.split('').collect{ |m| (m.to_i)**n }.inject(:+)\n\t\tif array == value\n\t\t\tsum << value\n\t\tend\n\tend\n\tsum\nend",
"title": ""
},
{
"docid": "edfb807db3608dd5199114e12b2c3c01",
"score": "0.587596",
"text": "def sum_to_n? arr, n\n hash = Hash.new()\n for x in arr\n if hash[n-x] != nil then\n return true\n end\n hash[x]=true\n end\n return false\nend",
"title": ""
},
{
"docid": "94b952c4eec254dafeaf15d164f67032",
"score": "0.58714795",
"text": "def slow_solution(m, a)\n n = a.size\n return 1 if n == 1\n distinct = 0\n n.times do |back|\n (back..n - 1).each do |front|\n if a[back..front] == a[back..front].uniq\n distinct += 1\n else\n break\n end\n end\n end\n distinct\nend",
"title": ""
},
{
"docid": "91c0866057b09aafebdc7ac091a60e17",
"score": "0.5869508",
"text": "def okay_two_sum?(arr, target) #(Onlogn ~ n^2) + n\n helper = arr.sort\n okay_helper(helper,target) \nend",
"title": ""
},
{
"docid": "56e2f4c229d68e9d667cf5f5fe1d2177",
"score": "0.58682466",
"text": "def solution(a)\r\n # write your code in Ruby 2.2\r\n #a[0] = 1 [-1..1]\r\n #a[1] = 5 [-4..6]\r\n #a[2] = 2 [0..4]\r\n #a[3] = 1 [2..4]\r\n #a[4] = 4 [0..8]\r\n #a[5] = 0 [0]\r\n\r\n i=0\r\n arr=[]\r\n while(i<a.count) do\r\n \r\n arr[i] = (i-a[i].. i+a[i]).to_a\r\n i+=1 \r\n end\r\n \r\n \r\n \r\n l=arr.count\r\n i=0\r\n n=0\r\n while(i<l) do\r\n \r\n \r\n j=i+1\r\n while(j<l) do\r\n if(arr[i] != arr[j])\r\n \r\n if((arr[i] & arr[j]).empty? == false)\r\n n+=1\r\n end\r\n end\r\n j+=1\r\n end \r\n i+=1\r\n end\r\n n\r\nend",
"title": ""
},
{
"docid": "537e708c7a5155f3e4dc95ff3a8b8201",
"score": "0.5864467",
"text": "def solution(n, a)\n m = a.size\n max = 0\n max_counters = false\n counters = []\n\n for i in 0...m do\n counters[a[i] - 1] = max if counters[a[i] - 1] == nil\n max = counters[a[i] - 1] if counters[a[i] - 1] > max\n\n if a[i] > n\n max_counters = true\n else\n if max_counters\n counters[a[i] - 1] = max + 1\n max_counters = false\n else\n counters[a[i] - 1] = counters[a[i] - 1] + 1\n end\n end\n end\nbinding.pry\n for j in 0...n do\n counters[j] = max if counters[j] == nil || counters[j] < max\n end\n\n counters\nend",
"title": ""
},
{
"docid": "0efc7a02b62549839a88810fbfd32865",
"score": "0.5863265",
"text": "def largest_contiguous_subsum_two(list)\n\n largest_sum = list.first # O(1)\n current_sum = list.first # O(1)\n\n list[1..-1].each do |ele| # O(n)\n if current_sum < 0 # O(1)\n current_sum = 0 # O(1)\n end\n current_sum += ele # O(1)\n if current_sum > largest_sum # O(1)\n largest_sum = current_sum # O(1)\n end\n end\n largest_sum # O(1)\nend",
"title": ""
},
{
"docid": "97cf680ea5a9ec5879071d10c693e7e7",
"score": "0.5860009",
"text": "def sum_of_powers(n)\n numbers = []\n\n (2..1000000).each do |x|\n sum_of_powers = x.to_s.split('').map{|i| i.to_i**n}.inject(:+)\n if sum_of_powers == x\n p numbers << sum_of_powers\n end\n end\n numbers.inject(:+)\nend",
"title": ""
},
{
"docid": "22c89ea0d20d6735928944c912d976f0",
"score": "0.5858322",
"text": "def solution(n, a)\n # write your code in Ruby 2.2\n \n c = [0]*n\n max = 0\n a.each do |v|\n if v <= n\n c[v-1] += 1\n if c[v-1] > max\n max = c[v-1]\n end\n else\n c = [max]*n\n end\n end\n c\nend",
"title": ""
},
{
"docid": "3ba870edaddd71e5aac94df121778597",
"score": "0.5857214",
"text": "def solution(n, a)\n # write your code in Ruby 2.2\n\n max_counter = 0\n max_applied_counter = 0\n\n # initialize\n counters = []\n (0..n-1).each do |i|\n counters[i] = 0\n end\n\n a.each do |a_i|\n if(a_i == n+1)\n max_applied_counter = max_counter\n else\n if counters[a_i-1] < max_applied_counter\n counters[a_i-1] = max_applied_counter\n end\n counters[a_i-1] = counters[a_i-1] + 1\n\n if(counters[a_i-1] > max_counter)\n max_counter = counters[a_i-1]\n end\n end\n end\n\n (0..n-1).each do |i|\n if(counters[i] < max_applied_counter)\n counters[i] = max_applied_counter\n end\n end\n counters\nend",
"title": ""
},
{
"docid": "4a508141929402755c08c3a7697315dd",
"score": "0.5850558",
"text": "def two_sum?(arr, target) # O(n)\n hash = Hash.new(0)\n arr.each { |num| hash[num] += 1}\n arr.each do |num|\n diff = target - num\n hash[num] -= 1\n return true if hash[diff] > 0\n end\n\nend",
"title": ""
},
{
"docid": "ce556443e6e18cb229124562a07271ad",
"score": "0.58477485",
"text": "def operation(n, m)\n @arr = []\n (n..m).each do |num| \n series = []\n until num == 1 \n if num % 2 == 0\n num = num / 2\n series << num\n else\n num = 3 * num + 1\n series << num\n end\n end\n @arr << series\n end\n @count = []\n @arr.each do |array|\n @count << array.count\n end\n @count.max + 1\nend",
"title": ""
},
{
"docid": "c38b330a21cf5eb13e27d6860dc7916f",
"score": "0.58469987",
"text": "def n_sum?(arr, n, target_sum)\n\n level_sums = Array.new(n) {Set.new}\n\n arr.each do |el|\n (n-2).downto(0) do |idx|\n level_sums[idx+1] += Set.new(level_sums[idx].map{|member| member+el})\n end\n level_sums[0] += Set.new([el])\n end\n return level_sums.last.include?(target_sum)\n\nend",
"title": ""
},
{
"docid": "ead0b2381881628b549783a8cc7da4ff",
"score": "0.5846859",
"text": "def idcg(top_n=MAX)\n rel_arr = get_rel_arr(top_n).sort.reverse\n log_arr = get_log_arr(top_n)\n product(rel_arr, log_arr)\n # (0...top_n).inject(0) { |product, i| product + rel_arr[i]*log_arr[i] }\n end",
"title": ""
},
{
"docid": "833ecef7188a1e8cf1e813b867d0591f",
"score": "0.58437777",
"text": "def solve1\n # 1.997s under MRI 1.8\n # 0.771s under MRI 1.9\n # 1.919s under jruby\n puts (1..10000).to_a.select { |n| n.amicable? }.sum\nend",
"title": ""
},
{
"docid": "40fcbefbb93eac735cd1cf2ddb2c9bb5",
"score": "0.584031",
"text": "def solve3(n)\n result = []\n start = Time.now\n for a in 0..n\n for b in 0..n\n for c in 0..n\n number = Math.cbrt(a**3 + b**3 - c**3)\n if number >= 0 && number <= n && isInteger(number)\n result.push([a,b,c,number.floor])\n puts \"#{a} #{b} #{c} #{number.floor}\"\n end\n end\n end\n end\n puts \"number of solutions #{result.length}\"\n runTime = Time.now - start\n return runTime\nend",
"title": ""
},
{
"docid": "2dfadae0fa43d00bee8a0686f750057d",
"score": "0.5836806",
"text": "def solution\n sum = 0\n n = 1\n \n while n < 1000\n sum += n**n\n sum %= 10000000000\n n += 1\n end\n sum\nend",
"title": ""
},
{
"docid": "28ee74380ad4f330a37e617f7b44bacb",
"score": "0.5835911",
"text": "def exce1 i, n\n if i == 0\n return 1\n else\n result = 0\n (0..n).each do |k|\n result += exce1(i-1, k)\n end\n return result\n end\nend",
"title": ""
},
{
"docid": "e3bca1dc2f49a7741fe798f818a982b4",
"score": "0.583431",
"text": "def slow_sum_of_multiples_of_3_xor_5(n)\n multiples_3 = []\n multiples_5 = []\n (1..n).each do |i|\n if i%3 == 0\n multiples_3.push(i)\n end\n if i%5 == 0\n multiples_5.push(i)\n end\n end\n multiples_3.each do |i|\n multiples_5.each do |j|\n if i == j\n multiples_3.delete(i)\n multiples_5.delete(j)\n end\n end\n end\n\n sum = 0\n multiples_3.each do |i|\n sum += i\n end\n multiples_5.each do |j|\n sum += j\n end\n\n return sum\nend",
"title": ""
},
{
"docid": "70e4778e3c82d210e8e4db513ad99f11",
"score": "0.5831932",
"text": "def two_sum?(arr, target_sum) #! O(n) \n h = Hash.new()\n arr.each do |ele|\n return true if !h[target_sum - ele].nil?\n h[ele] = true #{0=>true, 1=>true }\n end\n false\nend",
"title": ""
},
{
"docid": "ccf364986efe87d5c6ca672891915835",
"score": "0.5831562",
"text": "def aVeryBigSum(n, ar)\n ar.inject(:+)\nend",
"title": ""
}
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.